You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/l2/README.md
+25-19Lines changed: 25 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ After processing the transfers, the vm computes the commitment of the post state
9
9
10
10
Notice a lot of checks that a real L2 should have are missing, since the focus are on the integration of Aligned.
11
11
12
-
###How it works: Step by Step
12
+
## How it works: Step by Step
13
13
14
14
1. Load or initialize the state.
15
15
2. Load user transfers.
@@ -54,22 +54,24 @@ This same wallet is used to send the proof via aligned, so you'll also need to f
54
54
55
55
#### 2. Deploy the contract
56
56
57
-
Generate the base `.env`. For `Holesky` you can run:
57
+
-Generate the base `.env`. For `Holesky` you can run:
58
58
59
59
```shell
60
60
make gen_env_contract_holesky
61
61
```
62
62
63
-
And then in `contracts/.env` you have to complete the missing variables:
63
+
- Get the program ID of the l2 program you are proving:
64
64
65
-
-`INITIAL_STATE_ROOT`: you can leave it as it is unless you change the initial state in `crates/l2/db.rs`
66
-
-`PROGRAM_ID`: you need to ensure it matches the one on your machine:
67
-
1. Run `make generate_program_id` to generate it.
68
-
2. Check `crates/l2/programs_ids.json` for the ID.
69
-
-`OWNER_ADDRESS`: you have to provide the address of the wallet created in step `1.`.
70
-
-`PRIVATE_KEY`: the private key used for the deployment, it needs to have some funds to pay for the deployment.
65
+
```shell
66
+
make generate_program_id
67
+
```
68
+
69
+
- Complete the following fields `contracts/.env` file:
70
+
-```PROGRAM_ID=``` (use the previously generated ID, you can re check with a ```sh cat ./crates/l2/programs_ids.json``` )
71
+
-`PRIVATE_KEY`: the private key used for the deployment, it needs to have some funds to pay for the deployment.
72
+
-`OWNER_ADDRESS`: you have to provide the address of the wallet created in step `1.`.
71
73
72
-
Once you have completed the `.env`, you can deploy the contract:
74
+
- Deploy the contracts with:
73
75
74
76
```shell
75
77
make deploy_contract
@@ -79,28 +81,32 @@ Save the output contract address.
79
81
80
82
#### 3. Run L2 program
81
83
82
-
Generate the base `.env`. For `Holesky` you can run:
84
+
-Generate the base `.env`. For `Holesky` you can run:
83
85
84
86
```shell
85
87
make gen_env_l2_holesky
86
88
```
87
89
88
-
And complete the variables:
90
+
- Complete the missing fields on the ```sh .env```:
91
+
92
+
-`BEACON_CLIENT_URL`: A beacon client url, public node usually don't work as they don't support the endpoints to retrieve blob data
93
+
-`PRIVATE_KEY_STORE_PATH`: The path to the keystore created in `1.`.
94
+
-`PRIVATE_KEY_STORE_PASSWORD`: The password of the keystore crated in step `1.`.
95
+
-`STATE_TRANSITION_CONTRACT_ADDRESS`: The address of the contract deployed in step `2.`
96
+
97
+
- If you have run the program before, and want to start from scratch, run:
89
98
90
-
-`BEACON_CLIENT_URL`: A beacon client url, public node usually don't work as they don't support the endpoints to retrieve blob data
91
-
-`PRIVATE_KEY_STORE_PATH`: The path to the keystore created in `1.`.
92
-
-`PRIVATE_KEY_STORE_PASSWORD`: The password of the keystore crated in step `1.`.
93
-
-`STATE_TRANSITION_CONTRACT_ADDRESS`: The address of the contract deployed in step `2.`
99
+
```make clean_db```
94
100
95
-
Finally, run the L2:
101
+
- Run the L2:
96
102
97
103
```shell
98
104
make run_l2
99
105
```
100
106
101
-
You should see a transaction receipt in the console and the stateRoot updated on-chain. You can run this process repeatedly, but make sure to not delete the db file, or the application will not be able to prove valid state transitions.
107
+
You should see a transaction receipt in the console and after the stateRoot updated on-chain.
102
108
103
-
### Run it on a local devnet
109
+
### Running it on a local network
104
110
105
111
You can also run this example on a local devnet. To get started, navigate to the root of the Aligned repository and run:
0 commit comments