Skip to content

Commit 2fec136

Browse files
authored
Pull changes from testnet to staging (#1147)
2 parents 32a0e66 + cf84ee8 commit 2fec136

File tree

7 files changed

+126
-208
lines changed

7 files changed

+126
-208
lines changed

README.md

Lines changed: 1 addition & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -3,190 +3,4 @@
33
> [!CAUTION]
44
> To be used in testnet only.
55
6-
## Table of Contents
7-
8-
- [Aligned](#aligned)
9-
- [Table of Contents](#table-of-contents)
10-
- [The Project](#the-project)
11-
- [How to use the testnet](#how-to-use-the-testnet)
12-
- [Operator Guide](#operator-guide)
13-
- [Aligned Infrastructure Guide](#aligned-infrastructure-guide)
14-
- [Submitting Proofs to Aligned](#submitting-proofs-to-aligned)
15-
- [Integrating Aligned into your Project](#integrating-aligned-into-your-project)
16-
- [Versioning and Networks](#versioning-and-networks)
17-
18-
19-
## The Project
20-
21-
Aligned is a decentralized network of nodes that verifies Zero-Knowledge and Validity proofs, and post the results in Ethereum.
22-
23-
These proofs can be generated and used for a tenth of the price, and with extremely low latency, allowing novel types of applications that weren't possible before in Ethereum.
24-
25-
## How to use the testnet
26-
27-
1. Download and install Aligned to send proofs in the testnet:
28-
29-
```bash
30-
curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/install_aligned.sh | bash
31-
```
32-
33-
2. Then run the ```source``` command that should appear in the shell.
34-
35-
36-
3. Download an example SP1 proof file with it's ELF file using:
37-
38-
```bash
39-
curl -L https://raw.githubusercontent.com/yetanotherco/aligned_layer/main/batcher/aligned/get_proof_test_files.sh | bash
40-
```
41-
42-
We are downloading a proof previously generated, sending it to Aligned, and retrieving the results from Ethereum Holesky testnet. Aligned is using EigenLayer to do a fast and cheap verification of more than one thousand proofs per second.
43-
44-
4. Let's send the proof to be verified in Aligned:
45-
46-
```bash
47-
rm -rf ~/.aligned/aligned_verification_data/ &&
48-
aligned submit \
49-
--proving_system SP1 \
50-
--proof ~/.aligned/test_files/sp1_fibonacci.proof \
51-
--vm_program ~/.aligned/test_files/sp1_fibonacci.elf \
52-
--aligned_verification_data_path ~/.aligned/aligned_verification_data \
53-
--batcher_url wss://batcher.alignedlayer.com \
54-
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
55-
--payment_service_addr 0x815aeCA64a974297942D2Bbf034ABEe22a38A003
56-
```
57-
58-
5. You should get a response like this:
59-
60-
```bash
61-
[2024-07-01T19:17:54Z WARN aligned] Missing keystore used for payment. This proof will not be included if sent to Eth Mainnet
62-
[2024-07-01T19:17:54Z INFO aligned] Submitting proofs to the Aligned batcher...
63-
[2024-07-01T19:19:18Z INFO aligned] Batch inclusion data written into ./aligned_verification_data/e367d76e_0.json
64-
[2024-07-01T19:19:18Z INFO aligned] Proofs submitted to aligned. See the batch in the explorer:
65-
[2024-07-01T19:19:18Z INFO aligned] https://explorer.alignedlayer.com/batches/0xe367d76e832edec893d3a9027b3c231b2e3994c47acfac2e67197c13c9be0c4c
66-
```
67-
68-
You can use the link to the explorer to check the status of your transaction.
69-
70-
6. After three Ethereum blocks, you can check if it has been verified with:
71-
72-
```bash
73-
aligned verify-proof-onchain \
74-
--aligned-verification-data ~/.aligned/aligned_verification_data/*.json \
75-
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
76-
--chain holesky \
77-
--payment_service_addr 0x815aeCA64a974297942D2Bbf034ABEe22a38A003
78-
```
79-
80-
This is reading the result of the verification of the proof in Ethereum.
81-
82-
7. You should get this result:
83-
84-
```bash
85-
[2024-06-17T21:58:43Z INFO aligned] Your proof was verified in Aligned and included in the batch!
86-
```
87-
88-
If the proof wasn't verified you should get this result:
89-
90-
```bash
91-
[2024-06-17T21:59:09Z INFO aligned] Your proof was not included in the batch.
92-
```
93-
94-
Aligned works in:
95-
- MacOS Arm64 (M1 or higher)
96-
- Linux x86 with GLIBC_2.32 or superior (For example, Ubuntu 22.04 or higher)
97-
If you don't meet these requirements, clone the repository, install rust, and then run:
98-
99-
```bash
100-
make uninstall_aligned
101-
make install_aligned_compiling
102-
```
103-
104-
### Reading the results of proof verification in Ethereum
105-
106-
107-
#### Using CURL and an Ethereum RPC
108-
In step 6 of the previous section, we used the `aligned verify-proof-onchain` to check that our proof was verified in Aligned.
109-
110-
Internally, this is making a call to our Aligned contract, verifying commitments are right, and that the proof is included in the batch.
111-
112-
That command is doing the same as the following `curl` to an Ethereum node.
113-
114-
```bash
115-
curl -H "Content-Type: application/json" \
116-
--data '{"jsonrpc":"2.0","method":"eth_call","id":1, "params":[{"to": "0x58F280BeBE9B34c9939C3C39e0890C81f163B623", "data": "<CALL_DATA>"}]}' \
117-
-X POST https://ethereum-holesky-rpc.publicnode.com
118-
```
119-
120-
This will return 0x1 if the proof and it's associated data is correct and verified in Aligned, and 0x0 if not.
121-
122-
For example, this a correct calldata for a verified proof:
123-
124-
```bash
125-
curl -H "Content-Type: application/json" \
126-
--data '{"jsonrpc":"2.0","method":"eth_call","id":1,"params":[{"to": "0x58F280BeBE9B34c9939C3C39e0890C81f163B623", "data": "0xfa534dc0c181e470901eecf693bfa6f0e89e837dcf35700cdd91c210a0ce0660e86742080000000000000000000000000000000000000000000000000000000000000000836371a502bf5ad67be837b21fa99bc381f7e8124f02042ffb80fa7ce27bc8f6f39fd6e51aad88f6f4ce6ab8827279cfffb922660000000000000000000000007553cb14bff387c06e016cb3e7946e91d9fe44a54ad5d888ce8343ddb16116a700000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000007600000000000000000000000000000000000000000000000000000000000001007b2f4966c3ab3e59d213eda057734df28c323055a2a02f50bd286585cc80128c967250f2b9ad990485338fd2d49e83f47917983f5566da551d4c32e9063ea5641d94b04bac222e06ea18cbb617d0d52c7007cc8f8b30c435b8b8101bdff0ea8482436acf251652f00397f4cefa0bb8eea1c8addb6cf2ca843004b89d80c7e1e41344fd2387535fe4afcaafde27b04543d993bbbc7286154044913e5bd65b86d7cc4d47a90132a95d9ffecb913b414ba2d2f0b1d7b826eb5025a27bcadcc0d94cb125c9c9d556eac08dd6b0f5f55f68afe699f3c529442dbf1b47e968b3705ee2e1be4acb884d184a139a390cb94e9e5806686605dc0a025269bc3afd990c8302"}]}' \
127-
-X POST https://ethereum-holesky-rpc.publicnode.com
128-
```
129-
130-
To generate the calldata yourself, follow these steps:
131-
132-
1. Clone the repository and move into it.
133-
2. Create a Python virtual environment and install the dependencies with:
134-
135-
```bash
136-
python3 -m venv .aligned_venv
137-
source .aligned_venv/bin/activate
138-
python3 -m pip install -r examples/verify/requirements.txt
139-
```
140-
141-
3. Encode your proof verification data with:
142-
143-
```bash
144-
python3 examples/verify/encode_verification_data.py --aligned-verification-data ~/.aligned/aligned_verification_data/*.json
145-
```
146-
147-
If your verification data is in another path, just change the `--aligned-verification-data` parameter.
148-
149-
#### Using a caller contract
150-
151-
To verify a proof in your own contract, use a static call to the Aligned contract. You can use the following [Caller Contract](examples/verify/src/VerifyBatchInclusionCaller.sol) as an example. The code will look like this:
152-
153-
```solidity
154-
(bool callWasSuccessfull, bytes memory proofIsIncluded) = targetContract.staticcall(
155-
abi.encodeWithSignature(
156-
"verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256)",
157-
proofCommitment,
158-
pubInputCommitment,
159-
provingSystemAuxDataCommitment,
160-
proofGeneratorAddr,
161-
batchMerkleRoot,
162-
merkleProof,
163-
verificationDataBatchIndex
164-
)
165-
);
166-
require(callWasSuccessfull, "static_call failed");
167-
```
168-
169-
## Operator Guide
170-
171-
If you want to run an operator, check our [Operator Guide](./docs/operator_guides/0_running_an_operator.md).
172-
173-
## Aligned Infrastructure Guide
174-
175-
If you are developing on Aligned, or want to run your own devnet, check our [setup Aligned guide](docs/3_guides/6_setup_aligned.md).
176-
177-
178-
## Submitting Proofs to Aligned
179-
For submitting proofs generated by your own project to the network via CLI, see the documentation on [submitting proofs to Aligned](docs/3_guides/0_submitting_proofs.md).
180-
181-
182-
## Integrating Aligned into your Project
183-
184-
If you are developing applications using Aligned, we offer a [Rust-SDK](docs/3_guides/1_SDK_how_to.md) for submitting proofs directly to the network within your applications.
185-
186-
## Versioning and Networks
187-
188-
Testnet code and documentation is always in sync with the default [Testnet Branch](https://github.com/yetanotherco/aligned_layer/tree/feat/testnet)
189-
190-
Releases are provided for each version of the testnet.
191-
192-
Latest version of the code, deployed on staging network, is always on [Staging Branch](https://github.com/yetanotherco/aligned_layer/tree/feat/staging)
6+
To learn more about Aligned and how to use it, refer to the [docs page](https://docs.alignedlayer.com/) or [docs folder](./docs/).

docs/1_introduction/0_about_aligned.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ Since Aligned’s operators only need to run the verification code on bare metal
9191
- Adding new proof systems is straightforward.
9292

9393
Preliminary numbers show that Aligned can verify more than 1000 proofs per second, over two orders of magnitude than the EVM at nominal capacity. Using effective batching techniques, we can split the task creation and verification cost between thousands of proofs.
94+
95+
## Future additions
96+
97+
- Propagation of the results to different L2s

docs/1_introduction/4_faq.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@ Aligned’s mission is to extend Ethereum’s zero-knowledge capabilities. We ar
66

77
The question we want to share is: If we are sure that zero-knowledge proofs are the future of Ethereum, but we don't know which of the many possible zero-knowledge futures will win, **then how do we build infrastructure for Ethereum to make it compatible with any future zero-knowledge proving system?**
88

9+
### What are the security guarantees and trust assumptions of Aligned?
10+
11+
Aligned verifies proofs by having the operators re-execute the verification code for each proof and, if all of the proofs are valid, each of them signs a message containing a commitment to the proof and public input or the root of the batch. The aggregator is responsible for receiving the signatures, checking the quorum, performing the aggregation and sending them to Ethereum.
12+
13+
- 67% of the operators behaving dishonestly to be able to submit false proofs.
14+
- 33% of the operators colluding to censor a batch of proofs or task. However, in the case of a batch, the operators can only censor the whole batch, but not a particular proof included in it.
15+
- The aggregator can censor batches or proofs by not sending the aggregated signature.
16+
17+
### What is the batcher?
18+
19+
We have a service called the batcher that batches enough proofs to send to the AVS in Eigen Layer to reduce on-chain verification costs. Users can submit their proofs to Aligned directly without the batcher. The batcher is fully optional. The batcher is an optimization to reduce on-chain verification costs.
20+
21+
### What are the security guarantees added by the batcher?
22+
23+
A batcher can censor proofs. The user can run their own batcher to avoid censorship or can send a task to verify proofs in Aligned via Ethereum without using the batcher.
24+
The batcher cannot transfer user's funds to other accounts, only spend them to create verification tasks and pay to the aggregator. We recommend to only deposit enough funds for a few months of operations.
25+
26+
### How do I send proofs without a batcher?
27+
28+
### How do I run my own batcher?
29+
930
### Why build Aligned on top of Ethereum?
1031

1132
Ethereum is the most decentralized and most significant source of liquidity in the crypto ecosystem. We believe it is the most ambitious and long-term project on the internet. Aligned is being built to help Ethereum achieve its highest potential, and we believe this is only possible through validity/zero-knowledge proofs.

docs/2_architecture/0_supported_verifiers.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ The following is the list of the verifiers currently supported by Aligned:
88
- :white_check_mark: gnark [(v0.11.0)](https://github.com/Consensys/gnark/releases/tag/v0.11.0) - Plonk (with BN254 and BLS12-381)
99
- :white_check_mark: SP1 [(v1.0.1)](https://github.com/succinctlabs/sp1/releases/tag/v1.0.1)
1010
- :white_check_mark: Risc0 [(v1.0.1)](https://github.com/risc0/risc0/releases/tag/v1.0.1)
11-
- :white_check_mark: Halo2 - Plonk/KZG
12-
- :white_check_mark: Halo2 - Plonk/IPA
11+
- 🏗️ Circom
12+
- 🏗️ Lambdaworks
13+
- 🏗️ Kimchi
1314

14-
The following are going to be added soon:
15+
The following are in the roadmap to be added:
1516

16-
- :black_square_button: Kimchi
1717
- :black_square_button: Jolt
1818
- :black_square_button: Nexus
19-
- :black_square_button: Circom

docs/3_guides/6_setup_aligned.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,25 +415,25 @@ make batcher_send_risc0_burst
415415
<details>
416416
<summary>Plonk</summary>
417417

418-
Send an individual bn254 proof:
418+
Send an individual BN254 proof:
419419

420420
```bash
421421
make batcher_send_plonk_bn254_task
422422
```
423423

424-
Send a burst of 15 bn254 proofs:
424+
Send a burst of 15 BN254 proofs:
425425

426426
```bash
427427
make batcher_send_plonk_bn254_burst
428428
```
429429

430-
Send an individual bl12 proof:
430+
Send an individual BLS12-381 proof:
431431

432432
```bash
433433
make batcher_send_plonk_bls12_381_task
434434
```
435435

436-
Send a burst of 15 bl12 proofs:
436+
Send a burst of 15 BLS12-381 proofs:
437437

438438
```bash
439439
make batcher_send_plonk_bls12_381_burst
@@ -444,19 +444,19 @@ make batcher_send_plonk_bls12_381_burst
444444
<details>
445445
<summary>Groth16</summary>
446446

447-
Send an individual bn254 proof:
447+
Send an individual BN254 proof:
448448

449449
```bash
450450
make batcher_send_groth16_bn254_task
451451
```
452452

453-
Send bn254 proofs indefinitely:
453+
Send BN254 proofs indefinitely:
454454

455455
```bash
456456
make batcher_send_infinite_groth16
457457
```
458458

459-
Send bn254 proof bursts indefinitely:
459+
Send BN254 proof bursts indefinitely:
460460

461461
```bash
462462
make batcher_send_burst_groth16

docs/operator_guides/0_running_an_operator.md

Lines changed: 77 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,27 @@ Update the following placeholders in `./config-files/config-operator.yaml`:
9292
`"<ecdsa_key_store_location_path>"` and `"<bls_key_store_location_path>"` are the paths to your keys generated with the EigenLayer CLI, `"<operator_address>"` and `"<earnings_receiver_address>"` can be found in the `operator.yaml` file created in the EigenLayer registration process.
9393
The keys are stored by default in the `~/.eigenlayer/operator_keys/` directory, so for example `<ecdsa_key_store_location_path>` could be `/path/to/home/.eigenlayer/operator_keys/some_key.ecdsa.key.json` and for `<bls_key_store_location_path>` it could be `/path/to/home/.eigenlayer/operator_keys/some_key.bls.key.json`.
9494

95-
The default configuration uses the public nodes RPC, but we suggest you use your own nodes for better performance and reliability.
96-
Also, from v0.5.2 there is a fallback mechanism to have two RPCs, so you can add a second RPC for redundancy.
95+
Two RPCs are used, one as the main one, and the other one as a fallback in case one node is working unreliably.
96+
97+
Default configurations is set up to use the same public node in both scenarios.
98+
99+
{% hint style="danger" %}
100+
101+
PUBLIC NODES SHOULDN'T BE USED AS THE MAIN RPC. We recommend not using public nodes at all.
102+
103+
FALLBACK AND MAIN RPCs SHOULD BE DIFFERENT.
104+
105+
{% endhint %}
106+
107+
Most of the actions will pass through the main RPC unless there is a problem with it. Events are fetched from both nodes.
97108

98109
```yaml
99-
eth_rpc_url: "https://ethereum-holesky-rpc.publicnode.com"
100-
eth_rpc_url_fallback: "https://ethereum-holesky-rpc.publicnode.com"
101-
eth_ws_url: "wss://ethereum-holesky-rpc.publicnode.com"
102-
eth_ws_url_fallback: "wss://ethereum-holesky-rpc.publicnode.com"
110+
eth_rpc_url: "https://<RPC_1>"
111+
eth_rpc_url_fallback: "https://<RPC_2>"
112+
eth_ws_url: "wss://<RPC_1>"
113+
eth_ws_url_fallback: "wss://<RPC_2>"
103114
```
104115
105-
106116
## Step 4 - Deposit Strategy Tokens
107117
108118
We are using [WETH](https://holesky.eigenlayer.xyz/restake/WETH) as the strategy token.
@@ -152,6 +162,66 @@ If you don't have Holesky ETH, these are some useful faucets:
152162
./operator/build/aligned-operator start --config ./config-files/config-operator.yaml
153163
```
154164

165+
### Run Operator using Systemd
166+
167+
To manage the Operator process on Linux systems, we recommend use systemd with the following configuration:
168+
169+
You should create a user and a group in order to run the Operator and set the service unit to use that. In the provided service unit, we assume you have already created a user called `aligned`
170+
171+
```toml
172+
# aligned-operator.service
173+
174+
[Unit]
175+
Description=Aligned Operator
176+
After=network.target
177+
178+
[Service]
179+
Type=simple
180+
User=aligned
181+
ExecStart=<path_to_aligned_layer_repository>/operator/build/aligned-operator start --config <path_to_operator_config>
182+
Restart=always
183+
RestartSec=1
184+
StartLimitBurst=100
185+
186+
[Install]
187+
WantedBy=multi-user.target
188+
```
189+
190+
{% hint style="info" %}
191+
`aligned-operator.service` is just an arbitrary name. You can name your service as you wish, following the format `<service-name>.service`.
192+
{% endhint %}
193+
194+
Once you have configured the `aligned-operator.service` file, you need to run the following commands:
195+
196+
```shell
197+
sudo cp aligned-operator.service /etc/systemd/system/aligned-operator.service
198+
sudo systemctl enable --now aligned-operator.service
199+
```
200+
201+
{% hint style="warning" %}
202+
All paths must be absolute.
203+
{% endhint %}
204+
205+
Those commands will link the service to systemd directory and then, will start the Operator service.
206+
207+
Also, if the server running the operator goes down, systemd will start automatically the Operator on server startup.
208+
209+
#### Restart operator
210+
211+
If you want to restart the operator, you can use the following command:
212+
213+
```shell
214+
sudo systemctl restart aligned-operator.service
215+
```
216+
217+
#### Get Operators logs
218+
219+
Once you are running your operator using systemd, you can get its logs using journalctl as follows:
220+
221+
```shell
222+
journalctl -xfeu aligned-operator.service
223+
```
224+
155225
## Unregistering the operator
156226

157227
To unregister the Aligned operator, run:

0 commit comments

Comments
 (0)