Skip to content

Commit 511beda

Browse files
commit new file
1 parent 0138c21 commit 511beda

File tree

3 files changed

+127
-20
lines changed

3 files changed

+127
-20
lines changed

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
!!! important
22
- You have already followed the [deploy contracts section](../contracts/prerequisites.md).
3-
- Make sure you have at least `~0.3 Sepolia ETH` ready for deploying more contracts and various contract calls.
3+
- Make sure you have at least `~0.3 Sepolia ETH` for deploying more contracts and various contract calls.
44

55
## Software requirements
66

7-
!!! important
8-
The specified software versions are required.
9-
107
| Software | Version | Installation link |
118
| --- | --- | --- |
12-
| git | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git |
13-
| node | 16.0.0 | https://nodejs.org/en/download |
14-
| npm | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm |
15-
| golang | 1.18.0 | https://go.dev/doc/install |
16-
| cast | 0.2.0 | https://book.getfoundry.sh/getting-started/installation |
17-
| jq | 1.0 | https://jqlang.github.io/jq/download/ |
18-
| tomlq | 3.0.0 | https://kislyuk.github.io/yq/#installation |
19-
| postgres | 15 | https://www.postgresql.org/download/ |
20-
| psql | 15.0 | https://www.postgresql.org/download/ |
21-
| make | 3.80.0 | https://www.gnu.org/software/make/ |
22-
| docker | 24.0.0 | https://docs.docker.com/engine/install/ |
23-
| pip3 | 20.0.0 | https://pip.pypa.io/en/stable/installation/ |
24-
| [For Testing] python3 | 3.8.0 | https://www.python.org/downloads/ |
25-
| [For Testing] polycli | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main |
9+
| `git` | 2.18.0 | https://git-scm.com/book/en/v2/Getting-Started-Installing-Git |
10+
| `node` | 16.0.0 | https://nodejs.org/en/download |
11+
| `npm` | 6.0.0 | https://docs.npmjs.com/downloading-and-installing-node-js-and-npm |
12+
| `golang` | 1.18.0 | https://go.dev/doc/install |
13+
| `cast` | 0.2.0 | https://book.getfoundry.sh/getting-started/installation |
14+
| `jq` | 1.0 | https://jqlang.github.io/jq/download/ |
15+
| `tomlq` | 3.0.0 | https://kislyuk.github.io/yq/#installation |
16+
| `postgres` | 15 | https://www.postgresql.org/download/ |
17+
| `psql` | 15.0 | https://www.postgresql.org/download/ |
18+
| `make` | 3.80.0 | https://www.gnu.org/software/make/ |
19+
| `docker` | 24.0.0 | https://docs.docker.com/engine/install/ |
20+
| `pip3` | 20.0.0 | https://pip.pypa.io/en/stable/installation/ |
21+
| `python3` | 3.8.0 | https://www.python.org/downloads/ |
22+
| [For testing] `polycli` | 0.1.39 | https://github.com/maticnetwork/polygon-cli/tree/main |
2623

2724
1. Create a `version-check.sh` file and copy and paste the script below.
2825

@@ -86,11 +83,11 @@
8683
done
8784
```
8885

89-
2. Run the script:
86+
2. Run the script to see what you have already and what is missing from your set up.
9087

9188
```bash
9289
chmod +x version-check.sh
9390
./version-check.sh
9491
```
9592

96-
93+
3. Install any missing or out-of-date software.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
1. Navigate back to the working directory we created earlier, `~/cdk-validium`
2+
3+
```bash
4+
cd ~/cdk-validium
5+
```
6+
7+
For this setup, we will also need our information from `deploy_output.json` inside `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment`. Navigate back to `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment` and run the following script to fill the required parameters into the `/tmp/cdk/.env` we created in the previous steps:
8+
9+
```bash
10+
cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment
11+
echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env
12+
echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env
13+
echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env
14+
echo "POLYGON_ZKEVM_GLOBAL_EXIT_ROOT_ADDRESS=$(jq -r '.polygonZkEVMGlobalExitRootAddress' deploy_output.json)" >> /tmp/cdk/.env
15+
echo "CDK_DATA_COMMITTEE_CONTRACT_ADDRESS=$(jq -r '.cdkDataCommitteeContract' deploy_output.json)" >> /tmp/cdk/.env
16+
echo "MATIC_TOKEN_ADDRESS=$(jq -r '.maticTokenAddress' deploy_output.json)" >> /tmp/cdk/.env
17+
```
18+
19+
Source our new environment and navigate back to `~/cdk-validium`:
20+
21+
```bash
22+
source /tmp/cdk/.env
23+
cd ~/cdk-validium
24+
```
25+
26+
## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service
27+
28+
Now clone the `0.0.3` release of `cdk-validium-node`.
29+
30+
```bash
31+
git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git
32+
```
33+
34+
We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here:
35+
36+
[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21)
37+
38+
Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting
39+
40+
```bash
41+
~/cdk-validium % curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz
42+
\tar -xzf cdk-data-availability.tar.gz
43+
```
44+
45+
Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here:
46+
47+
```bash
48+
curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz
49+
\tar -xzf cdk-bridge-service.tar.gz
50+
51+
```
52+
Now we have three new directories in *`cdk-validium/`* named ***`cdk-data-availability-0.0.3`, `cdk-validium-node` and `zkevm-bridge-service-0.3.1`***
53+
54+
## 2. Preparing the environment
55+
56+
We will begin our setup in the node directory.
57+
58+
Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`***
59+
60+
```bash
61+
~/cdk-validium % cd cdk-validium-node/
62+
```
63+
64+
### Setup the database
65+
66+
Run the docker command 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.
67+
68+
```bash
69+
docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15
70+
```
71+
72+
*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes*
73+
74+
```bash
75+
sudo lsof -t -i:5432
76+
kill -9 <PID>
77+
```
78+
79+
Once you have postgres running, validate you have the following setup correctly:
80+
81+
- an admin account called: `cdk_user` with a password of `cdk_password`
82+
- postgres server running on `localhost:5432`
83+
84+
You can use the following command to validate the steps, `\q` to exit:
85+
86+
```bash
87+
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432
88+
#=> \q
89+
```
90+
91+
### Provision the database
92+
93+
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. Run the script to provision all the necessary databases and schemas that will be used for both the prover and node:
94+
95+
```bash
96+
~/cdk-validium/cdk-validium-node % PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql
97+
```
98+
99+
In addition to the provisions required for the prover and node, another provision is needed for the Data Availability Committee (DAC). We can set this up now for use later.
100+
101+
```bash
102+
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;"
103+
```
104+
105+
Finally, we will provision a database for our bridge service, which we will setup last in this guide.
106+
107+
```bash
108+
PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;"
109+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ nav:
5454
- Deploy contracts: cdk/get-started/deploy-validium/contracts/deploy-contracts.md
5555
- Deploy node:
5656
- Prerequisites: cdk/get-started/deploy-validium/node/prerequisites.md
57+
- Set up: cdk/get-started/deploy-validium/node/set-up.md
5758
- Deploy node: cdk/get-started/deploy-validium/node/deploy-node.md
5859
- Rollup:
5960
- Introduction: cdk/get-started/deploy-rollup/intro.md

0 commit comments

Comments
 (0)