This repository contains all the necessary resources for deploying zkVerify nodes, including RPC, validator, and boot nodes.
There are three types of nodes that can be deployed:
- rpc
- validator
- boot
All scripts in this repository prompt for selection of the node type and the network to deploy.
- docker
- docker compose
- jq
- gnu-sed for Darwin distribution
OPTIONAL steps before manually starting the project after running the ./scripts/init.sh script.
Run the init.sh script and follow the instructions to prepare the deployment for the first time.
This script will generate all necessary deployment files under the deployments directory and provide the command to start the project. However, it will not start the project automatically.
./scripts/init.shTo reduce the time required for a node's startup, daily snapshots of chain data are available for:
- Mainnet: https://bootstraps.zkverify.io/
- Testnet: https://bootstraps.zkverify.io/volta
Snapshots are available in two forms:
- Node snapshot
- Archive node snapshot
Each snapshot is a .tar.gz archive containing the db directory, intended to replace the db directory generated during the initial node run.
To use a snapshot:
- Stop the running node:
./scripts/stop.sh
- Navigate to the zkVerify node's data directory. This may require
sudopermissions. For an RPC node, the path is:- For testnet:
cd /var/lib/docker/volumes/zkverify-rpc-testnet_node-data/_data/node/chains/zkv_testnet - For mainnet:
cd /var/lib/docker/volumes/zkverify-rpc_node-data/_data/node/chains/zkv_mainnet
- For testnet:
- Note the owner and permissions of the existing
dbdirectory, then delete it. - Extract the downloaded snapshot and move its
dbdirectory into the current directory. - Ensure the new
dbdirectory has the same permissions as the original db directory. - Return to the project directory and start the node:
./scripts/start.sh
- Verify the snapshot is working by checking the node's Docker logs to ensure the block height starts near its respective current chain height and continue steadily increasing.
During the initial deployment depending on the node type, if prompted, the script will generate and store ZKV_NODE_KEY and ZKV_SECRET_PHRASE values in the .env file.
Alternatively, these secrets can be injected at runtime using a custom container entrypoint script to avoid keeping them in plaintext on disk.
Use the following steps to implement this approach:
- Delete values of ZKV_NODE_KEY and ZKV_SECRET_PHRASE under the
deployments/${NODE_TYPE}/${NETWORK}/.envZKV_NODE_KEY="" ZKV_SECRET_PHRASE="" - Create entrypoint_secrets.sh file under
deployments/${NODE_TYPE}/${NETWORK}/directory. For example:#!/usr/bin/env sh set -eu # TODO: Implement logic to inject secrets into the environment # Run the application entrypoint echo "=== 🚀 Starting the application entrypoint now..." exec /app/entrypoint.sh "$@" - Modify
deployments/${NODE_TYPE}/${NETWORK}/docker-compose.ymlfile to mount and execute custom entrypoint scriptvolumes: - "node-data:/data:rw" - "./entrypoint_secrets.sh:/app/entrypoint_secrets.sh:rw" entrypoint: ["/app/entrypoint_secrets.sh"] - Start compose project using the command provided in the end of init.sh script execution.
To update the project to a new version (e.g., when a new release is available):
- Pull the latest changes from the repository.
- Run the update.sh script.
.env file, it is recommended to accept all changes, unless there is a specific reason not to.
./scripts/update.shRun the destroy.sh script to destroy the node stack and all the associated resources. The script will prompt for confirmation before removing any resources.
./scripts/destroy.sh
⚠️ Run this script ONLY if your currently running zkVerify node is on a version earlier than 0.9.0For a fresh deployment, use init.sh script instead
- Pull the latest changes from the repository.
- Run the regenesis.sh script.
./scripts/regenesis.shRun the start.sh script to start the node stack.
./scripts/start.shRun the stop.sh script to just stop the node stack.
./scripts/stop.shPlease refer to the CONTRIBUTING.md file for information on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.