|
3 | 3 | > [!CAUTION] |
4 | 4 | > To be used in testnet only. |
5 | 5 |
|
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/). |
0 commit comments