Skip to content

Commit 24e0ab2

Browse files
first in depth review till errors
1 parent adf996a commit 24e0ab2

File tree

7 files changed

+115
-374
lines changed

7 files changed

+115
-374
lines changed

docs/cdk/get-started/deploy-rollup/create-wallets.md

Lines changed: 20 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
## Clone the contracts
1+
## Set up wallet contracts
22

3-
Clone the contracts from our [github repository](https://github.com/0xPolygonHermez/zkevm-contracts):
3+
Clone the wallet contracts from the [`zkevm-contracts` repository](https://github.com/0xPolygonHermez/zkevm-contracts) and install the `npm` libraries.
44

5-
```bash
6-
cd ~
5+
```sh
76
git clone https://github.com/0xPolygonHermez/zkevm-contracts.git
87
cd ~/zkevm-contracts
98
npm i
109
```
1110

1211
## Create wallets
1312

14-
Next, create a `wallets.js` file with the following content:
13+
Next, create a `wallets.js` file.
1514

16-
```bash
15+
```sh
1716
cd ~/zkevm-contracts
18-
vim wallets.js
17+
nano wallets.js
1918
```
2019

20+
Copy/paste the JavaScript code below.
21+
2122
```js
2223
const ethers = require("ethers");
2324

@@ -47,93 +48,32 @@ main().catch((e) => {
4748

4849
Generate the wallets using below command:
4950

50-
```bash
51+
```sh
5152
node wallets.js | tee wallets.txt
5253
```
5354

54-
## Prepare deploy configuration
55+
## Prepare deployment configuration
5556

56-
Edit the environment variables:
57+
1. Edit the environment variables file.
5758

5859
```bash
5960
cp .env.example .env # copies .env.example file into .env
6061
nano .env # opens .env file for editing
6162
```
6263

63-
Set these variables:
64-
65-
```bash
66-
cd ~/zkevm-contracts
67-
cp .env.example .env
68-
vim .env
69-
```
70-
71-
Set these variables within your .env file:
64+
2. Set the following variables.
7265

73-
```bash
74-
MNEMONIC="..." # from wallets.txt Deployment Address mnemonic
75-
INFURA_PROJECT_ID="..." # your API Key from Infura account
76-
ETHERSCAN_API_KEY="..." # your Etherscan API key
66+
```sh
67+
`MNEMONIC`="..." # from wallets.txt Deployment Address mnemonic
68+
`INFURA_API_KEY`="..." # your API Key from Infura account
69+
`ETHERSCAN_API_KEY`="..." # your Etherscan API key
7770
```
7871

79-
Next, open the `deploy_parameters.json` file in vim editor:
80-
81-
```bash
82-
cd ~/zkevm-contracts/deployment
83-
cp deploy_parameters.json.example deploy_parameters.json
84-
vim deploy_parameters.json
85-
```
86-
87-
Only fill in the commented fields in your `deploy_parameters.json` file:
88-
89-
```json
90-
{
91-
"realVerifier": true,
92-
"trustedSequencerURL": "<http://X.X.X.X:8545>", // your public IP
93-
"networkName": "zkevm",
94-
"version": "0.0.1",
95-
"trustedSequencer": "", // from wallets.txt Trusted Sequencer address
96-
"chainID": 42069, // put any id you prefer
97-
"trustedAggregator": "", // from wallets.txt Trusted Aggregator address
98-
"trustedAggregatorTimeout": 604799,
99-
"pendingStateTimeout": 604799,
100-
"forkID": 4,
101-
"admin": "", // from wallets.txt Deployment Address address
102-
"zkEVMOwner": "", // from wallets.txt Deployment Address address
103-
"timelockAddress": "", // from wallets.txt Deployment Address address
104-
"minDelayTimelock": 1,
105-
"salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
106-
"initialZkEVMDeployerOwner": "", // from wallets.txt Deployment Address address
107-
"maticTokenAddress": "", // put existing contract address or leave empty to auto-deploy a new contract
108-
"zkEVMDeployerAddress": "", // put existing contract address or leave empty to auto-deploy a new contract
109-
"deployerPvtKey": "",
110-
"maxFeePerGas": "",
111-
"maxPriorityFeePerGas": "",
112-
"multiplierGas": ""
113-
}
114-
```
115-
116-
!!!caution
117-
Get some GöETH
118-
119-
You will need to send 0.5 GöETH to the deployment address wallet listed in `wallets.txt`.
120-
121-
Adjust the `gasPrice` according to the network status. For Goerli, you can check it with the following command, where you insert your Etherscan API key, note this can sometimes be 0 for testnet:
122-
123-
```bash
124-
ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY" echo "$(($(printf "%d\\n" $(curl -s "https://api-goerli.etherscan.io/api?module=proxy&action=eth_gasPrice&apikey=$ETHERSCAN_API_KEY" | jq -r .result))/1000000000)) Gwei"
125-
```
126-
127-
Edit `~/zkevm/zkevm-contracts/deployment/helpers/deployment-helpers.js` to adjust the `gasPrice` according to network status. It is recommended to add 50 Gwei to the current `gasPrice` to ensure transactions are processed quickly.
128-
129-
```js
130-
vim ~/zkevm-contracts/deployment/helpers/deployment-helpers.js
131-
const gasPriceKeylessDeployment = "50"; // 50 gwei
132-
```
72+
3. Send 0.5 GöETH to the deployment address wallet listed in `wallets.txt`.
13373

13474
## Deploy contracts
13575

136-
```bash
76+
```sh
13777
cd ~/zkevm-contracts/
13878
npm i @openzeppelin/hardhat-upgrades
13979
npm run deploy:deployer:ZkEVM:goerli
@@ -142,9 +82,9 @@ npm run deploy:testnet:ZkEVM:goerli
14282
npm run verify:ZkEVM:goerli
14383
```
14484

145-
The previous scripts will auto-deploy the MATIC token contract and the `zkEVMDeployer` contract if required.
85+
The scripts auto-deploy the MATIC token contract and the `zkEVMDeployer` contract if required.
14686

147-
You will see in the logs the verification of each smart contract deployed, but you can check it on etherscan too.
87+
4. Check the deployment was successful on Etherscan.
14888

14989
```html
15090
https://goerli.etherscan.io/address/0x -> Put the Deployment Address wallet from
Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
1-
## Overview of the full environment
1+
Deploying the full stack Polygon CDK zkRollup EVM-compatible network requires installing and deploying a number of different components.
22

3-
Implementing the full stack Polygon CDK zkRollup EVM-compatible network involves more than just running a node and the prover to validate batches and deploy smart contracts. In its entirety, it encompasses all these processes and more.
4-
5-
The common rollup actors are the sequencer, the aggregator, the synchroniser and the JSON RPC node. All these affect the L2 state.
6-
7-
Also, the aggregator uses the prover to avail verifiable proofs of sequenced batches. And the sequenced batches are composed of transactions taken from the pool database.
8-
9-
This highlights just a few main components. The rest of the components and those working in the background, are listed in the next subsection.
10-
11-
### Why you need Docker
12-
13-
The modular design of the CDK zkRollup EVM-compatible network allows for most components to be separately instantiated, and we therefore run each of these instances in a separate Docker container.
14-
15-
The below table enlists all the CDK zkRollup EVM-compatible components/services and their corresponding container-names.
16-
17-
Our CDK zkRollup deployment-guide provides CLI commands to automatically create these Docker containers.
3+
!!! info
4+
Each component runs in its own Docker container.
185

196
| Component | Container | Brief\ Description |
207
| :---------------- | :------------------- | ------------------------------------------------------------ |
21-
| Sequencer | zkevm-sequencer | Fetches txs from the pool DB, checks if valid, then puts valid ones into a batch. |
22-
| Aggregator | zkevm-aggregator | Validates sequenced batches by generating verifiable zero-knowledge proofs. |
23-
| Synchronizer | zkevm-sync | Updates the state by fetching data from Ethereum through the Etherman. |
24-
| JSON RPC | zkevm-rpc | An interface for interacting with the network. e.g., Metamask, Etherscan or Bridge. |
25-
| State DB | zkevm-state-db | A database for permanently storing state data (apart from the Merkle tree). |
26-
| Prover | zkevm-prover-server | Used by the aggregator to create zk-proofs. Runs on an external cloud server. |
27-
| Pool DB | zkevm-pool-db | Stores txs from the RPC nodes, waiting to be put in a batch by the sequencer. |
28-
| Executor | zkevm-executor | Executes all processes. Collects results’ metadata (state root, receipts, logs) |
29-
| Etherman | zkevm-eth-tx-manager | Implements methods for all interactions with the L1 network and smart contracts. |
30-
| Bridge UI | zkevm-bridge-ui | User-interface for bridging ERC-20 tokens between L2 and L1 or another L2. |
31-
| Bridge DB | zkevm-bridge-db | A database for storing bridge-related transactions data. |
32-
| Bridge service | zkevm-bridge-service | A backend service enabling clients like the web UI to interact with bridge smart contracts. |
33-
| zkEVM explorer | zkevm-explorer-l2 | L2 network's block explorer. i.e., The zkRollup Etherscan [rxplorer](https://zkevm.polygonscan.com). |
34-
| zkEVM explorer DB | zkevm-explorer-l2-db | Database for the L2 network's Block explorer. i.e., Where all the zkRollup Etherscan explorer queries are made. |
35-
| Gas pricer | zkevm-l2gaspricer | Responsible for suggesting the gas price for the L2 network fees. |
36-
| Goërli execution | goerli-execution | L1 node's execution layer. |
37-
| Goërli consensus | goerli-consensus | L1 node's consensus layer.
8+
| Sequencer | `zkevm-sequencer` | Fetches txs from the pool DB, checks if valid, then puts valid ones into a batch. |
9+
| Aggregator | `zkevm-aggregator` | Validates sequenced batches by generating verifiable zero-knowledge proofs. |
10+
| Synchronizer | `zkevm-sync` | Updates the state by fetching data from Ethereum through the Etherman. |
11+
| JSON RPC | `zkevm-rpc` | An interface for interacting with the network. e.g., Metamask, Etherscan or Bridge. |
12+
| State DB | `zkevm-state-db` | A database for permanently storing state data (apart from the Merkle tree). |
13+
| Prover | `zkevm-prover-server` | Used by the aggregator to create zk-proofs. The full prover is extremely resource-heavy and runs on an external cloud server. Use the mock prover for evaluation/test purposes. |
14+
| Pool DB | `zkevm-pool-db` | Stores txs from the RPC nodes, waiting to be put in a batch by the sequencer. |
15+
| Executor | `zkevm-executor` | Executes all processes. Collects results’ metadata (state root, receipts, logs) |
16+
| Etherman | `zkevm-eth-tx-manager` | Implements methods for all interactions with the L1 network and smart contracts. |
17+
| Bridge UI | `zkevm-bridge-ui` | User-interface for bridging ERC-20 tokens between L2 and L1 or another L2. |
18+
| Bridge DB | `zkevm-bridge-db` | A database for storing bridge-related transactions data. |
19+
| Bridge service | `zkevm-bridge-service` | A backend service enabling clients like the web UI to interact with bridge smart contracts. |
20+
| zkEVM explorer | `zkevm-explorer-l2` | L2 network's block explorer. i.e., The zkRollup Etherscan [explorer](https://zkevm.polygonscan.com). |
21+
| zkEVM explorer DB | `zkevm-explorer-l2-db` | Database for the L2 network's Block explorer. i.e., Where all the zkRollup Etherscan explorer queries are made. |
22+
| Gas pricer | `zkevm-l2gaspricer` | Responsible for suggesting the gas price for the L2 network fees. |
23+
| Goërli execution | `goerli-execution` | L1 node's execution layer. |
24+
| Goërli consensus | `goerli-consensus` | L1 node's consensus layer.
Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,68 @@
1-
First, install base dependencies:
1+
Open a terminal window and run the following commands to install the required software.
22

3-
```bash
3+
## Install base dependencies
4+
5+
```sh
46
sudo apt update -y
57
sudo apt install -y tmux git curl unzip jq aria2 pv
8+
```
9+
10+
## Install Docker
611

7-
curl -fsSL get.docker.com | CHANNEL=stable sh
8-
sudo apt install docker-ce
12+
```sh
13+
sudo apt-get install docker-ce
914
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
1015

1116
sudo usermod -aG docker $USER
1217
newgrp docker && newgrp $USER
18+
```
19+
20+
## Install Node/npm
1321

22+
```sh
1423
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
1524
source ~/.bashrc
1625
nvm install 16
1726
node -v
27+
```
28+
29+
## Install Golang
1830

31+
```sh
1932
wget https://go.dev/dl/go1.20.4.linux-amd64.tar.gz
2033
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.4.linux-amd64.tar.gz
2134
rm -rf go1.20.4.linux-amd64.tar.gz
2235
```
2336

24-
Next, add these to your `.profile`:
37+
Confirm the Golang installation with `$ go version`.
2538

26-
```bash
27-
echo '
28-
export ZKEVM_NET=mainnet
29-
export ZKEVM_DIR=~/zkevm/zkevm-node
30-
export ZKEVM_CONFIG_DIR=~/zkevm/zkevm-config
31-
32-
[ -d "/usr/local/go/bin" ] && PATH="/usr/local/go/bin:$PATH"
33-
' >> ~/.profile
34-
source .profile
35-
```
39+
## Update profile configuration
3640

37-
Lastly, confirm the installation of Golang by running this command: `$ go version`
41+
Add the following environment variables to your `~/.profile`.
3842

43+
```bash
44+
echo '
45+
export ZKEVM_NET=mainnet
46+
export ZKEVM_DIR=~/zkevm/zkevm-node
47+
export ZKEVM_CONFIG_DIR=~/zkevm/zkevm-config
48+
49+
[ -d "/usr/local/go/bin" ] && PATH="/usr/local/go/bin:$PATH"
50+
' >> ~/.profile
51+
source .profile
52+
```
53+
54+
<!--
3955
## Download/extract mainnet files
4056
41-
Next step in the process is to download the mainnet files. This download is over **70GB**, so it's recommended to run the download in a tmux/screen session to handle any network interruptions.
57+
Next step in the process is to download the mainnet files.
4258
43-
The files are located in several urls, so a script can be used as shown below:
59+
!!! important
60+
- The download is over **70GB**.
61+
- You might like to run the download in a tmux/screen session to handle any network interruptions.
4462
45-
```bash
63+
The files are located in several urls, so a script can be used as shown below:
4664
65+
```sh
4766
urls=(
4867
"https://storage.googleapis.com/zkevm/zkproverc/v0.6.0.0-rc.1.tgz"
4968
"https://storage.googleapis.com/zkevm/zkproverc/v0.7.0.0-rc.1.tgz"
@@ -68,3 +87,5 @@ Once the download is finished, you should extract the files using the following
6887
```bash
6988
tar xzvf v1.1.0-rc.1-fork.4.tgz
7089
```
90+
91+
-->
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
This quick start takes you through the process of deploying a full CDK zkRollup, EVM-compatible network on Goerli.
22

33
!!!caution
4-
- Instructions in this document are subject to frequent updates as the software is still at an early development stage.
5-
- Please [open a ticket](https://support.polygon.technology/support/tickets/new) or reach out to our [support team on Discord](https://discord.com/invite/0xPolygon) if you encounter any issues.
4+
- This quick start is subject to frequent updates as the software remains at an early development stage.
5+
- Please [open a ticket](https://support.polygon.technology/support/tickets/new) or reach out to the [support team on Discord](https://discord.com/invite/0xPolygon) if you encounter any issues.
66

7-
The process is split into separate sections:
7+
The process is split into the following sections:
88

9-
1. [Overview of the full environment](environment-overview.md): Overview of the full CDK zkRollup environment we're building.
9+
1. [Overview of the full environment](environment-overview.md).
1010

11-
2. [Prerequisites](prerequisites.md): Preliminary setup, checking system requirements, and prerequisite variables.
11+
2. [Prerequisites steps](prerequisites.md): Preliminary setup, checking system requirements, and prerequisite variables.
1212

13-
2. [Installation](install-dependencies.md): Installing dependencies and downloading mainnet files.
13+
3. [Install dependencies](install-dependencies.md): Install required dependencies and downloading mainnet files.
1414

15-
3. [Create wallets](create-wallets.md): Creating wallets and deploying contracts.
15+
4. [Create wallets](create-wallets.md): Create wallets and deploy contracts.
1616

17-
4. [Deploy node](deploy-node.md): Deployment of the zkRollup EVM-compatible node.
17+
5. [Deploy node](deploy-node.md): Deploy the zkRollup EVM-compatible node.
1818

19-
5. [Configure prover](configure-prover.md): Configuring the prover and services.
19+
6. [Configure prover](configure-prover.md): Configure the prover and services.
2020

21-
6. [Set up Goerli node](setup-goerli-node.md): Activating forced transactions and bridging/claiming assets.
21+
7. [Activate forced transactions](activate-forced-transactions.md): Activate forced transactions, and bridge/claim assets.

0 commit comments

Comments
 (0)