diff --git a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md index cf514cda8..e57551aab 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md +++ b/docs/cdk/get-started/deploy-validium/contracts/deploy-contracts.md @@ -1,20 +1,13 @@ ## Configure deployment parameters -1. `cd` to the `deployment/` directory and create a new `deploy_parameters.json` by copying the example - - ```bash - cd deployment/ - cp deploy_parameters.json.example deploy_parameters.json - ``` - -2. Run the following `jq` script to streamline the process of replacing these fields: +1. Run the following `jq` script to streamline the process of replacing the fields with the `/tmp/cdk/.env` data: ```bash source /tmp/cdk/.env jq --arg TEST_ADDRESS "$TEST_ADDRESS" '.trustedSequencerURL = "http://127.0.0.1:8123" | .trustedSequencer = $TEST_ADDRESS | .trustedAggregator = $TEST_ADDRESS | .admin = $TEST_ADDRESS | .cdkValidiumOwner = $TEST_ADDRESS | .initialCDKValidiumDeployerOwner = $TEST_ADDRESS | .timelockAddress = $TEST_ADDRESS | .forkID = 6' ./deploy_parameters.json.example > ./deploy_parameters.json ``` -3. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`: +2. The complete `deploy_parameters.json` should look something like this, where all the addresses are equal to the generated address except for `maticTokenAddress`: ```bash nano ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_parameters.json diff --git a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md index 569b8a485..74729ad96 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md +++ b/docs/cdk/get-started/deploy-validium/contracts/prerequisites.md @@ -17,10 +17,12 @@ Make sure you have the following minimum software requirements. | [Foundry](https://book.getfoundry.sh/getting-started/installation) | ^0.2 | `forge --version` | | [jq](https://jqlang.github.io/jq/download/) | ^1.6 | `jq -V` | -## Sepolia access +## Access to a Sepolia node -!!! info - 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. +Use a node provider like Infura or Alchemy. We use Infura throughout but you can use any node provider you wish. + +!!! important + We recommend running your own Sepolia node for a production set up. You will need the following: @@ -50,17 +52,13 @@ mkdir /tmp/cdk/ !!! danger - Any files in the `tmp/` directory are deleted on shutdown. - - For this reason, we recommend that you save this folder in your home directory once the shared configuration set up is complete. + - For this reason, we recommend that you copy this folder and paste it into your home directory once the shared configuration set up is complete. That way, you can just paste it back after the `tmp` directory empties. ### Shared environment variables -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. +We will add a `.env` file to the `/tmp/cdk/` directory 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. After adding a few variables to this file in the next [set up section](set-up.md#create-the-shared-system-env-configuration), this file is populated with more environment variables during the [node set up step](../node/set-up.md) and is then accessed by the system throughout the [deploy node configuration step](../node/configure-deployment.md) and [node and services run step](../node/run-node-services.md). -```bash -nano /tmp/cdk/.env -``` - !!! danger Don't forget: The system removes this file on shutdown. diff --git a/docs/cdk/get-started/deploy-validium/contracts/set-up.md b/docs/cdk/get-started/deploy-validium/contracts/set-up.md index 0c578cbf1..48a922ee4 100644 --- a/docs/cdk/get-started/deploy-validium/contracts/set-up.md +++ b/docs/cdk/get-started/deploy-validium/contracts/set-up.md @@ -88,7 +88,7 @@ npm install ## Create the shared system `.env` configuration -1. Now open the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps. +1. Now create the *other* `.env` file residing in `/tmp/cdk/.env` which we created in the prerequisite steps. ```sh nano /tmp/cdk/.env diff --git a/docs/cdk/get-started/deploy-validium/intro.md b/docs/cdk/get-started/deploy-validium/intro.md index 60852ad62..ae9a2bd76 100644 --- a/docs/cdk/get-started/deploy-validium/intro.md +++ b/docs/cdk/get-started/deploy-validium/intro.md @@ -1,4 +1,4 @@ -This guide takes you through the process of deploying a full CDK validium, EVM-compatible network on Sepolia. +This guide takes you through the process of deploying a fully EVM-compatible, CDK validium on the Sepolia network. We have hidden most of the configuration complexity in scripts to make the process straightforward and easy to follow. diff --git a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md index 38d211835..c7d6573c6 100644 --- a/docs/cdk/get-started/deploy-validium/node/configure-deployment.md +++ b/docs/cdk/get-started/deploy-validium/node/configure-deployment.md @@ -4,7 +4,7 @@ Copy and modify the contents of `test.prover.config.json` in `~/cdk-validium/cdk ```bash cd ~/cdk-validium/cdk-validium-node -jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/postgres"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json +jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user:cdk_password@localhost:5432/prover_db"' ./test/config/test.prover.config.json > /tmp/cdk/test.prover.config.json ``` ## Configure the node @@ -218,26 +218,7 @@ jq '.aggregatorClientHost = "127.0.0.1" | .databaseURL = "postgresql://cdk_user: tomlq -i -t --arg TEST_ADDRESS "$TEST_ADDRESS" '.Aggregator.SenderAddress = $TEST_ADDRESS' /tmp/cdk/node-config.toml ``` -5. Now we will modify the `genesis.json` from the earlier contract deployment to include information about the newly configured chain. - - !!! info - `genesis.json` is in the `~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/` directory - - The values to append to `genesis.json` are something like: - - ```bash - #~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/genesis.json - "L1Config": { - "chainId": 11155111, - "maticTokenAddress": "0xd76B50509c1693C7BA35514103a0A156Ca57980c", - "polygonZkEVMAddress": "0x52C8f9808246eF2ce992c0e1f04fa54ec3378dD1", - "cdkDataCommitteeContract": "0x8346026951978bd806912d0c93FB0979D8E3436a", - "polygonZkEVMGlobalExitRootAddress": "0xE3A721c20B30213FEC306dd60f6c7F2fCB8b46D2" - }, - "genesisBlockNumber": 5098088 - ``` - -6. Run the following script that automates the process of appending those values: +5. Now we will modify the `genesis.json` from the earlier contract deployment to include information about the newly configured chain. Run the following script that automates the process of appending those values: ```bash jq --argjson data "$(jq '{maticTokenAddress, cdkValidiumAddress, cdkDataCommitteeContract, polygonZkEVMGlobalExitRootAddress, deploymentBlockNumber}' ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment/deploy_output.json)" \ @@ -255,7 +236,7 @@ At this point we should have setup and provisioned the psql database and configu Now let’s configure the Data Availability Committee. -1. Navigate to `~/cdk-validium/cdk-data-availability-0.0.3`. +1. Navigate to `~/cdk-validium/cdk-data-availability`. 2. Build the DAC diff --git a/docs/cdk/get-started/deploy-validium/node/run-node-services.md b/docs/cdk/get-started/deploy-validium/node/run-node-services.md index dcaba1008..ed730c080 100644 --- a/docs/cdk/get-started/deploy-validium/node/run-node-services.md +++ b/docs/cdk/get-started/deploy-validium/node/run-node-services.md @@ -8,6 +8,13 @@ docker run -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json ``` + !!! note "Run containers in background" + Add the `-d` flag to the command to run the container in the background. + + ```bash + docker run -d -v "/tmp/cdk/test.prover.config.json:/usr/src/app/config.json" -p 50061:50061 -p 50071:50071 --network host hermeznetwork/zkevm-prover:v3.0.2 zkProver -c /usr/src/app/config.json + ``` + !!! important The database logs may output an error while they wait for a node. For example: @@ -70,7 +77,7 @@ cd ~/cdk-validium/cdk-data-availability Open a new terminal window and run the following command. ```bash -cd ~/cdk-validium/zkevm-bridge-service +cd ~/cdk-validium/zkevm-bridge-service-0.3.1/ ./dist/zkevm-bridge run --cfg /tmp/cdk/bridge-config.toml ``` diff --git a/docs/cdk/get-started/deploy-validium/node/set-up.md b/docs/cdk/get-started/deploy-validium/node/set-up.md index c14aada3e..4ef4b7ed5 100644 --- a/docs/cdk/get-started/deploy-validium/node/set-up.md +++ b/docs/cdk/get-started/deploy-validium/node/set-up.md @@ -3,7 +3,7 @@ 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`. ```bash - cd ~/cdk-validium-contracts-0.0.2/deployment + cd ~/cdk-validium/cdk-validium-contracts-0.0.2/deployment echo "GEN_BLOCK_NUMBER=$(jq -r '.deploymentBlockNumber' deploy_output.json)" >> /tmp/cdk/.env echo "CDK_VALIDIUM_ADDRESS=$(jq -r '.cdkValidiumAddress' deploy_output.json)" >> /tmp/cdk/.env echo "POLYGON_ZKEVM_BRIDGE_ADDRESS=$(jq -r '.polygonZkEVMBridgeAddress' deploy_output.json)" >> /tmp/cdk/.env @@ -60,6 +60,13 @@ docker run -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 ``` + !!! note "Run containers in background" + Add the `-d` flag to the command to run the container in the background. + + ```bash + docker run -d -e POSTGRES_USER=cdk_user -e POSTGRES_PASSWORD=cdk_password -e POSTGRES_DB=postgres -p 5432:5432 postgres:15 + ``` + !!! note "Port is in use" If you are unable to start the process because a port is in use, check the processes occupying the port then kill those processes.