Skip to content

Commit e868e89

Browse files
committed
docs: readme
1 parent ee69c63 commit e868e89

3 files changed

Lines changed: 25 additions & 23 deletions

File tree

examples/l2/.env.devnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ NETWORK=devnet
33
ETH_RPC_URL=http://localhost:8545
44
WS_ETH_RPC_URL=ws://localhost:8546
55
BEACON_CLIENT_URL=http://localhost:58801
6-
# Generate it with make gen_devnet_owner_wallet
6+
# Generate it with `make gen_devnet_owner_wallet`
77
PRIVATE_KEY_STORE_PATH="../contract-owner.keystore.json" # This is read from cmd/.
88
PRIVATE_KEY_STORE_PASSWORD="<!w5Y%In94Vw"
9+
# Obtain it with `make deploy_contract`
910
STATE_TRANSITION_CONTRACT_ADDRESS=<STATE_TRANSITION_CONTRACT_ADDRESS>

examples/l2/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
SHELL := /bin/bash
44

5-
65
__CONFIG__:
76
gen_devnet_owner_wallet:
87
rm -f ./contract-owner.keystore.json

examples/l2/README.md

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Notice a lot of checks that a real L2 should have are missing, since the focus a
1414
This Layer 2 (L2) system operates in two main steps:
1515

1616
- Off-chain execution and proof generation + verification with Aligned Verification Layer (a.k.a Fast Mode).
17-
- On-chain state update via proof verification with Aligned aggregation mode.
17+
- On-chain state update via proof verification with Aligned Aggregation Mode.
1818

1919
In Step 1, we execute user transfers and generate a zkVM-based proof of the state transition, which is submitted to Aligned’s verification layer.
2020

@@ -41,20 +41,23 @@ In Step 2, once the proof is aggregated (every 24 hours), it is verified on-chai
4141
- Validates that the `initial_state_root` proof public input matches the on-chain state.
4242
- If valid, updates the on-chain state root to the `post_state_root`.
4343

44-
### Usage
44+
# Usage
4545

46-
#### Requirements
46+
### Requirements
4747

4848
1. [Rust](https://www.rust-lang.org/tools/install): we have tested in v1.85.1
4949
2. [Foundry](https://book.getfoundry.sh/getting-started/installation)
5050
3. [Docker](https://docs.docker.com/engine/): for SP1 prover
5151

5252
Submodules of the repo should be imported by running `make submodules` on the root folder
5353

54+
You can run the example on:
55+
- [Holesky](#setup-holeksy)
56+
- [Localnet](#setup-localnet)
5457

5558
## Setup Holeksy
5659

57-
#### 1. Create keystore
60+
### 1. Create keystore
5861

5962
You can use cast to create a local keystore. If you already have one you can skip this step.
6063

@@ -71,11 +74,11 @@ cast wallet import --interactive <path_to_keystore.json>
7174
Then you need to obtain some funds to pay for gas and proof verification.
7275
You can do this by using this [faucet](https://cloud.google.com/application/web3/faucet/ethereum/holesky)
7376

74-
This same wallet is used to send the proof via aligned, so you'll also need to fund it on aligned. Follow this [guide](https://docs.alignedlayer.com/guides/0_submitting_proofs#id-2.-send-funds-to-aligned).
77+
*This same wallet is used to send the proof via aligned, so you'll also need to fund it on aligned. Follow this [guide](https://docs.alignedlayer.com/guides/0_submitting_proofs#id-2.-send-funds-to-aligned).*
7578

76-
#### 2. Deploy the contract
79+
### 2. Deploy the contract
7780

78-
- Generate the base `.env`. For `Holesky` you can run:
81+
- Generate the base `.env`:
7982

8083
```shell
8184
make gen_env_contract_holesky
@@ -89,36 +92,37 @@ make generate_program_id
8992

9093
- Complete the following fields `contracts/.env` file:
9194

92-
- `PROGRAM_ID=` (use the previously generated ID, you can re check with a `sh cat ./crates/l2/programs_ids.json` )
95+
- `PROGRAM_ID=` (use the previously generated ID, you can re check with a `cat ./crates/l2/programs_ids.json` )
9396
- `PRIVATE_KEY`: the private key used for the deployment, it needs to have some funds to pay for the deployment.
94-
- `OWNER_ADDRESS`: you have to provide the address of the wallet created in step `1.`.
97+
- `OWNER_ADDRESS`: you have to provide the *address of the wallet created in step `1.`*.
9598

9699
- Deploy the contracts with:
97100

98101
```shell
99102
make deploy_contract
100103
```
101104

102-
Save the output contract address.
105+
*Save the output contract address.*
103106

104107
### 3. Setup the L2
105108

106-
- Generate the base `.env`. For `Holesky` you can run:
109+
- Generate the base `.env` run:
107110

108111
```shell
109112
make gen_env_l2_holesky
110113
```
111114

112-
- Complete the missing fields on the `sh .env`:
115+
- Complete the missing fields on the `.env`:
113116

114-
- `BEACON_CLIENT_URL`: A beacon client url, public node usually don't work as they don't support the endpoints to retrieve blob data
115117
- `PRIVATE_KEY_STORE_PATH`: The path to the keystore created in `1.`.
116118
- `PRIVATE_KEY_STORE_PASSWORD`: The password of the keystore crated in step `1.`.
117119
- `STATE_TRANSITION_CONTRACT_ADDRESS`: The address of the contract deployed in step `2.`
118120

119-
- If you have run the program before, and want to start from scratch, run:
121+
*If you have run the program before, and want to start from scratch, run:*
120122

121-
`make clean_db`
123+
```shell
124+
make clean_db
125+
```
122126

123127
Finally [run the l2](#running-the-l2).
124128

@@ -135,14 +139,14 @@ make ethereum_package_start
135139
make batcher_start_ethereum_package
136140
```
137141

138-
- Generate the env files for contracts
142+
- Generate the `.env` files for the contracts and L2:
139143

140144
```shell
141145
make gen_env_contract_devnet
142146
make gen_env_l2_devnet
143147
```
144148

145-
- Generate a pre funded wallet (or create one as specified in the previous readme)
149+
- Generate a pre funded wallet (or create one as specified [previously here](#1-create-keystore)):
146150

147151
```shell
148152
# This will generate the keystore and fund it on aligned
@@ -155,7 +159,7 @@ make gen_devnet_owner_wallet
155159
make generate_program_id
156160
```
157161

158-
- Set the ID on ```contracts/.env```. This will be used to accept only proofs of the desired L2 program
162+
- Set the generated program ID on `contracts/.env`.
159163

160164
- Deploy the contract
161165

@@ -168,8 +172,6 @@ make deploy_contract
168172
- [run the l2](#running-the-l2)
169173

170174

171-
172-
173175
## Running the L2
174176

175177
- Perform the L2 account updates and prove them in the zkvm:
@@ -181,7 +183,7 @@ make prove_state_transition
181183
- Wait 24 hs for the proof to be aggregated, or if running locally, run the aggregator with either:
182184

183185
```make start_proof_aggregator_ethereum_package AGGREGATOR=sp1```
184-
or
186+
or with cuda:
185187
```make start_proof_aggregator_gpu_ethereum_package AGGREGATOR=sp1```
186188

187189
- Update state transition on chain:

0 commit comments

Comments
 (0)