Skip to content

Commit 83926d9

Browse files
authored
Merge pull request 0xPolygon#223 from 0xPolygon/km/update-validium-deploy
Updating CDK validium deploy flow after review
2 parents bc7d10f + 23b25bc commit 83926d9

File tree

11 files changed

+107
-67
lines changed

11 files changed

+107
-67
lines changed

docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,8 @@ sepolia: {
160160
count: 20,
161161
},
162162
},
163-
```
163+
```
164+
165+
## Steps to run the node and services
166+
167+
You are now ready to begin the [CDK validum node and services deployment steps](../node/prerequisites.md).
Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
## Hardware
22

3+
Make sure you have the following minimum hardware requirements.
4+
35
- A Linux-based OS (e.g., Ubuntu Server 22.04 LTS).
46
- At least 8GB RAM with a 2-core CPU.
57
- An AMD64 architecture system.
68

79
## Software
810

9-
Make sure you have the following software:
11+
Make sure you have the following minimum software requirements.
1012

11-
| Download link | Version | Check version |
13+
| Download link | Version | Check version |
1214
| --- | --- | --- |
1315
| [Node](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) | ^20 | `node --version` |
1416
| npm | ^10 | `npm --version` |
@@ -17,10 +19,13 @@ Make sure you have the following software:
1719

1820
## Sepolia access
1921

22+
!!! info
23+
You can run your own Sepolia node if you wish and we recommend this for a production set up. However, for simplicity and brevity, we demonstrate by using a node provider.
24+
2025
You will need the following:
2126

22-
- A Sepolia node RPC URL: e.g. https://sepolia.infura.io/v3/YOUR-INFURA-API-KEY
23-
- An account holding minimum 2 Sepolia ETH that you can send to a generated address within CDK.
27+
- A Sepolia node RPC URL: e.g. https://sepolia.infura.io/v3/YOUR-INFURA-API-KEY.
28+
- An account holding a minimum of 2 Sepolia ETH that you must send to a generated address to make for contract calls.
2429

2530
### Faucets
2631

@@ -32,19 +37,31 @@ Use a public faucet to get Sepolia test ETH.
3237

3338
## Configuration files
3439

35-
Create a folder `/tmp/cdk/` to store configuration files.
40+
!!! warning
41+
We will be working with two separate `.env` files.
42+
43+
- One `.env` file resides in the contracts project directory. We will set this up in the [contract set up](set-up.md#create-the-env-configuration) section.
44+
- Another `.env` resides in a shared system directory so that it is accessible to the node and all running processes. We will populate this file as we go along.
45+
46+
Create a folder `/tmp/cdk/` to store the shared `.env` file which will be used by all running processes.
3647

3748
```bash
3849
mkdir /tmp/cdk/
3950
```
4051

41-
## Environment variables
52+
!!! danger
53+
- Any files in the `tmp/` directory are deleted on shutdown.
54+
- For this reason, we recommend that you save this folder in your home directory once the shared configuration set up is complete.
55+
56+
### Shared environment variables
57+
58+
Create a `.env` file to store the environment variables that all running processes will share. This shared `.env` file allows us to use `jq` and `tomlq` to easily setup the configuration for the node and running processes.
4259

43-
Create a `.env` file to store environment variables we will use later on.
60+
This file will be populated throughout the [deploy node](../node/prerequisites.md) instructions.
4461

4562
```bash
4663
nano /tmp/cdk/.env
4764
```
4865

4966
!!! danger
50-
The system removes this file on shutdown.
67+
Don't forget, the system removes this file on shutdown.

docs/cdk/get-started/deploy-validium/contracts/set-up.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
2. Download the `0.0.2` release from the [cdk-validium-contracts github repo](https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2-RC1).
1212

13-
!!! note
14-
The download is available in both `.tar.gz` and `.zip` formats.
15-
1613
```bash
1714
curl -L -o cdk-validium-contracts.tar.gz https://github.com/0xPolygon/cdk-validium-contracts/archive/refs/tags/v0.0.2.tar.gz
1815
```
16+
!!! note
17+
The download is available in both `.tar.gz` and `.zip` formats.
1918

2019
3. Extract the files and cd into the repo.
2120

@@ -32,7 +31,7 @@ npm install
3231

3332
## Create the .env configuration
3433

35-
1. Copy the environment configuration example file into a new `.env` file.
34+
1. Copy the contract environment configuration example file into a new `.env` file.
3635

3736
```bash
3837
cp .env.example .env
@@ -68,19 +67,17 @@ npm install
6867
```
6968

7069
!!! info
71-
Check our documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider).
70+
Check the documentation if you want to [use a different node provider](deploy-contracts.md#use-a-different-node-provider).
7271

7372
4. Send 2 Sepolia ETH to the generated address.
7473

75-
5. Add the following variables to `/var/tmp/cdk/.env`.
74+
5. Add the following variables to the *other* `.env` file residing in `/tmp/cdk/.env`.
7675

7776
```bash
7877
nano /tmp/cdk/.env
79-
TEST_ADDRESS="<the address generated by cast>"
80-
TEST_PRIVATE_KEY="<the private key generated by cast>"
78+
TEST_ADDRESS="<the address generated by cast above>"
79+
TEST_PRIVATE_KEY="<the private key generated by cast above>"
8180
L1_URL="https://sepolia.infura.io/v3/<YOUR INFURA PROJECT ID>"
8281
L1_WS_URL="wss://sepolia.infura.io/ws/v3/<YOUR INFURA PROJECT ID>"
8382
```
84-
!!! important
85-
This step allows us to use `jq` and `tomlq` later on to setup our configuration files.
8683

docs/cdk/get-started/deploy-validium/index.md

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This guide takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia.
2+
3+
We have hidden most of the configuration complexity in scripts to make the process straightforward and easy to follow.
4+
5+
## Process steps
6+
7+
The process requires two separate flows with different software requirements. For this reason, we have separated the instructions into two distinct sections.
8+
9+
1. [Deploying the contracts](contracts/prerequisites.md): The node and services require a bunch of [deployed contracts](https://github.com/0xPolygon/cdk-validium-contracts) so we complete this step first.
10+
2. [Deploying the node and services](node/prerequisites.md): Once the contracts are deployed, we can run the [validium node](https://github.com/0xPolygon/cdk-validium-node), [mock prover](https://github.com/0xPolygonHermez/zkevm-prover), [data availability layer](https://github.com/0xPolygon/cdk-data-availability), and [zkEVM bridge service](https://github.com/0xPolygonHermez/zkevm-bridge-service).
11+
12+
!!! warning
13+
- The instructions are subject to frequent updates as the software remains at an early development stage.
14+
- Report any technical issue on the relevant [repo](#git-repos-and-running-order).
15+
- Report any content issues on our docs repo: https://github.com/0xPolygon/polygon-docs.
16+
17+
## Git repos and running order
18+
19+
These are code bases we used to set everything up for this deployment guide, and in this order.
20+
21+
!!! warning
22+
The versions below may not be the most recent.
23+
24+
| Repo | Version |
25+
| --- | --- |
26+
| https://github.com/0xPolygon/cdk-validium-contracts/releases/tag/v0.0.2 | v0.0.2 |
27+
| https://github.com/0xPolygon/cdk-validium-node/releases/tag/v0.0.3 | v0.0.3 |
28+
| https://github.com/0xPolygonHermez/zkevm-prover | v3.0.2 |
29+
| https://github.com/0xPolygon/cdk-data-availability | v0.0.3 |
30+
| https://github.com/0xPolygonHermez/zkevm-bridge-service | v0.3.1 |
31+
32+
## Instructions for deploying contracts
33+
34+
You are now ready to follow the [pre-requisite steps](contracts/prerequisites.md) for setting up the contracts.

docs/cdk/get-started/deploy-validium/node/configure-deployment.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,17 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:
225225

226226
The values to append to `genesis.json` are something like:
227227

228-
```bash
229-
#~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json
230-
"L1Config": {
231-
"chainId": 11155111,
232-
"maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c",
233-
"polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1",
234-
"cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a",
235-
"polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2"
236-
},
237-
"genesisBlockNumber": 5098088
238-
```
228+
```bash
229+
#~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json
230+
"L1Config": {
231+
"chainId": 11155111,
232+
"maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c",
233+
"polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1",
234+
"cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a",
235+
"polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2"
236+
},
237+
"genesisBlockNumber": 5098088
238+
```
239239

240240
6. Run the following script that automates the process of appending those values:
241241

@@ -249,6 +249,10 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:
249249
.genesisBlockNumber = $data.deploymentBlockNumber' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json > /tmp/cdk/genesis.json
250250
```
251251

252+
You should see something like this:
253+
254+
![DAC configuration output](../../../../img/cdk/dac-output.png)
255+
252256
## Configure the DAC
253257

254258
At this point we should have setup and provisioned the psql database and configured the zk prover and node.

docs/cdk/get-started/deploy-validium/node/prerequisites.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@
9393
./version-check.sh
9494
```
9595

96-
3. Install any missing or out-of-date software.
96+
3. Install any missing or out-of-date software using the links provided above.

docs/cdk/get-started/deploy-validium/node/run-node-services.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
!!! warning
2+
- Use a separate terminal window to run the node and each service separately.
3+
- Whenever you need to restart the process, make sure you stop and delete all running Docker containers and images.
4+
15
## Run the prover
26

37
Since the prover is large and compute-expensive to build, we will use a docker container.
@@ -57,4 +61,8 @@ cd ~/cdk-validium/cdk-data-availability-0.0.3
5761
```bash
5862
cd ~/cdk-validium/zkevm-bridge-service
5963
./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml
60-
```
64+
```
65+
66+
## Congratulations
67+
68+
You have now set up and deployed a full CDK validium network.

docs/cdk/get-started/deploy-validium/node/set-up.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1. Navigate to `cdk-validium-contracts-0.0.2/deployment` and run the following script that inputs the required parameters from `deploy_output.json` into `/tmp/cdk/.env`.
44

55
```bash
6-
cd cdk-validium-contracts-0.0.2/deployment
6+
cd ~/cdk-validium-contracts-0.0.2/deployment
77
echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env
88
echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env
99
echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env
@@ -46,17 +46,15 @@
4646
- `cdk-validium-node`
4747
- `zkevm-bridge-service-0.3.1`
4848

49-
## Prepare the environment
50-
51-
Navigate to the node directory we cloned at the previous step: `cdk-validium-node/`.
49+
## Set up the database
5250

53-
```bash
54-
cd cdk-validium-node/
55-
```
51+
1. Navigate to the node directory we cloned at the previous step: `cdk-validium-node/`.
5652

57-
## Set up the database
53+
```bash
54+
cd cdk-validium-node/
55+
```
5856

59-
1. Run the docker command below to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service.
57+
2. Run the docker command below to start an instance of the `psql` database. The database is used for many of the services, such as the node, prover, DAC, and bridge service.
6058

6159
```bash
6260
docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15
@@ -70,7 +68,7 @@ cd cdk-validium-node/
7068
kill -9 <PID>
7169
```
7270

73-
2. Use the following command to validate the setup (`\q` to exit).
71+
3. Use the following command to validate the setup (`\q` to exit).
7472

7573
```bash
7674
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432
@@ -85,10 +83,10 @@ cd cdk-validium-node/
8583

8684
The `cdk-validium-node` directory contains a script called `single_db_server.sql` that provisions all the databases required for the prover, state, and pool to operate.
8785

88-
1. Run the script to provision all the necessary databases and schemas used for the prover and node:
86+
1. In a new terminal window, run the script to provision all the necessary databases and schemas used for the prover and node:
8987

9088
```bash
91-
cd /cdk-validium/cdk-validium-node
89+
cd cdk-validium/cdk-validium-node
9290
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql
9391
```
9492

docs/img/cdk/dac-output.png

203 KB
Loading

0 commit comments

Comments
 (0)