|
28 | 28 | cd ~/cdk-validium |
29 | 29 | ``` |
30 | 30 |
|
31 | | -## 1. Downloading cdk-validium-node, cdk-data-availability, and cdk-bridge-service |
| 31 | +## Download `cdk-validium-node`, `cdk-data-availability`, and `cdk-bridge-service` |
32 | 32 |
|
33 | | -Now clone the `0.0.3` release of `cdk-validium-node`. |
| 33 | +1. Clone the `0.0.3` release of `cdk-validium-node`. |
34 | 34 |
|
35 | | -```bash |
36 | | -git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git |
37 | | -``` |
| 35 | + ```bash |
| 36 | + git clone --depth 1 --branch v0.0.3 https://github.com/0xPolygon/cdk-validium-node.git |
| 37 | + ``` |
38 | 38 |
|
39 | | -We also must download and extract version `0.0.3` of `cdk-data-availability.` The release file is available here: |
| 39 | +2. Download and extract version `0.0.3` of `cdk-data-availability` as a tar.gz file. |
40 | 40 |
|
41 | | -[Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) |
| 41 | + !!! info |
| 42 | + The release file is available here: [Untitled Database](https://www.notion.so/b329e3b1511943ae979cc2b4c73a35e8?pvs=21) |
42 | 43 |
|
43 | | -Downloading `cdk-validium-contracts` as a ***`tar.gz`*** and extracting |
| 44 | + ```bash |
| 45 | + curl -L -o cdk-data-availability.tar.gz https://github.com/0xPolygon/cdk-data-availability/archive/refs/tags/v0.0.3.tar.gz |
| 46 | + \tar -xzf cdk-data-availability.tar.gz |
| 47 | + ``` |
44 | 48 |
|
45 | | -```bash |
46 | | -~/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 |
47 | | -\tar -xzf cdk-data-availability.tar.gz |
48 | | -``` |
| 49 | +3. Finally, download the `cdk-bridge-service` release `0.3.1`. The release file can be found here: |
49 | 50 |
|
50 | | -Finally, the `cdk-bridge-service` release `0.3.1`. The release file can be found here: |
| 51 | + ```bash |
| 52 | + curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz |
| 53 | + \tar -xzf cdk-bridge-service.tar.gz |
| 54 | + ``` |
51 | 55 |
|
52 | | -```bash |
53 | | -curl -L -o cdk-bridge-service.tar.gz https://github.com/0xPolygonHermez/zkevm-bridge-service/archive/refs/tags/v0.3.1.tar.gz |
54 | | -\tar -xzf cdk-bridge-service.tar.gz |
| 56 | + You should see three new directories in `cdk-validium/`: |
55 | 57 |
|
56 | | -``` |
57 | | -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`*** |
| 58 | + - `cdk-data-availability-0.0.3` |
| 59 | + - `cdk-validium-node` |
| 60 | + - `zkevm-bridge-service-0.3.1` |
58 | 61 |
|
59 | | -## 2. Preparing the environment |
| 62 | +## Prepare the environment |
60 | 63 |
|
61 | | -We will begin our setup in the node directory. |
| 64 | +Navigate to the node directory we cloned at the previous step: `cdk-validium-node/`. |
62 | 65 |
|
63 | | -Navigate into the node directory we cloned from the previous step***`cdk-validium-node/`*** |
| 66 | + ```bash |
| 67 | + cd cdk-validium-node/ |
| 68 | + ``` |
64 | 69 |
|
65 | | -```bash |
66 | | -~/cdk-validium % cd cdk-validium-node/ |
67 | | -``` |
| 70 | +## Set up the database |
68 | 71 |
|
69 | | -### Setup the database |
| 72 | +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. |
70 | 73 |
|
71 | | -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. |
| 74 | + ```bash |
| 75 | + docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 |
| 76 | + ``` |
72 | 77 |
|
73 | | -```bash |
74 | | -docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 |
75 | | -``` |
| 78 | + !!! note "Port is in use" |
| 79 | + If you are unable to start the process because a port is in use, check the processes occupying the port then kill those processes. |
76 | 80 |
|
77 | | -*note: if you are unable to start the process because port is in use, check the processes occupying the port then kill the processes* |
| 81 | + ```bash |
| 82 | + sudo lsof -t -i:5432 |
| 83 | + kill -9 <PID> |
| 84 | + ``` |
78 | 85 |
|
79 | | -```bash |
80 | | -sudo lsof -t -i:5432 |
81 | | -kill -9 <PID> |
82 | | -``` |
| 86 | +2. Use the following command to validate the setup (`\q` to exit). |
83 | 87 |
|
84 | | -Once you have postgres running, validate you have the following setup correctly: |
| 88 | + ```bash |
| 89 | + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 |
| 90 | + #=> \q |
| 91 | + ``` |
85 | 92 |
|
86 | | -- an admin account called: `cdk_user` with a password of `cdk_password` |
87 | | -- postgres server running on `localhost:5432` |
| 93 | + You should have: |
88 | 94 |
|
89 | | -You can use the following command to validate the steps, `\q` to exit: |
| 95 | + - An admin account called: `cdk_user` with a password of `cdk_password`. |
| 96 | + - A postgres server running on `localhost:5432`. |
90 | 97 |
|
91 | | -```bash |
92 | | -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 |
93 | | -#=> \q |
94 | | -``` |
| 98 | +## Provision the database |
95 | 99 |
|
96 | | -### Provision the database |
| 100 | +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. |
97 | 101 |
|
98 | | -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: |
| 102 | +1. Run the script to provision all the necessary databases and schemas used for the prover and node: |
99 | 103 |
|
100 | | -```bash |
101 | | -~/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 |
102 | | -``` |
| 104 | + ```bash |
| 105 | + cd /cdk-validium/cdk-validium-node |
| 106 | + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -a -q -f ./db/scripts/single_db_server.sql |
| 107 | + ``` |
103 | 108 |
|
104 | | -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. |
| 109 | +2. In addition to the provisions required for the Data Availability Committee (DAC). We can set this up now to use later. |
105 | 110 |
|
106 | | -```bash |
107 | | -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" |
108 | | -``` |
| 111 | + ```bash |
| 112 | + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE committee_db;" |
| 113 | + ``` |
109 | 114 |
|
110 | | -Finally, we will provision a database for our bridge service, which we will setup last in this guide. |
| 115 | +3. Finally, provision a database for the bridge service. |
111 | 116 |
|
112 | | -```bash |
113 | | -PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" |
114 | | -``` |
| 117 | + ```bash |
| 118 | + PGPASSWORD=cdk_password psql -h localhost -U cdk_user -d postgres -p 5432 -c "CREATE DATABASE bridge_db;" |
| 119 | + ``` |
0 commit comments