|
| 1 | +The following quick start guide shows you how to deploy a CDK rollup (zkevm-node) on your local machine and runs the following components: |
| 2 | + |
| 3 | +- zkEVM node databases |
| 4 | +- Explorer databases |
| 5 | +- L1 network |
| 6 | +- Prover |
| 7 | +- zkEVM node components |
| 8 | +- Explorers |
| 9 | + |
1 | 10 | !!! note |
2 | 11 | - The documentation describes standard deployments. |
3 | 12 | - Edit the configuration files to implement your own custom setups. |
4 | 13 |
|
5 | | -## Run a CDK rollup locally |
| 14 | +## Prerequisites |
6 | 15 |
|
7 | | -The following is a quickstart guide for deploying a CDK rollup (zkevm-node) on your local machine. |
| 16 | +!!! warning |
| 17 | + - Currently the executor/prover does not run on ARM-powered Macs. |
| 18 | + - For Windows users, WSL/WSL2 use is not recommended. |
8 | 19 |
|
9 | | -# Steps to run/develop on the environment locally |
| 20 | +Make sure you have installed the following: |
10 | 21 |
|
11 | | -# Warning: |
| 22 | +- [`go`](https://go.dev/doc/install) |
| 23 | +- [`docker`](https://www.docker.com/get-started) |
| 24 | +- [`docker-compose`](https://docs.docker.com/compose/install/) |
12 | 25 |
|
13 | | ->Currently the Executor/Prover does not run on ARM-powered Macs. For Windows users, WSL/WSL2 use is not recommended. |
| 26 | +## Set up |
14 | 27 |
|
15 | | -## Overview |
| 28 | +Clone the repo: |
16 | 29 |
|
17 | | -This documentation will help run the following components: |
18 | | - |
19 | | -- zkEVM Node Databases |
20 | | -- Explorer Databases |
21 | | -- L1 Network |
22 | | -- Prover |
23 | | -- zkEVM Node components |
24 | | -- Explorers |
25 | | - |
26 | | -## Requirements |
27 | | - |
28 | | -The current version of the environment requires `go`, `docker` and `docker-compose` to be previously installed, check the links below to understand how to install them: |
29 | | - |
30 | | -- <https://go.dev/doc/install> |
31 | | -- <https://www.docker.com/get-started> |
32 | | -- <https://docs.docker.com/compose/install/> |
| 30 | +```sh |
| 31 | +git clone https://github.com/0xPolygonHermez/zkevm-node.git |
| 32 | +cd zkevm-node |
| 33 | +``` |
33 | 34 |
|
34 | | -The `zkevm-node` docker image must be built at least once and every time a change is made to the code. |
35 | | -If you haven't build the `zkevm-node` image yet, you must run: |
| 35 | +Build the `zkevm-node` docker image: |
36 | 36 |
|
37 | 37 | ```bash |
38 | 38 | make build-docker |
39 | 39 | ``` |
40 | 40 |
|
41 | | -## A look at how the binary works: |
| 41 | +!!! info |
| 42 | + The `zkevm-node` docker image must be built at least once and every time a change is made to the code. |
| 43 | + |
| 44 | +!!! important "What's happening under the hood" |
42 | 45 |
|
43 | | -The `zkevm-node` allows certain commands to interact with smart contracts, run certain components, create encryption files and print out debug information. |
| 46 | + The `zkevm-node` has commands that interact with smart contracts, run components, create encryption files, and print out debug information. |
44 | 47 |
|
45 | | -To interact with the binary program we provide docker compose files, and a Makefile to spin up/down the different services and components, ensuring a smooth deployment locally and better interface in command line for developers. |
| 48 | + To interact with the binary program we provide docker compose files, and a Makefile to spin up/down the different services and components, ensuring a smooth deployment locally with a command line interface. |
46 | 49 |
|
47 | 50 | ## Controlling the environment |
48 | 51 |
|
49 | | -> All the data is stored inside of each docker container, this means once you remove the container, the data will be lost. |
| 52 | +!!! important |
| 53 | + - All the data is stored inside Docker containers. |
| 54 | + - This means that you lose all the data when you remove the container. |
50 | 55 |
|
51 | 56 | To run the environment: |
52 | 57 |
|
@@ -76,142 +81,149 @@ make restart |
76 | 81 |
|
77 | 82 | ## Sample data |
78 | 83 |
|
79 | | -The `make run` will execute the containers needed to run the environment but this will not execute anything else, so the L2 will be basically empty. |
| 84 | +`make run` spins up the containers needed to run the environment but this doesn't do anything else, so the L2 is empty at this stage. |
80 | 85 |
|
81 | | -If you need sample data already deployed to the network, we have the following scripts: |
| 86 | +To deploy sample data, use the following scripts: |
82 | 87 |
|
83 | | -**To add some examples of transactions and smart contracts:** |
| 88 | +### Add example transactions and smart contracts |
84 | 89 |
|
85 | 90 | ```bash |
86 | 91 | make deploy-sc |
87 | 92 | ``` |
88 | 93 |
|
89 | | -**To deploy a full uniswap environment:** |
| 94 | +### Deploy a full Uniswap environment |
90 | 95 |
|
91 | 96 | ```bash |
92 | 97 | make deploy-uniswap |
93 | 98 | ``` |
94 | 99 |
|
95 | | -**To grant the Pol smart contract a set amount of tokens, run:** |
| 100 | +### Grant the Pol smart contract a set amount of tokens |
96 | 101 |
|
97 | 102 | ```bash |
98 | 103 | make run-approve-pol |
99 | 104 | ``` |
100 | 105 |
|
101 | 106 | ## Accessing the environment |
102 | 107 |
|
103 | | -- **Databases**: |
| 108 | +### Databases |
| 109 | + |
104 | 110 | - zkEVM Node *State* Database |
105 | 111 | - `Type:` Postgres DB |
106 | 112 | - `User:` state_user |
107 | 113 | - `Password:` state_password |
108 | 114 | - `Database:` state-db |
109 | 115 | - `Host:` localhost |
110 | 116 | - `Port:` 5432 |
111 | | - - `Url:` <postgres://state_user:srare_password@localhost:5432/state-db> |
| 117 | + - `URL:` <postgres://state_user:srare_password@localhost:5432/state-db> |
112 | 118 | - zkEVM Node *Pool* Database |
113 | 119 | - `Type:` Postgres DB |
114 | 120 | - `User:` pool_user |
115 | 121 | - `Password:` pool_password |
116 | 122 | - `Database:` pool_db |
117 | 123 | - `Host:` localhost |
118 | 124 | - `Port:` 5433 |
119 | | - - `Url:` <postgres://pool_user:pool_password@localhost:5433/pool_db> |
| 125 | + - `URL:` <postgres://pool_user:pool_password@localhost:5433/pool_db> |
120 | 126 | - zkEVM Node *JSON-RPC* Database |
121 | 127 | - `Type:` Postgres DB |
122 | 128 | - `User:` rpc_user |
123 | 129 | - `Password:` rpc_password |
124 | 130 | - `Database:` rpc_db |
125 | 131 | - `Host:` localhost |
126 | 132 | - `Port:` 5434 |
127 | | - - `Url:` <postgres://rpc_user:rpc_password@localhost:5434/rpc_db> |
| 133 | + - `URL:` <postgres://rpc_user:rpc_password@localhost:5434/rpc_db> |
128 | 134 | - Explorer L1 Database |
129 | 135 | - `Type:` Postgres DB |
130 | 136 | - `User:` l1_explorer_user |
131 | 137 | - `Password:` l1_explorer_password |
132 | 138 | - `Database:` l1_explorer_db |
133 | 139 | - `Host:` localhost |
134 | 140 | - `Port:` 5435 |
135 | | - - `Url:` <postgres://l1_explorer_user:l1_explorer_password@localhost:5435/l1_explorer_db> |
| 141 | + - `URL:` <postgres://l1_explorer_user:l1_explorer_password@localhost:5435/l1_explorer_db> |
136 | 142 | - Explorer L2 Database |
137 | 143 | - `Type:` Postgres DB |
138 | 144 | - `User:` l2_explorer_user |
139 | 145 | - `Password:` l2_explorer_password |
140 | 146 | - `Database:` l2_explorer_db |
141 | 147 | - `Host:` localhost |
142 | 148 | - `Port:` 5436 |
143 | | - - `Url:` <postgres://l2_explorer_user:l2_explorer_password@localhost:5436/l2_explorer_db> |
144 | | -- **Networks**: |
| 149 | + - `URL:` <postgres://l2_explorer_user:l2_explorer_password@localhost:5436/l2_explorer_db> |
| 150 | + |
| 151 | +### Networks |
| 152 | + |
145 | 153 | - L1 Network |
146 | 154 | - `Type:` Geth |
147 | 155 | - `Host:` localhost |
148 | 156 | - `Port:` 8545 |
149 | | - - `Url:` <http://localhost:8545> |
| 157 | + - `URL:` <http://localhost:8545> |
150 | 158 | - zkEVM Node |
151 | 159 | - `Type:` JSON RPC |
152 | 160 | - `Host:` localhost |
153 | 161 | - `Port:` 8123 |
154 | | - - `Url:` <http://localhost:8123> |
155 | | -- **Explorers**: |
| 162 | + - `URL:` <http://localhost:8123> |
| 163 | + |
| 164 | +### Explorers |
| 165 | + |
156 | 166 | - Explorer L1 |
157 | 167 | - `Type:` Web |
158 | 168 | - `Host:` localhost |
159 | 169 | - `Port:` 4000 |
160 | | - - `Url:` <http://localhost:4000> |
| 170 | + - `URL:` <http://localhost:4000> |
161 | 171 | - Explorer L2 |
162 | 172 | - `Type:` Web |
163 | 173 | - `Host:` localhost |
164 | 174 | - `Port:` 4001 |
165 | | - - `Url:` <http://localhost:4001> |
166 | | -- Prover |
167 | | - - `Type:` Mock |
168 | | - - `Host:` localhost |
169 | | - - `Port:` Depending on the prover image, if it's mock or not: |
170 | | - - Prod prover: 50052 for Prover, 50061 for Merkle Tree, 50071 for Executor |
171 | | - - Mock prover: 43061 for MT, 43071 for Executor |
172 | | - - `Url:` <http://localhost:50001> |
173 | | -## Metamask |
174 | | - |
175 | | -> Metamask requires the network to be running while configuring it, so make sure your network is running before starting. |
176 | | -
|
177 | | -To configure your Metamask to use your local environment, follow these steps: |
178 | | - |
179 | | -1. Log in to your Metamask wallet |
180 | | -2. Click on your account picture and then on Settings |
181 | | -3. On the left menu, click on Networks |
182 | | -4. Click on `Add Network` button |
183 | | -5. Fill up the L2 network information |
| 175 | + - `URL:` <http://localhost:4001> |
| 176 | + - Prover |
| 177 | + - `Type:` Mock |
| 178 | + - `Host:` localhost |
| 179 | + - `Port:` Depending on the prover image, if it's mock or not: |
| 180 | + - Prod prover: 50052 for Prover, 50061 for Merkle Tree, 50071 for Executor |
| 181 | + - Mock prover: 43061 for MT, 43071 for Executor |
| 182 | + - `URL:` <http://localhost:50001> |
| 183 | + |
| 184 | +## MetaMask |
| 185 | + |
| 186 | +!!! info |
| 187 | + Metamask requires the network to be running while configuring it, so make sure your network is running before starting. |
| 188 | + |
| 189 | +To configure MetaMask to use your local environment, follow these steps: |
| 190 | + |
| 191 | +1. Log in to your MetaMask wallet. |
| 192 | +2. Click your account picture and then on **Settings**. |
| 193 | +3. On the left menu, click **Networks**. |
| 194 | +4. Click the **Add Network** button. |
| 195 | +5. Enter the following L2 network information: |
184 | 196 | 1. `Network Name:` Polygon zkEVM - Local |
185 | 197 | 2. `New RPC URL:` <http://localhost:8123> |
186 | 198 | 3. `ChainID:` 1001 |
187 | 199 | 4. `Currency Symbol:` ETH |
188 | 200 | 5. `Block Explorer URL:` <http://localhost:4000> |
189 | | -6. Click on Save |
190 | | -7. Click on `Add Network` button |
191 | | -8. Fill up the L1 network information |
| 201 | +6. Click **Save**. |
| 202 | +7. Click the **Add Network** button, |
| 203 | +8. Enter the following L1 network information: |
192 | 204 | 1. `Network Name:` Geth - Local |
193 | 205 | 2. `New RPC URL:` <http://localhost:8545> |
194 | 206 | 3. `ChainID:` 1337 |
195 | 207 | 4. `Currency Symbol:` ETH |
196 | | -9. Click on Save |
| 208 | +9. Click **Save**. |
197 | 209 |
|
198 | | -## L1 Addresses |
| 210 | +## L1 addresses |
199 | 211 |
|
200 | 212 | | Address | Description | |
201 | 213 | |---|---| |
202 | | -| 0x8dAF17A20c9DBA35f005b6324F493785D239719d | Polygon ZKEVM | |
203 | | -| 0x40E0576c0A7dff9dc460B29ba73e79aBf73dD2a9 | Polygon Bridge | |
| 214 | +| 0x8dAF17A20c9DBA35f005b6324F493785D239719d | Polygon zkEVM | |
| 215 | +| 0x40E0576c0A7dff9dc460B29ba73e79aBf73dD2a9 | Polygon bridge | |
204 | 216 | | 0x5FbDB2315678afecb367f032d93F642f64180aa3 | Pol token | |
205 | 217 | | 0x8A791620dd6260079BF849Dc5567aDC3F2FdC318 | Polygon GlobalExitRootManager | |
206 | 218 | | 0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e | Polygon RollupManager | |
207 | 219 |
|
208 | | -## Deployer Account |
| 220 | +## Deployer account |
209 | 221 |
|
210 | 222 | | Address | Private Key | |
211 | 223 | |---|---| |
212 | 224 | | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 | |
213 | 225 |
|
214 | | -## Sequencer Account |
| 226 | +## Sequencer account |
215 | 227 |
|
216 | 228 | | Address | Private Key | |
217 | 229 | |---|---| |
@@ -241,6 +253,9 @@ To configure your Metamask to use your local environment, follow these steps: |
241 | 253 | | 0xdD2FD4581271e230360230F9337D5c0430Bf44C0 | 0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0 | |
242 | 254 | | 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199 | 0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e | |
243 | 255 |
|
244 | | - |
245 | | - |
| 256 | +<!-- |
| 257 | +This quick start is from here: |
246 | 258 | [https://github.com/0xPolygonHermez/zkevm-node/blob/develop/docs/running_local.md](https://github.com/0xPolygonHermez/zkevm-node/blob/develop/docs/running_local.md) |
| 259 | +Need to remove it from there and add a link to docs. |
| 260 | +> |
| 261 | +
|
0 commit comments