Deploy a rpc only node
Deployment Overview
Current Testnet and Mainnet version: fork9.
Recommended configuration for mainnet, can appropriately downgrade for testnet.
For mainnet: Ensure Docker's home directory is set to the maximum available disk space and configure disk usage alerts.
For mainnet: Choose the Singapore region as the deployment location for your synchronization nodes.
Please ensure that time synchronization is enabled and set to UTC+0 on all deployment-related servers.
Database
Sync Server
state-db, prover-db
sync, prover
CPU: 64VCORE, >= 3050MHZ
RAM: 128G
DISK: 2000GB, NVMe SSD
Synchronize the L2 state from master node and L1, only one can run at a time.
RPC Server(s)
json-rpc, prover
CPU: 64VCORE, >= 3050MHZ
RAM: 128G
DISK: 2000GB, NVMe SSD
Provide access entry for external requests, can run multiple instances.
Deployment Steps
Prepare configuration files
docker-compose.yml
If you have modified the default configuration of the database container [merlin-state-db], please synchronize this configuration with [StateDB] in node.config.toml and databaseURL in prover.config.json.
version: "3.5"
networks:
default:
name: merlin-rpc-network
services:
cdk-validium-state-db:
container_name: merlin-state-db
restart: unless-stopped
image: postgres:15
cpu_shares: 4096
ports:
- 5432:5432
environment:
- POSTGRES_USER=state_user
- POSTGRES_PASSWORD=state_password
- POSTGRES_DB=state_db
volumes:
- ./init_prover_db.sql:/docker-entrypoint-initdb.d/init.sql
- /data/merlin/data/statedb:/var/lib/postgresql/data
command:
- "postgres"
- "-N"
- "500"
- "-c"
- "max_connections=20000"
- "-c"
- "shared_buffers=16GB"
- "-c"
- "work_mem=32MB"
- "-c"
- "wal_buffers=8MB"
- "-c"
- "effective_cache_size=16GB"
- "-c"
- "maintenance_work_mem=128MB"
- "-c"
- "checkpoint_completion_target=0.7"
- "-c"
- "max_wal_size=4GB"
- "-c"
- "min_wal_size=200MB"
- "-c"
- "max_worker_processes=16"
cdk-validium-pool-db:
container_name: merlin-pool-db
restart: unless-stopped
image: postgres:15
cpu_shares: 4096
ports:
- 5433:5432
environment:
- POSTGRES_USER=pool_user
- POSTGRES_PASSWORD=pool_password
- POSTGRES_DB=pool_db
volumes:
- /data/merlin/data/pooldb:/var/lib/postgresql/data
command:
- "postgres"
- "-N"
- "500"
- "-c"
- "max_connections=10000"
cdk-validium-prover:
container_name: merlin-prover
image: hermeznetwork/zkevm-prover:v6.0.2
restart: unless-stopped
logging:
options:
max-size: '500m'
max-file: '3'
ports:
- 50061:50061 # MT
- 50071:50071 # Executor
volumes:
- ./prover.config.json:/usr/src/app/config.json
command: >
zkProver -c /usr/src/app/config.json
cdk-validium-sync:
container_name: merlin-sync
image: merlinadmin/zkevm-node:v3.1.0
restart: unless-stopped
logging:
options:
max-size: '500m'
max-file: '3'
ports:
- 9091:9091
volumes:
- ./node.config.toml:/app/config.toml
- ./genesis.json:/app/genesis.json
command:
- "/bin/sh"
- "-c"
- "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components synchronizer"
cdk-validium-json-rpc:
container_name: merlin-rpc
image: merlinadmin/zkevm-node:v3.1.0
restart: unless-stopped
logging:
options:
max-size: '500m'
max-file: '5'
ports:
- 8123:8123
- 8133:8133 # needed if WebSockets enabled
- 9092:9091 # needed if metrics enabled
volumes:
- ./node.config.toml:/app/config.toml
- ./genesis.json:/app/genesis.json
command:
- "/bin/sh"
- "-c"
- "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components rpc --http.api eth,net,debug,zkevm,txpool,web3" #with debug mode. delete "--http.api eth,net,debug,zkevm,txpool,web3" will remove debug endpoint.init_prover_db.sql
node.config.toml
Update [StateDB] if you use a customized database configuration.
prover.config.json
Update databaseURL if you use a customized database configuration.
genesis.json
testnet
mainnet
Launch database
Database Server
Snapshot Recovery
Install postgresql-client-15
Download recovery database snapshot
Prepare recovery script
Prepare recovery configuration
Execute recovery
Add extra index for state db
Launch other containers
Sync Server
RPC Server
Installation Verification
On the RPC host, execute the following command:
The expected result should be a valid block number:
Troubleshooting
Please note that there should be no indication of port occupation when checking the port mappings for Docker.
Ensure that in all your configuration files, the databases have the correct host / user / password value. You can test connectivity using the command line before proceeding with the installation.
Commercial RPC nodes
For reference, you can also subscribe to the following third-party RPC vendors.
BlockPI: https://blockpi.io/
.......
Last updated