Skip to content

Commit

Permalink
deploy rollup docs for cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
kmurphypolygon committed Jan 9, 2024
1 parent e5447ee commit 9aa3bd0
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 136 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

Continue with the **sixth step** of this deployment-guide where you activate forced transactions, as well as bridging and claiming assets.

## Activate forced transactions
Set up Hardhat and run the JavaScript code below to activate forced transactions.

```bash
cd ~/zkevm-contracts
Expand Down Expand Up @@ -97,5 +94,5 @@ go run main.go
```

!!!congratulations
Congratulations on reaching this far in setting up your own zkEVM 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 below in case you are looking for one.
- 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.
9 changes: 3 additions & 6 deletions docs/cdk/get-started/deploy-rollup/configure-prover.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

Continue with this deployment guide's **fifth step** where you configure the Prover and Services.

## Edit DBs

Edit `~/zkevm/mainnet/db/scripts/init_prover_db.sql` to match this:
Expand Down Expand Up @@ -28,7 +25,7 @@ GRANT ALL PRIVILEGES ON TABLE state.program TO prover_user;

Save and exit the file once the changes have been made. The above SQL script will set up your databases for the zkEVM Node.

## Configure the Prover
## Configure the prover

Create the `~/zkevm/config.json` and paste the configs below. Replace the `aggregatorClientHost` parameter with your **PUBLIC IP**:

Expand Down Expand Up @@ -131,7 +128,7 @@ vim ~/zkevm/config.json
}
```

### Configure services
## Configure services

Edit the `~/zkevm/mainnet/docker-compose.yml` file with the following content:

Expand Down Expand Up @@ -650,7 +647,7 @@ docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker
docker compose --env-file $ZKEVM_CONFIG_DIR/.env -f $ZKEVM_DIR/$ZKEVM_NET/docker-compose.yml logs -f zkevm-state-db
```

### Start the Prover (contains executor)
### Start the prover (contains executor)

```bash
export ZKEVM_NET="mainnet"
Expand Down
17 changes: 8 additions & 9 deletions docs/cdk/get-started/deploy-rollup/deploy-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ZKEVM_NODE_STATEDB_DATA_DIR = "~/zkevm/data/statedb"
ZKEVM_NODE_POOLDB_DATA_DIR = "~/zkevm/data/pooldb"
```

### Approve MATIC token for sequencer
## Approve MATIC token for sequencer

Run the below command to launch a Hardhat console connected to the Goerli network.

Expand All @@ -54,7 +54,7 @@ maticTokenContractWallet = maticTokenContract.connect(wallet);
await maticTokenContractWallet.approve("", ethers.utils.parseEther("100.0")); // From ~/zkevm-contracts/deployments/goerli_*/deploy_output.json polygonZkEVMAddress
```

### Configure genesis
## Configure genesis

Run the below commands to copy `genesis.json` file into appropriate location and open for editing:

Expand All @@ -63,7 +63,10 @@ cp ~/zkevm-contracts/deployments/goerli_*/genesis.json ~/zkevm/mainnet/config/en
vim ~/zkevm/mainnet/config/environments/testnet/public.genesis.config.json
```

Edit the file changing the following parameters from `~/zkevm/zkevm-contracts/deployments/goerli_***/deploy_output.json`. **Keep in mind that `genesisBlockNumber` is called `deploymentBlockNumber` in `deploy_output.json`**.
Edit the file changing the following parameters from `~/zkevm/zkevm-contracts/deployments/goerli_***/deploy_output.json`.

!!! important
The `genesisBlockNumber` is called `deploymentBlockNumber` in `deploy_output.json`.

```json
"l1Config" : {
Expand All @@ -76,17 +79,13 @@ Edit the file changing the following parameters from `~/zkevm/zkevm-contracts/de
# add above to head of file, leave all remaining fields intact
```

### Update node config file
## Update node config file

Edit `~/zkevm/mainnet/config/environments/testnet/public.node.config.toml` with the following values. The config file is large and we'll update the documentation in the future to list only the updated parameters.

??? "Click to expand the <code>node.config.toml</code> file"
```bash
vim ~/zkevm/mainnet/config/environments/testnet/public.node.config.toml

```
```bash
IsTrustedSequencer = true
[Log]
Environment = "development"
Expand Down Expand Up @@ -263,7 +262,7 @@ Edit `~/zkevm/mainnet/config/environments/testnet/public.node.config.toml` with
Enabled = true
```

### Add wallets
## Add wallets

Copy/paste keystore value from wallets.txt for sequencer/aggregator respectively:

Expand Down
37 changes: 17 additions & 20 deletions docs/cdk/get-started/deploy-rollup/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Welcome to your step-by-step guide to implementing a full CDK zkRollup EVM-compa

## Overview and setting up

Implementing the full stack Polygon CDK zkRollup EVM-compatible network involves more than just running an RPC zkNode or the Prover to validate batches and deploy smart contracts. In its entirety, it encompasses all these processes and more.
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.

The common rollup actors are the sequencer, the aggregator, the synchroniser and the JSON RPC node. All these affect the L2 state.

Expand All @@ -32,32 +32,29 @@ The modular design of the CDK zkRollup EVM-compatible network allows for most co

The below table enlists all the CDK zkRollup EVM-compatible components/services and their corresponding container-names.

Our CDK zkRollup EVM-compatible network deployment-guide provides CLI commands to automatically create these Docker containers.
Our CDK zkRollup deployment-guide provides CLI commands to automatically create these Docker containers.

| Component | Container | Brief\ Description |
| :---------------- | :------------------- | ------------------------------------------------------------ |
| Sequencer | zkevm-sequencer | Fetches txs from Pool DB, checks if valid, then puts valid ones into a batch. |
| Aggregator | zkevm-aggregator | Validates sequenced batches by generating verifiable Zero Knowledge proofs. |
| Sequencer | zkevm-sequencer | Fetches txs from the pool DB, checks if valid, then puts valid ones into a batch. |
| Aggregator | zkevm-aggregator | Validates sequenced batches by generating verifiable zero-knowledge proofs. |
| Synchronizer | zkevm-sync | Updates the state by fetching data from Ethereum through the Etherman. |
| JSON RPC | zkevm-rpc | An interface for interacting with the zkEVM. e.g., Metamask, Etherscan or Bridge. |
| JSON RPC | zkevm-rpc | An interface for interacting with the network. e.g., Metamask, Etherscan or Bridge. |
| State DB | zkevm-state-db | A database for permanently storing state data (apart from the Merkle tree). |
| Prover | zkevm-prover-server | Used by the Aggregator to create ZK proofs. Runs on an external cloud server. |
| Pool DB | zkevm-pool-db | Stores txs from the RPC nodes, waiting to be put in a batch by the Sequencer. |
| Prover | zkevm-prover-server | Used by the aggregator to create zk-proofs. Runs on an external cloud server. |
| Pool DB | zkevm-pool-db | Stores txs from the RPC nodes, waiting to be put in a batch by the sequencer. |
| Executor | zkevm-executor | Executes all processes. Collects results’ metadata (state root, receipts, logs) |
| Etherman | zkevm-eth-tx-manager | Implements methods for all interactions with the L1 network and smart contracts. |
| Bridge UI | zkevm-bridge-ui | User-Interface for bridging ERC-20 tokens between L2 and L1 or another L2. |
| Bridge DB | zkevm-bridge-db | A database for storing Bridge-related transactions data. |
| Bridge service | zkevm-bridge-service | A backend service enabling clients like the web UI to interact with Bridge smart contracts. |
| zkEVM explorer | zkevm-explorer-l2 | L2 network's Block explorer. i.e., The zkEVM Etherscan [Explorer](https://zkevm.polygonscan.com). |
| zkEVM explorer DB | zkevm-explorer-l2-db | Database for the L2 network's Block explorer. i.e., Where all the zkEVM Etherscan Explorer queries are made. |
| Bridge UI | zkevm-bridge-ui | User-interface for bridging ERC-20 tokens between L2 and L1 or another L2. |
| Bridge DB | zkevm-bridge-db | A database for storing bridge-related transactions data. |
| Bridge service | zkevm-bridge-service | A backend service enabling clients like the web UI to interact with bridge smart contracts. |
| zkEVM explorer | zkevm-explorer-l2 | L2 network's block explorer. i.e., The zkRollup Etherscan [rxplorer](https://zkevm.polygonscan.com). |
| 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. |
| Gas pricer | zkevm-l2gaspricer | Responsible for suggesting the gas price for the L2 network fees. |
| Goërli execution | goerli-execution | L1 node's execution layer. |
| Goërli consensus | goerli-consensus | L1 node's consensus layer. |

!!!info
The **first step** of this deployment-guide begins here!

### Preliminary setup
## Preliminary setup

Implementing the Polygon CDK zkRollup EVM-compatible network requires either a Linux machine or a virtual machine running Linux as a Guest OS.

Expand All @@ -76,7 +73,7 @@ For other operating systems (MacOS, Windows), this is achieved in 4 steps, execu

Search the internet for quick guides on creating virtual machines. Here's an example of a video on [how to create a Linux VM on a Mac](https://www.youtube.com/watch?v=KAd7FafXfJQ).

In order to run multiple Docker containers, an extra tool called **docker compose** needs to be [downloaded and installed](https://docs.docker.com/compose/install/linux/). As you will see, a YAML file is used for configuring all CDK zkRollup services.
In order to run multiple Docker containers, an extra tool called `docker compose` needs to be [downloaded and installed](https://docs.docker.com/compose/install/linux/). As you will see, a YAML file is used for configuring all CDK zkRollup services.

!!!info
One more thing, since the prover is resource-heavy, you will need to run its container externally. Access to cloud computing services such as AWS EC2 or DigitalOcean will be required.
Expand Down Expand Up @@ -105,7 +102,7 @@ If the prover is the only container you will be running externally in a cloud, t

Depending on the user's resources, the zkEVM network can be implemented with either the actual full prover or the mock prover.

The full prover is resource-intensive as it utilizes the exact same proving stack employed in the real and live zkEVM network.
The full prover is resource-intensive as it utilizes the exact same proving stack employed in the real and live CDK zkRollup network.

!!!info
The full prover's system requirements are:
Expand All @@ -123,8 +120,8 @@ The mock prover is a dummy prover which simply adds a "Valid ✅" checkmark to e

As an example, the equivalent [AWS EC2s](https://aws.amazon.com/ec2/instance-types/r6a/) for each of these two provers are as follows:

- r6a.xlarge for mock prover.
- r6a.24xlarge for full prover.
- `r6a.xlarge` for mock prover.
- `r6a.24xlarge` for full prover.

The initial free disk space requirement is minimal (<2TB), but you should monitor available space as the network is always adding more data.

Expand Down
Loading

0 comments on commit 9aa3bd0

Please sign in to comment.