This guide provides comprehensive instructions for deploying CPChain RPC nodes:
- cp-geth: Execution layer client
- cp-node: Consensus layer client
- System Requirements
- Prerequisites
- Deployment Methods
- Configuration
- Monitoring
- Troubleshooting
- Support
- CPU: 4+ cores (8+ cores recommended)
- Memory: 8GB+ (16GB recommended for optimal performance)
- Storage: 500GB+ SSD (more space required for archive mode)
- Network: Stable internet connection with good bandwidth
- Docker 20.10+ (for Docker deployment)
- Go 1.22+ (for shell script deployment)
- OpenSSL (for key generation)
- At least 50GB available disk space
git clone https://github.com/cpchain-network/network.git
cd network
# Generate JWT secret for authentication between cp-geth and cp-node
openssl rand -hex 32 > jwt_secret_txt
# Generate P2P private key for node identification
cast w n |grep -i "Private Key" |awk -F ": " '{print $2}' |sed 's/0x//' > p2p_node_key_txt
Ensure you have the necessary configuration files in the appropriate network directory:
mainnet/genesis.json
- Genesis block configurationmainnet/rollup.json
- Rollup configurationtestnet/genesis.json
- Testnet genesis configurationtestnet/rollup.json
- Testnet rollup configuration
This method uses Docker containers to run the CPChain RPC node components.
cd cp-geth
docker build -t cpchain-network/cp-geth:latest .
cd cp-node
docker build -t cpchain-network/cp-node:latest .
# Create data volume
docker volume create geth_data
# Start cp-geth container
docker run -d \
--name cp-geth-rpc \
-p 8545:8545 \
-p 8546:8546 \
-p 6060:6060 \
-v $(pwd)/mainnet/genesis.json:/db/genesis.json:ro \
-v $(pwd)/jwt_secret_txt:/config/jwt_secret_txt:ro \
-v geth_data:/db \
-e VERBOSITY=3 \
-e GETH_DATA_DIR=/db \
-e GETH_CHAINDATA_DIR=/db/geth/chaindata \
-e GENESIS_FILE_PATH=/db/genesis.json \
-e CHAIN_ID=86608 \
-e RPC_PORT=8545 \
-e WS_PORT=8546 \
-e AUTHRPC_PORT=8551 \
-e METRICS_PORT=6060 \
cpchain-network/cp-geth:latest
# Create data volume
docker volume create node_data
# Start cp-node container
docker run -d \
--name cp-node-rpc \
-p 8547:8545 \
-p 9004:9003 \
-p 7301:7300 \
-v $(pwd)/mainnet/rollup.json:/config/rollup.json:ro \
-v $(pwd)/jwt_secret_txt:/config/jwt_secret_txt:ro \
-v $(pwd)/p2p_node_key_txt:/config/p2p_node_key_txt:ro \
-v node_data:/cp-node \
--link cp-geth-rpc:cp-geth-rpc \
-e OP_NODE_L2_ENGINE_RPC=http://cp-geth-rpc:8551 \
-e OP_NODE_L2_ENGINE_AUTH=/config/jwt_secret_txt \
-e OP_NODE_LOG_LEVEL=info \
-e OP_NODE_P2P_SEQUENCER_ADDRESS=0xDcdac98A82b8E586900Da6a87CeD838FB09c49e6 \
-e OP_NODE_ROLLUP_CONFIG=/config/rollup.json \
-e OP_NODE_RPC_ADDR=0.0.0.0 \
-e OP_NODE_RPC_PORT=8545 \
-e OP_NODE_P2P_LISTEN_IP=0.0.0.0 \
-e OP_NODE_P2P_LISTEN_TCP_PORT=9003 \
-e OP_NODE_P2P_LISTEN_UDP_PORT=9003 \
-e OP_NODE_P2P_PEER_SCORING=light \
-e OP_NODE_P2P_NO_DISCOVERY=true \
-e OP_NODE_P2P_PEER_BANNING=true \
-e OP_NODE_P2P_PRIV_PATH=/config/p2p_node_key_txt \
-e OP_NODE_P2P_DISCOVERY_PATH=/cp-node/opnode_discovery_db \
-e OP_NODE_P2P_PEERSTORE_PATH=/cp-node/opnode_peerstore_db \
-e OP_NODE_P2P_STATIC= \
-e OP_NODE_METRICS_ENABLED=true \
-e OP_NODE_METRICS_ADDR=0.0.0.0 \
-e OP_NODE_METRICS_PORT=7300 \
-e OP_NODE_P2P_SYNC_ONLYREQTOSTATIC=true \
-e OP_NODE_EL_RPC_MAX_BATCH_SIZE=500 \
-e OP_NODE_EL_RPC_URL=https://rpc.cpchain.com \
-e OP_NODE_SYNCMODE=execution-layer \
cpchain-network/cp-node:latest
# View logs
docker logs -f cp-geth-rpc
docker logs -f cp-node-rpc
# Stop containers
docker stop cp-geth-rpc cp-node-rpc
# Remove containers
docker rm cp-geth-rpc cp-node-rpc
# Remove volumes (WARNING: This will delete all data)
docker volume rm geth_data node_data
This method uses shell scripts to run the CPChain components directly on the host system.
- Go 1.22+ installed
- cp-geth and cp-node binaries built and available in PATH
- Required configuration files in the network directory
# Create necessary directories
mkdir -p /db/geth/chaindata
mkdir -p /cp-node/opnode_discovery_db
mkdir -p /cp-node/opnode_peerstore_db
# Copy configuration files
cp mainnet/genesis.json /db/genesis.json
cp mainnet/rollup.json /config/rollup.json
cd mainnet
chmod +x cp-geth.sh
./cp-geth.sh
cd mainnet
chmod +x cp-node.sh
./cp-node.sh
# Check cp-geth RPC
curl -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545