A Docker-based setup for running a 0G Chain RPC node on Mainnet (Aristotle) or Testnet (Galileo).
| Network | Name | Network ID | Chain Spec |
|---|---|---|---|
| Mainnet | Aristotle | 16661 | mainnet |
| Testnet | Galileo | 16602 | testnet |
| Component | Mainnet | Testnet |
|---|---|---|
| Memory | 64 GB | 64 GB |
| CPU | 8 cores | 8 cores |
| Disk | 1 TB NVME SSD | 4 TB NVME SSD |
| Bandwidth | 100 MBps up/down | 100 MBps up/down |
# Build the Docker image
docker-compose build
# Start the node (set your external IP)
EXTERNAL_IP=<your-public-ip> docker-compose up -d
# View logs
docker-compose logs -f# Build the mainnet Docker image
DOCKERFILE=Dockerfile.mainnet NETWORK=aristotle docker-compose build
# Start the node (set your external IP)
DOCKERFILE=Dockerfile.mainnet NETWORK=aristotle EXTERNAL_IP=<your-public-ip> docker-compose up -d
# View logs
docker-compose logs -f| Variable | Description | Default |
|---|---|---|
DOCKERFILE |
Dockerfile to use | Dockerfile.testnet |
NETWORK |
Network name (for container naming) | galileo |
MONIKER |
Node name | my-0g-rpc-node |
EXTERNAL_IP |
Your public IP for P2P (required) | - |
PERSISTENT_PEERS |
Comma-separated peer list | - |
SEEDS |
Comma-separated seed nodes | - |
# Testnet with custom moniker and peers
EXTERNAL_IP=1.2.3.4 \
MONIKER=my-testnet-node \
PERSISTENT_PEERS=node_id@ip:port \
docker-compose up -d
# Mainnet with custom moniker
DOCKERFILE=Dockerfile.mainnet \
NETWORK=aristotle \
EXTERNAL_IP=1.2.3.4 \
MONIKER=my-mainnet-node \
docker-compose up -d# Check sync status
curl -s http://localhost:26657/status | jq '.result.sync_info'
# Check connected peers
curl -s http://localhost:26657/net_info | jq '.result.n_peers'
# Check latest block
curl -s http://localhost:26657/status | jq '.result.sync_info.latest_block_height'
# Test Geth JSON-RPC
curl -s -X POST -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
http://localhost:8545
# Check supervisor process status
docker exec 0g-rpc-galileo supervisorctl status # testnet
docker exec 0g-rpc-aristotle supervisorctl status # mainnet| Port | Service | Description |
|---|---|---|
| 8545 | Geth HTTP | JSON-RPC HTTP endpoint |
| 8546 | Geth WS | JSON-RPC WebSocket endpoint |
| 30303 | Geth P2P | Execution layer P2P |
| 26656 | 0gchaind P2P | Consensus layer P2P |
| 26657 | 0gchaind RPC | Tendermint RPC |
| 1317 | REST API | Cosmos REST API |
| 9090 | gRPC | gRPC endpoint |
| 9091 | gRPC Web | gRPC Web endpoint |
Once synced, use these endpoints:
# Tendermint RPC
http://localhost:26657
# REST API
http://localhost:1317
# gRPC
localhost:9090
# Geth JSON-RPC
http://localhost:8545
# Geth WebSocket
ws://localhost:8546# Stop the node
docker-compose down
# Backup data volume
docker run --rm -v docker-rpc_0g-data:/data -v $(pwd)/backup:/backup \
ubuntu tar cvf /backup/0g-backup.tar /data# Restore from backup
docker run --rm -v docker-rpc_0g-data:/data -v $(pwd)/backup:/backup \
ubuntu tar xvf /backup/0g-backup.tar -C /# All logs
docker-compose logs -f
# Geth logs only (testnet)
docker exec 0g-rpc-galileo cat /data/0g-home/log/geth.out.log
# 0gchaind logs only (testnet)
docker exec 0g-rpc-galileo cat /data/0g-home/log/0gchaind.out.log
# For mainnet, replace 'galileo' with 'aristotle'# Restart entire container
docker-compose restart
# Restart just the node
docker-compose down && docker-compose up -d# Stop and remove everything including data
docker-compose down -v
# Rebuild and start fresh
docker-compose up -d --buildIf switching from testnet to mainnet (or vice versa), you must remove the old data volume:
# Stop and remove container
docker-compose down
# Remove the data volume
docker volume rm docker-rpc_0g-data
# Build and start with new network
DOCKERFILE=Dockerfile.mainnet NETWORK=aristotle docker-compose build
DOCKERFILE=Dockerfile.mainnet NETWORK=aristotle EXTERNAL_IP=<ip> docker-compose up -d.
├── Dockerfile.testnet # Testnet (Galileo) image
├── Dockerfile.mainnet # Mainnet (Aristotle) image
├── docker-compose.yml # Docker Compose configuration
├── entrypoint.sh # Container entrypoint script
├── supervisord.conf # Reference (generated at runtime)
└── README.md
MIT