-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from 0xPolygon/km/cdk-deploy-rollup
CDK docs deploy rollup
- Loading branch information
Showing
9 changed files
with
1,612 additions
and
11 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
98 changes: 98 additions & 0 deletions
98
docs/cdk/get-started/deploy-rollup/activate-forced-transactions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
Set up Hardhat and run the JavaScript code below to activate forced transactions. | ||
|
||
```bash | ||
cd ~/zkevm-contracts | ||
npx hardhat console --network goerli | ||
``` | ||
|
||
```js | ||
const zkevm = await ethers.getContractFactory("PolygonZkEVM"); | ||
const zkevmContract = zkevm.attach("_polygonZkEVMAddress_"); // From ~/zkevm-contracts/deployments/goerli_*/deploy_output.json polygonZkEVMAddress | ||
|
||
const provider = ethers.getDefaultProvider(""); // set Geth Goerli RPC endpoint | ||
const privateKey = ""; // Deployment Address prvkey from wallet.txt | ||
const wallet = new ethers.Wallet(privateKey, provider); | ||
|
||
const zkevmContractWallet = zkevm.connect(wallet); | ||
|
||
await zkevmContract.activateForceBatches(); | ||
``` | ||
|
||
## Provide L1 ETH to the bridge | ||
|
||
Run the below commands in CLI to **create a bridge transaction** and send L1 Ether to the zkEVM Bridge. | ||
|
||
```bash | ||
mkdir -p ~/zkevm/initial-bridge | ||
cd zkevm/initial-bridge | ||
|
||
wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-bridge-service/develop/test/scripts/deposit/main.go | ||
vim main.go | ||
``` | ||
|
||
Populate the `main.go` file with following variables: | ||
|
||
```go | ||
l1BridgeAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMBridgeAddress | ||
|
||
l1AccHexAddress = "" // ~/zkevm-contracts/wallets.txt: sequencer address | ||
l1AccHexPrivateKey = "" // ~/zkevm-contracts/wallets.txt: sequencer prvkey | ||
l1NetworkURL = "http://X.X.X.X:8545" // set your public IP | ||
``` | ||
|
||
Initialize a new Go module with the module path `example.com/deposit`. | ||
|
||
```bash | ||
go mod init example.com/deposit | ||
go mod tidy | ||
go run main.go | ||
|
||
# 2023-06-07T06:29:14.211Z INFO initial-bridge/main.go:46 Success! {"pid": 776268, "version": "v0.1.0"} | ||
``` | ||
|
||
## Claim your L2 zkETH | ||
|
||
After sending your first bridge transaction to your zkEVM network, create a **forced claim to get the zkETH in L2**. | ||
|
||
```bash | ||
mkdir -p ~/zkevm/initial-claim | ||
cd ~/zkevm/initial-claim | ||
|
||
wget https://raw.githubusercontent.com/0xPolygonHermez/zkevm-bridge-service/develop/test/scripts/initialClaim/main.go | ||
vim main.go | ||
``` | ||
|
||
Open `main.go` and update the following parameters: | ||
|
||
```go | ||
const ( | ||
l2BridgeAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMBridgeAddress | ||
zkevmAddr = "" // ~/zkevm-contracts/deployments/goerli_*/deploy_output.json: polygonZkEVMAddress | ||
|
||
accHexAddress = "" // ~/zkevm-contracts/wallets.txt: sequencer address | ||
accHexPrivateKey = "" // ~/zkevm-contracts/wallets.txt: sequencer prvkey | ||
l1NetworkURL = "http://X.X.X.X:8545" // public IP | ||
l2NetworkURL = "http://X.X.X.X:8123" // public IP | ||
bridgeURL = "http://X.X.X.X:8080" // public IP | ||
|
||
l2GasLimit = 1000000 | ||
|
||
mtHeight = 32 | ||
miningTimeout = 180 | ||
) | ||
``` | ||
|
||
Time to execute the claim transaction: | ||
|
||
```bash | ||
go mod init example.com/claim | ||
go mod tidy | ||
go get github.com/0xPolygonHermez/zkevm-bridge-service@4e1ca558144cac00fe0762329aaf7b3e9482b57a | ||
go run main.go | ||
|
||
# 2023-06-07T06:41:50.731Z INFO initial-claim/main.go:196 Success!!!! {"pid": 783804, "version": "v0.1.0"} | ||
``` | ||
|
||
!!!congratulations | ||
- Congratulations on reaching this far in setting up your own CDK zkRollup EVM-compatible network network. | ||
- 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. |
Oops, something went wrong.