|
| 1 | +Set up Hardhat and run the JavaScript code below to activate forced transactions. |
| 2 | + |
| 3 | +```bash |
| 4 | +cd ~/zkevm-contracts |
| 5 | +npx hardhat console --network goerli |
| 6 | +``` |
| 7 | + |
| 8 | +```js |
| 9 | +const zkevm = await ethers.getContractFactory("PolygonZkEVM"); |
| 10 | +const zkevmContract = zkevm.attach("_polygonZkEVMAddress_"); // From ~/zkevm-contracts/deployments/goerli_*/deploy_output.json polygonZkEVMAddress |
| 11 | + |
| 12 | +const provider = ethers.getDefaultProvider(""); // set Geth Goerli RPC endpoint |
| 13 | +const privateKey = ""; // Deployment Address prvkey from wallet.txt |
| 14 | +const wallet = new ethers.Wallet(privateKey, provider); |
| 15 | + |
| 16 | +const zkevmContractWallet = zkevm.connect(wallet); |
| 17 | + |
| 18 | +await zkevmContract.activateForceBatches(); |
| 19 | +``` |
| 20 | + |
| 21 | +## Provide L1 ETH to the bridge |
| 22 | + |
| 23 | +Run the below commands in CLI to **create a bridge transaction** and send L1 Ether to the zkEVM Bridge. |
| 24 | + |
| 25 | +```bash |
| 26 | +mkdir -p ~/zkevm/initial-bridge |
| 27 | +cd zkevm/initial-bridge |
| 28 | + |
| 29 | +wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-bridge-service/develop/test/scripts/deposit/main.go |
| 30 | +vim main.go |
| 31 | +``` |
| 32 | + |
| 33 | +Populate the `main.go` file with following variables: |
| 34 | + |
| 35 | +```go |
| 36 | +l1BridgeAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMBridgeAddress |
| 37 | + |
| 38 | +l1AccHexAddress = "" // ~/zkevm-contracts/wallets.txt: sequencer address |
| 39 | +l1AccHexPrivateKey = "" // ~/zkevm-contracts/wallets.txt: sequencer prvkey |
| 40 | +l1NetworkURL = "http://X.X.X.X:8545" // set your public IP |
| 41 | +``` |
| 42 | + |
| 43 | +Initialize a new Go module with the module path `example.com/deposit`. |
| 44 | + |
| 45 | +```bash |
| 46 | +go mod init example.com/deposit |
| 47 | +go mod tidy |
| 48 | +go run main.go |
| 49 | + |
| 50 | +# 2023-06-07T06:29:14.211Z INFO initial-bridge/main.go:46 Success! {"pid": 776268, "version": "v0.1.0"} |
| 51 | +``` |
| 52 | + |
| 53 | +## Claim your L2 zkETH |
| 54 | + |
| 55 | +After sending your first bridge transaction to your zkEVM network, create a **forced claim to get the zkETH in L2**. |
| 56 | + |
| 57 | +```bash |
| 58 | +mkdir -p ~/zkevm/initial-claim |
| 59 | +cd ~/zkevm/initial-claim |
| 60 | + |
| 61 | +wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-bridge-service/develop/test/scripts/initialClaim/main.go |
| 62 | +vim main.go |
| 63 | +``` |
| 64 | + |
| 65 | +Open `main.go` and update the following parameters: |
| 66 | + |
| 67 | +```go |
| 68 | +const ( |
| 69 | + l2BridgeAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMBridgeAddress |
| 70 | + zkevmAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMAddress |
| 71 | + |
| 72 | + accHexAddress = "" // ~/zkevm-contracts/wallets.txt: sequencer address |
| 73 | + accHexPrivateKey = "" // ~/zkevm-contracts/wallets.txt: sequencer prvkey |
| 74 | + l1NetworkURL = "http://X.X.X.X:8545" // public IP |
| 75 | + l2NetworkURL = "http://X.X.X.X:8123" // public IP |
| 76 | + bridgeURL = "http://X.X.X.X:8080" // public IP |
| 77 | + |
| 78 | + l2GasLimit = 1000000 |
| 79 | + |
| 80 | + mtHeight = 32 |
| 81 | + miningTimeout = 180 |
| 82 | +) |
| 83 | +``` |
| 84 | + |
| 85 | +Time to execute the claim transaction: |
| 86 | + |
| 87 | +```bash |
| 88 | +go mod init example.com/claim |
| 89 | +go mod tidy |
| 90 | +go get github.com/0xPolygonHermez/zkevm-bridge-service@4e1ca558144cac00fe0762329aaf7b3e9482b57a |
| 91 | +go run main.go |
| 92 | + |
| 93 | +# 2023-06-07T06:41:50.731Z INFO initial-claim/main.go:196 Success!!!! {"pid": 783804, "version": "v0.1.0"} |
| 94 | +``` |
| 95 | + |
| 96 | +!!!congratulations |
| 97 | + - Congratulations on reaching this far in setting up your own CDK zkRollup EVM-compatible network network. |
| 98 | + - Your network is live on the testnet and you can send transactions to verify the same. Also, we have provided a Goerli full node setup guide next in case you are looking for one. |
0 commit comments