Skip to content

Commit 9d3c4be

Browse files
committed
docs: update testnet docs (#973)
1 parent 13cdc86 commit 9d3c4be

File tree

6 files changed

+80
-84
lines changed

6 files changed

+80
-84
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ You can use the link to the explorer to check the status of your transaction.
7272
aligned verify-proof-onchain \
7373
--aligned-verification-data ~/.aligned/aligned_verification_data/*.json \
7474
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
75-
--chain holesky
75+
--chain holesky \
76+
--payment_service_addr 0x815aeCA64a974297942D2Bbf034ABEe22a38A003
7677
```
7778
7879
This is reading the result of the verification of the proof in Ethereum.
@@ -92,7 +93,7 @@ If the proof wasn't verified you should get this result:
9293
Aligned works in:
9394
- MacOS Arm64 (M1 or higher)
9495
- Linux x86 with GLIBC_2.32 or superior (For example, Ubuntu 22.04 or higher)
95-
If you don't meet these requirements, clone the repository, install rust, and then run:
96+
If you don't meet these requirements, clone the repository, install rust, and then run:
9697
9798
```bash
9899
make uninstall_aligned

docs/1_introduction/1_getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Use the link in the response to check the status of your transaction in the Alig
5353
aligned verify-proof-onchain \
5454
--aligned-verification-data ~/.aligned/aligned_verification_data/*.json \
5555
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
56-
--chain holesky
56+
--payment_service_addr 0x815aeCA64a974297942D2Bbf034ABEe22a38A003
5757
```
5858
5959
This is reading the result of the proof verification in Ethereum.

docs/3_guides/1_SDK_how_to.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ To use this SDK in your Rust project, add the following to your `Cargo.toml`:
1212

1313
```toml
1414
[dependencies]
15-
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag="v0.5.2" }
15+
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer", tag="v0.6.0" }
1616
```
1717

1818
To find the latest release tag go to [releases](https://github.com/yetanotherco/aligned_layer/releases) and copy the

docs/3_guides/2_integrating_aligned_into_your_application.md

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ The proof submission and verification can be done either with the SDK or by usin
116116

117117
#### Using the SDK
118118

119-
To submit a proof using the SDK, you can use the `submit_and_wait_verification` function.
120-
This function submits the proof to aligned and waits for it to be verified in Aligned.
121-
Alternatively you can call `submit` if you dont want to wait for proof verification.
119+
To submit a proof using the SDK, you can use the `submit` function, and then you can use the `verify_proof_onchain` function to check if the proof was correctly verified in Aligned.
120+
122121
The following code is an example of how to submit a proof using the SDK:
123122

124123
```rust
@@ -162,9 +161,6 @@ async fn submit_proof_to_aligned(
162161
#[tokio::main]
163162
async fn main() {
164163
let wallet = // Initialize wallet
165-
166-
let wallet = wallet.with_chain_id(17000u64)
167-
168164
let proof = // Generate or obtain proof
169165

170166
match submit_proof_to_aligned(proof, wallet).await {
@@ -174,6 +170,41 @@ async fn main() {
174170
}
175171
```
176172

173+
The following code is an example of how to verify the proof was correctly verified in Aligned using the SDK:
174+
175+
```rust
176+
use aligned_sdk::sdk::verify_proof_onchain;
177+
use aligned_sdk::types::{AlignedVerificationData, Chain};
178+
use ethers::prelude::*;
179+
use tokio::time::{sleep, Duration};
180+
181+
async fn wait_for_proof_verification(
182+
aligned_verification_data: AlignedVerificationData,
183+
rpc_url: String,
184+
) -> Result<(), anyhow::Error> {
185+
for _ in 0..10 {
186+
if verify_proof_onchain(aligned_verification_data.clone(), Chain::Holesky, rpc_url.as_str()).await.is_ok_and(|r| r) {
187+
println!("Proof verified successfully.");
188+
return Ok(());
189+
}
190+
println!("Proof not verified yet. Waiting 10 seconds before checking again...");
191+
sleep(Duration::from_secs(10)).await;
192+
}
193+
anyhow::bail!("Proof verification failed")
194+
}
195+
196+
#[tokio::main]
197+
async fn main() {
198+
let aligned_verification_data = // Obtain aligned verification data
199+
let rpc_url = "https://ethereum-holesky-rpc.publicnode.com".to_string();
200+
201+
match wait_for_proof_verification(aligned_verification_data, rpc_url).await {
202+
Ok(_) => println!("Proof verified"),
203+
Err(err) => println!("Error: {:?}", err),
204+
}
205+
}
206+
```
207+
177208
You can find an example of the proof submission and verification in the [ZKQuiz Program](../../examples/zkquiz/quiz/script/src/main.rs).
178209

179210
This example generates a proof, instantiates a wallet to submit the proof, and then submits the proof to Aligned for verification. It then waits for the proof to be verified in Aligned.

docs/3_guides/3_validating_public_input.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This guide assumes you are in the `examples/validating-public-input` directory.
1010

1111
## Generate your ZK Proof
1212

13-
> [!IMPORTANT]
13+
> [!IMPORTANT]
1414
> To generate the proof ensure you have [docker](https://www.docker.com/get-started/) installed and the docker daemon running.
1515
> This is necessary to ensure deterministic builds of the binary we want to generate a proof of. If not used, builds may differ depending on the system you are running on. To know more about this, check [this link](https://dev.risczero.com/terminology#deterministic-builds) from RiscZero docs.
1616
@@ -42,17 +42,15 @@ pragma solidity ^0.8.12;
4242
4343
contract FibonacciValidator {
4444
address public alignedServiceManager;
45-
address public paymentServiceAddr;
4645
bytes32 public fibonacciProgramId;
4746
4847
bytes32 public fibonacciProgramIdCommitment =
4948
0x069ed9f3972550a2901523723f4beb5e240749dcafa30e1623d0778e17d69d70;
5049
5150
event FibonacciNumbers(uint32 fibN, uint32 fibNPlusOne);
5251
53-
constructor(address _alignedServiceManager, address _paymentServiceAddr) {
52+
constructor(address _alignedServiceManager) {
5453
alignedServiceManager = _alignedServiceManager;
55-
paymentServiceAddr = _paymentServiceAddr;
5654
}
5755
5856
function verifyBatchInclusion(
@@ -80,15 +78,14 @@ contract FibonacciValidator {
8078
bytes memory proofIsIncluded
8179
) = alignedServiceManager.staticcall(
8280
abi.encodeWithSignature(
83-
"verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256,address)",
81+
"verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256)",
8482
proofCommitment,
8583
pubInputCommitment,
8684
programIdCommitment,
8785
proofGeneratorAddr,
8886
batchMerkleRoot,
8987
merkleProof,
90-
verificationDataBatchIndex,
91-
paymentServiceAddr
88+
verificationDataBatchIndex
9289
)
9390
);
9491
@@ -119,7 +116,6 @@ contract FibonacciValidator {
119116
return (first, second);
120117
}
121118
}
122-
123119
```
124120

125121
### Explanation
@@ -150,15 +146,14 @@ require(
150146
bytes memory proofIsIncluded
151147
) = alignedServiceManager.staticcall(
152148
abi.encodeWithSignature(
153-
"verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256,address)",
149+
"verifyBatchInclusion(bytes32,bytes32,bytes32,bytes20,bytes32,bytes,uint256)",
154150
proofCommitment,
155151
pubInputCommitment,
156152
programIdCommitment,
157153
proofGeneratorAddr,
158154
batchMerkleRoot,
159155
merkleProof,
160-
verificationDataBatchIndex,
161-
paymentServiceAddr
156+
verificationDataBatchIndex
162157
)
163158
);
164159
@@ -197,7 +192,6 @@ To deploy the contract, first you will need to set up the `.env` file in the con
197192
RPC_URL=<rpc_url> #You can use publicnode RPC: https://ethereum-holesky-rpc.publicnode.com
198193
PRIVATE_KEY=<private_key>
199194
ALIGNED_SERVICE_MANAGER_ADDRESS=<service_manager_address> #0x58F280BeBE9B34c9939C3C39e0890C81f163B623 for Holesky
200-
PAYMENT_SERVICE_ADDRESS=<payment_service_address> #0x815aeCA64a974297942D2Bbf034ABEe22a38A003 for Holesky
201195
```
202196

203197
Then, run `make deploy_fibonacci_validator`.

0 commit comments

Comments
 (0)