Skip to content

Commit 0078174

Browse files
interim commit
1 parent 8c1aa5d commit 0078174

File tree

7 files changed

+237
-382
lines changed

7 files changed

+237
-382
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
## Set up
2+
3+
1. Create some working directories.
4+
5+
!!! info
6+
The following commands takes care of directory placements where non-obvious.
7+
8+
```sh
9+
mkdir -p ~/zkevm/data/{statedb,pooldb} ~/zkevm/zkevm-config ~/zkevm/zkevm-node
10+
```
11+
12+
2. Populate the directories by fetching data from latest mainnet node release.
13+
14+
```sh
15+
export ZKEVM_NET="mainnet"
16+
export ZKEVM_DIR="zkevm"
17+
curl -L https://github.com/0xPolygonHermez/zkevm-node/releases/latest/download/$ZKEVM_NET.zip > $ZKEVM_NET.zip && unzip -o $ZKEVM_NET.zip -d $ZKEVM_DIR && rm $ZKEVM_NET.zip
18+
```
19+
20+
3. Copy the `example.env` file into `.env` file and open it for editing.
21+
22+
```sh
23+
export ZKEVM_CONFIG_DIR="/root/zkevm/zkevm-config"
24+
cd ~/zkevm/mainnet
25+
cp example.env .env
26+
nano .env
27+
```
28+
29+
4. In the `.env` file, set the following:
30+
31+
```sh
32+
ZKEVM_NODE_ETHERMAN_URL = "" # set valid Goerli RPC endpoint
33+
ZKEVM_NODE_STATEDB_DATA_DIR = "~/zkevm/data/statedb"
34+
ZKEVM_NODE_POOLDB_DATA_DIR = "~/zkevm/data/pooldb"
35+
```
36+
37+
## Approve MATIC token for sequencer
38+
39+
1. Launch a Hardhat console connected to the Goerli network.
40+
41+
```sh
42+
cd ~/zkevm-contracts
43+
npx hardhat console --network goerli
44+
```
45+
46+
2. Add the extra data and copy/paste the following code into the open console.
47+
48+
```js
49+
const provider = ethers.getDefaultProvider("<GOERLI_RPC_NODE>"); // set Goerli RPC node
50+
const privateKey = "<TRUSTED_SEQUENCER_PK>"; // from wallet.txt
51+
const wallet = new ethers.Wallet(privateKey, provider);
52+
53+
const maticTokenFactory = await ethers.getContractFactory(
54+
"ERC20PermitMock",
55+
provider
56+
);
57+
maticTokenContract = maticTokenFactory.attach("<maticTokenAddress>"); // from ~/zkevm-contracts/deployments/goerli_*/deploy_output.json
58+
maticTokenContractWallet = maticTokenContract.connect(wallet);
59+
await maticTokenContractWallet.approve("<polygonZkEVMAddress>", ethers.utils.parseEther("100.0")); // from ~/zkevm-contracts/deployments/goerli_*/deploy_output.json
60+
```
61+
62+
## Configure genesis
63+
64+
1. Copy the `genesis.json` file into the appropriate location.
65+
66+
```sh
67+
cp ~/zkevm-contracts/deployment/genesis.json ~/zkevm/mainnet/config/environments/mainnet/public.genesis.config.json
68+
```
69+
70+
2. Copy/paste the json below to the head of the file inputting the data from `~/zkevm/zkevm-contracts/deployments/deploy_output.json`.
71+
72+
!!! important
73+
The `genesisBlockNumber` is called `deploymentBlockNumber` in `deploy_output.json`.
74+
75+
```json
76+
"l1Config" : {
77+
"chainId": 5,
78+
"polygonZkEVMAddress": "",
79+
"maticTokenAddress": "",
80+
"polygonZkEVMGlobalExitRootAddress": ""
81+
},
82+
"genesisBlockNumber": <number-here>,
83+
```
84+
85+
## Update node config
86+
87+
Add the missing parameters in `~/zkevm/mainnet/config/environments/mainnet/public.node.config.toml`.
88+
89+
- `ApiKey` // for Etherscan
90+
- `URL` // for Goerli node
91+
92+
## Add wallet keystores
93+
94+
Copy/paste the keystore value from `wallets.txt` for the sequencer and aggregator respectively into the following files.
95+
96+
```sh
97+
# paste only the keystore value from wallets.txt in each respective file
98+
nano ~/zkevm/zkevm-config/sequencer.keystore
99+
nano ~/zkevm/zkevm-config/aggregator.keystore
100+
```

docs/cdk/get-started/deploy-rollup/configure-prover.md

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -630,87 +630,4 @@ vim ~/zkevm/mainnet/docker-compose.yml
630630
- "/bin/sh"
631631
- "-c"
632632
- "/app/zkevm-bridge run --cfg /app/config.toml"
633-
```
634-
635-
## Start services
636-
637-
Continue with starting all the services as indicated below.
638-
639-
### Start the databases
640-
641-
```bash
642-
export ZKEVM_NET="mainnet"
643-
export ZKEVM_DIR="/root/zkevm"
644-
export ZKEVM_CONFIG_DIR="/root/zkevm/zkevm-config"
645-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-pool-db zkevm-state-db
646-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-pool-db
647-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-state-db
648-
```
649-
650-
### Start the prover (contains executor)
651-
652-
```bash
653-
export ZKEVM_NET="mainnet"
654-
export ZKEVM_DIR="/root/zkevm"
655-
export ZKEVM_CONFIG_DIR="/root/zkevm/zkevm-config"
656-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-prover
657-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-prover --tail 20
658-
```
659-
660-
### Start synchronizer
661-
662-
```bash
663-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-sync
664-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-sync --tail 20
665-
```
666-
667-
### Start L2 gas pricer
668-
669-
```bash
670-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-l2gaspricer
671-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-l2gaspricer --tail 20
672-
```
673-
674-
### Start transaction manager
675-
676-
```bash
677-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-eth-tx-manager
678-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-eth-tx-manager --tail 20
679-
```
680-
681-
### Start the RPC
682-
683-
```bash
684-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-json-rpc
685-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-json-rpc --tail 20
686-
```
687-
688-
### Start the sequencer
689-
690-
```bash
691-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-sequencer
692-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-sequencer --tail 20
693-
```
694-
695-
### Start the aggregator
696-
697-
```bash
698-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-aggregator
699-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-aggregator --tail 20
700-
```
701-
702-
### Start the block explorer
703-
704-
```bash
705-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-explorer-l2 zkevm-explorer-l2-db
706-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-explorer-l2-db
707-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-explorer-l2 --tail 20
708-
```
709-
710-
### Start the bridge
711-
712-
```bash
713-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml up -d zkevm-bridge-service zkevm-bridge-db
714-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-bridge-db --tail 20
715-
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-bridge-service --tail 20
716-
```
633+
```

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

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,41 +52,73 @@ Generate the wallets using below command:
5252
node wallets.js | tee wallets.txt
5353
```
5454

55-
## Prepare deployment configuration
55+
## Prepare environment variables
5656

5757
1. Edit the environment variables file.
5858

59-
```bash
60-
cp .env.example .env # copies .env.example file into .env
61-
nano .env # opens .env file for editing
62-
```
59+
```bash
60+
cp .env.example .env # copies .env.example file into .env
61+
nano .env # opens .env file for editing
62+
```
6363

6464
2. Set the following variables.
6565

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
70-
```
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
70+
```
7171

7272
3. Send 0.5 GöETH to the deployment address wallet listed in `wallets.txt`.
7373

74+
## Edit deployment configuration
75+
76+
1. Open the `deploy-parameters.json` file.
77+
78+
```sh
79+
cd ~/zkevm-contracts/deployment
80+
cp deploy_parameters.json.example deploy_parameters.json
81+
nano deploy_parameters.json
82+
```
83+
84+
2. Edit the following parameters to match the generated wallet parameters.
85+
86+
- `trustedSequencer`: trusted sequencer address in `wallets.txt`.
87+
- `trustedAggregator`: trusted aggregated address in `wallets.txt`.
88+
- `admin`: deployment address in `wallets.txt`.
89+
- `zkEVMOwner`: deployment address in `wallets.txt`.
90+
- `timelockAddress`: deployment address in `wallets.txt`.
91+
- `initialZkEVMDeployer`: deployment address in `wallets.txt`.
92+
7493
## Deploy contracts
7594

76-
```sh
77-
cd ~/zkevm-contracts/
78-
npm i @openzeppelin/hardhat-upgrades
79-
npm run deploy:deployer:ZkEVM:goerli
80-
npm run verify:deployer:ZkEVM:goerli
81-
npm run deploy:testnet:ZkEVM:goerli
82-
npm run verify:ZkEVM:goerli
83-
```
95+
1. `cd` back to `zkevm-contract` root directory and run the deployment scripts.
96+
97+
```sh
98+
cd ..
99+
npm i @openzeppelin/hardhat-upgrades
100+
npm run deploy:deployer:ZkEVM:goerli
101+
npm run verify:deployer:ZkEVM:goerli
102+
npm run prepare:testnet:ZkEVM:goerli && npm run deploy:ZkEVM:test:goerli
103+
npm run verify:ZkEVM:goerli
104+
```
105+
106+
You should output that looks something like this at the start each time:
107+
108+
```sh
109+
> @0xpolygonhermez/zkevm-contracts@3.0.0 deploy:deployer:ZkEVM:goerli
110+
> npx hardhat run deployment/2_deployPolygonZKEVMDeployer.js --network goerli
111+
112+
#######################
113+
114+
polygonZkEVMDeployer deployed on: 0x8c4e69A65f84D5Ee0d83095916706Be74C133571
115+
```
84116

85-
The scripts auto-deploy the MATIC token contract and the `zkEVMDeployer` contract if required.
117+
!!! info
118+
The scripts auto-deploy the MATIC token contract and the `zkEVMDeployer` contract if required.
86119

87-
4. Check the deployment was successful on Etherscan.
120+
2. Check the deployment was successful on Etherscan.
88121

89-
```html
90-
https://goerli.etherscan.io/address/0x -> Put the Deployment Address wallet from
91-
wallets.txt
92-
```
122+
```html
123+
https://goerli.etherscan.io/address/[deployment-address] <!-- from `wallets.txt` -->
124+
```

0 commit comments

Comments
 (0)