Skip to content

Commit 1f718ac

Browse files
Merge pull request 0xPolygon#474 from BrianSeong99/zkevm/deploy-zkevm
update CDK/zkEVM: Roll up deploy tutorial from Goerli to Sepolia
2 parents bc62576 + 3729465 commit 1f718ac

File tree

5 files changed

+77
-46
lines changed

5 files changed

+77
-46
lines changed

docs/zkEVM/get-started/setup-nodes/deploy-zkevm/configure-node-deployment.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ comments: true
3838

3939
!!! warning "Workaround if you have configuration issues"
4040
- You may have to hardcode these variables into the `mainnet/docker-compose.yaml` file.
41-
- Also, the `ZKEVM_NETWORK` variable which you can set to `mainnet`.
42-
- Note, there are more than one references to hardcode in.
41+
- Also, the `ZKEVM_NETWORK` variable which you can set to `mainnet`.
42+
- Note, there is more than one reference to hardcode in.
4343

44-
## Approve MATIC token for sequencer
44+
## Approve POL token for sequencer
4545

4646
1. Launch a Hardhat console connected to the Sepolia network.
4747

@@ -56,25 +56,25 @@ comments: true
5656
const provider = ethers.getDefaultProvider("<SEPOLIA_RPC_NODE>"); // set Sepolia RPC node
5757
const privateKey = "<TRUSTED_SEQUENCER_PK>"; // from wallets.txt
5858
const wallet = new ethers.Wallet(privateKey, provider);
59-
60-
const maticTokenFactory = await ethers.getContractFactory(
59+
60+
const polTokenFactory = await ethers.getContractFactory(
6161
"ERC20PermitMock",
6262
provider
6363
);
64-
maticTokenContract = maticTokenFactory.attach("<maticTokenAddress>"); // from ~/zkevm-contracts/deployments/deploy_output.json
65-
maticTokenContractWallet = maticTokenContract.connect(wallet);
66-
await maticTokenContractWallet.approve("<polygonZkEVMAddress>", ethers.utils.parseEther("100.0")); // from ~/zkevm-contracts/deployments/deploy_output.json
64+
polTokenContract = polTokenFactory.attach("<polTokenAddress>"); // from ~/zkevm-contracts/deployments/deploy_output.json
65+
polTokenContractWallet = polTokenContract.connect(wallet);
66+
await polTokenContractWallet.approve("<polygonZkEVMAddress>", ethers.parseEther("100.0")); // from ~/zkevm-contracts/deployments/deploy_output.json
6767
```
6868

6969
## Configure genesis
7070

7171
1. Copy the `genesis.json` file into the appropriate location.
7272

7373
```sh
74-
cp ~/zkevm-contracts/deployment/genesis.json ~/zkevm/mainnet/config/environments/mainnet/public.genesis.config.json
74+
cp ~/zkevm-contracts/deployment/v2/genesis.json ~/zkevm/mainnet/config/environments/mainnet/public.genesis.config.json
7575
```
7676

77-
2. Copy/paste the json below to the head of the `public.genesis.config.json` file inputting the data from `~/zkevm/zkevm-contracts/deployments/deploy_output.json`.
77+
2. Copy/paste the json below to the head of the `public.genesis.config.json` file inputting the data from `~/zkevm-contracts/deployments/v2/deploy_output.json`.
7878

7979
!!! important
8080
The `genesisBlockNumber` is called `deploymentBlockNumber` in `deploy_output.json`.
@@ -83,7 +83,7 @@ comments: true
8383
"l1Config" : {
8484
"chainId": 5,
8585
"polygonZkEVMAddress": "",
86-
"maticTokenAddress": "",
86+
"polTokenAddress": "",
8787
"polygonZkEVMGlobalExitRootAddress": ""
8888
},
8989
"genesisBlockNumber": <number-here>,

docs/zkEVM/get-started/setup-nodes/deploy-zkevm/create-wallets.md

Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Clone the wallet contracts from the [`zkevm-contracts` repository](https://githu
88

99
```sh
1010
git clone https://github.com/0xPolygonHermez/zkevm-contracts.git
11-
cd ~/zkevm-contracts
11+
cd zkevm-contracts
1212
npm i
1313
```
1414

@@ -17,7 +17,7 @@ npm i
1717
1. Create a `wallets.js` file.
1818

1919
```sh
20-
cd ~/zkevm-contracts
20+
cd zkevm-contracts
2121
nano wallets.js
2222
```
2323

@@ -36,8 +36,8 @@ npm i
3636
const wallet = ethers.Wallet.createRandom();
3737
console.log(arrayNames[i]);
3838
console.log(`Address: ${wallet.address}`);
39-
console.log(`PrvKey: ${wallet._signingKey().privateKey}`);
40-
console.log(`mnemonic: "${wallet._mnemonic().phrase}"`);
39+
console.log(`PrvKey: ${wallet.privateKey}`);
40+
console.log(`mnemonic: "${wallet.mnemonic.phrase}"`);
4141
4242
const keystoreJson = await wallet.encrypt("password");
4343
console.log(`keystore: ${keystoreJson}`);
@@ -73,14 +73,14 @@ npm i
7373
ETHERSCAN_API_KEY="..." # your Etherscan API key
7474
```
7575
76-
3. Send 0.5 Sepolia ETH to the deployment address wallet listed in `wallets.txt`.
76+
3. Send 1 Sepolia ETH to the deployment address wallet listed in `wallets.txt`.
7777
7878
## Edit deployment configuration
7979
8080
1. Open the `deploy-parameters.json` file.
8181
8282
```sh
83-
cd ~/zkevm-contracts/deployment
83+
cd zkevm-contracts/deployment/v2
8484
cp deploy_parameters.json.example deploy_parameters.json
8585
nano deploy_parameters.json
8686
```
@@ -94,39 +94,70 @@ npm i
9494
- `timelockAddress`: deployment address in `wallets.txt`.
9595
- `initialZkEVMDeployerAddress`: deployment address in `wallets.txt`.
9696
- `zkEVMDeployerAddress`: deployment address in `wallets.txt`.
97+
- `emergencyCouncilAddress`: deployment address in `wallets.txt`.
98+
- `deployerPvtKey`: deployment private key in `wallets.txt`.
9799
98-
## Deploy contracts
100+
3. Open the `create_rollup_parameters.json` file.
99101
100-
1. `cd` back to `zkevm-contract` root directory and run the deployment scripts.
102+
```bash
103+
cd zkevm-contracts/deployment/v2
104+
cp create_rollup_parameters.json.example create_rollup_parameters.json
105+
vim create_rollup_parameters.json
106+
```
101107
102-
!!! tip
103-
It might be helpful to run these one at a time.
108+
4. Edit the following parameters to match the rollup parameters
109+
- `trustedSequencer`: trusted sequencer address in `wallets.txt`.
110+
- `adminZkEVM`: deployment address in `wallets.txt`.
111+
## Deploy & verify contracts
104112
105-
```sh
106-
cd ..
107-
npm i @openzeppelin/hardhat-upgrades
108-
npm run deploy:deployer:ZkEVM:sepolia
109-
npm run verify:deployer:ZkEVM:sepolia
110-
npm run prepare:testnet:ZkEVM:sepolia && npm run deploy:ZkEVM:test:sepolia
111-
npm run verify:ZkEVM:sepolia
112-
```
113+
`cd` back to `zkevm-contract` root directory and run the deployment scripts.
113114
114-
You should see output that looks something like this at the start each time:
115+
1. Install Hardhat:
115116
116-
```sh
117-
> @0xpolygonhermez/zkevm-contracts@3.0.0 deploy:deployer:ZkEVM:sepolia
118-
> npx hardhat run deployment/2_deployPolygonZKEVMDeployer.js --network sepolia
117+
```
118+
cd ..
119+
npm i @openzeppelin/hardhat-upgrades
120+
```
119121
120-
#######################
122+
2. Deploy Polygon zkEVM deployer
121123
122-
polygonZkEVMDeployer deployed on: 0x8c4e69A65f84D5Ee0d83095916706Be74C133571
123-
```
124+
```bash
125+
npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network sepolia
126+
```
127+
128+
You should see output that looks like this:
129+
130+
```bash
131+
#######################
132+
133+
polygonZkEVMDeployer deployed on: 0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983
134+
```
135+
136+
3. Verify deployer
137+
138+
```bash
139+
npx hardhat run deployment/v2/verifyzkEVMDeployer.js --network sepolia
140+
```
141+
142+
You should see ouput that looks like this:
143+
144+
```bash
145+
The contract 0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983 has already been verified.
146+
https://sepolia.etherscan.io/address/0xB1A5BA61fBAD71Ba52d70B769d6A994c01b40983#code
147+
```
148+
149+
4. Prepare testnet
150+
151+
```bash
152+
npx hardhat run deployment/testnet/prepareTestnet.ts --network sepolia
153+
```
124154
125-
!!! info
126-
The scripts auto-deploy the MATIC token contract and the `zkEVMDeployer` contract if required.
155+
You should see output that looks like this:
127156
128-
2. Check the deployment was successful on Etherscan.
157+
```bash
158+
#######################
159+
160+
pol deployed to: 0x2B2Ef864542EA38657221393B0A18215e5c3fc7e
161+
```
129162
130-
```html
131-
https://sepolia.etherscan.io/address/[deployment-address] <!-- from `wallets.txt` -->
132-
```
163+
And now if you go to sepolia scan, you should also see that under your account, there's a new `Pol` Erc-20 token created with the balance of `19,900,000` tokens.

docs/zkEVM/get-started/setup-nodes/deploy-zkevm/install-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ newgrp docker && newgrp $USER
2626
```sh
2727
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
2828
source ~/.bashrc
29-
nvm install 16
29+
nvm install 18
3030
node -v
3131
```
3232

docs/zkEVM/get-started/setup-nodes/deploy-zkevm/prerequisites.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ The commands on the [install dependencies page](install-dependencies.md) fulfill
3131

3232
- `INFURA_API_KEY`: [Infura](https://infura.io/) API key
3333
- `ETHERSCAN_API_KEY`: [Etherscan](https://etherscan.io/) API key
34-
- Goërli node RPC URL: e.g. https://goerli.infura.io/v3/YOUR-INFURA-API-KEY
35-
- Goërli account address holding minimum 0.5 GoërliETH
34+
- Sepolia node RPC URL: e.g. https://sepolia.infura.io/v3/YOUR-INFURA-API-KEY
35+
- Sepolia account address holding minimum 0.5 SepoliaETH

docs/zkEVM/get-started/setup-nodes/deploy-zkevm/start-node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ comments: true
77
From the `zkevm` root directory, run the following:
88

99
```sh
10-
docker-compose -f mainnet/docker-compose.yml up
10+
sudo docker-compose -f mainnet/docker-compose.yml up
1111
```
1212

1313
This command spins up the following services:

0 commit comments

Comments
 (0)