Validator Node Installation
Running a validator node for the 0G-Galileo-Testnet in the 0G ecosystem means actively participating in the network’s security and consensus through the Proof-of-Stake (PoS) mechanism. As a validator, you’ll validate transactions, propose new blocks, and earn rewards for your contribution to the network’s integrity and decentralization.
Hardware Requirements
Section titled “Hardware Requirements”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 for Download / Upload | 100 MBps for Download / Upload |
System Update & Dependencies
Section titled “System Update & Dependencies”sudo apt updatesudo apt install curl git make jq build-essential gcc unzip wget lz4 aria2 -y
Download And Extract Galileo
Section titled “Download And Extract Galileo”wget https://github.com/0glabs/0gchain-ng/releases/download/v1.0.1/galileo-v1.0.1.tar.gztar -xzvf galileo-v1.0.1.tar.gz -C $HOME
Permissions & Move Binaries
Section titled “Permissions & Move Binaries”sudo chmod 777 $HOME/galileo/bin/gethsudo chmod 777 $HOME/galileo/bin/0gchaindcp $HOME/galileo/bin/geth $HOME/go/bin/gethcp $HOME/galileo/bin/0gchaind $HOME/go/bin/0gchaind
source $HOME/.bash_profilegeth version0gchaind version
Variable Settings
Section titled “Variable Settings”echo "export WALLET='allnodesone'" >> $HOME/.bash_profileecho "export MONIKER='allnodesone'" >> $HOME/.bash_profileecho "export OG_PORT='26'" >> $HOME/.bash_profilesource $HOME/.bash_profile
Node Init
Section titled “Node Init”mkdir -p $HOME/.0gchaindcp -r $HOME/galileo/0g-home $HOME/.0gchaind
# Init Gethgeth init --datadir $HOME/.0gchaind/0g-home/geth-home $HOME/galileo/genesis.json
# Init 0gchaind0gchaind init "allnodesone" --home $HOME/.0gchaind/tmp
# Copy node filescp $HOME/.0gchaind/tmp/data/priv_validator_state.json $HOME/.0gchaind/0g-home/0gchaind-home/data/cp $HOME/.0gchaind/tmp/config/node_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/cp $HOME/.0gchaind/tmp/config/priv_validator_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/rm -rf $HOME/.0gchaind/tmp
Custom Port Setting (Optional)
Section titled “Custom Port Setting (Optional)”sed -i -e "s%:26658%:${OG_PORT}658%g;s%:26657%:${OG_PORT}657%g;s%:6060%:${OG_PORT}060%g;s%:26656%:${OG_PORT}656%g;s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${OG_PORT}656\"%;s%:26660%:${OG_PORT}660%g" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${OG_PORT}657\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.tomlsed -i -e "s|^keyring-backend *=.*|keyring-backend = \"os\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
Config Pruning, Gas Price, Prometheus
Section titled “Config Pruning, Gas Price, Prometheus”sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.tomlsed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.tomlsed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.tomlsed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
Create Systemd Service Files 0gchaind.service
Section titled “Create Systemd Service Files 0gchaind.service”sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF[Unit]Description=0G Chain DaemonAfter=network-online.target
[Service]User=rootExecStart=$(which 0gchaind) start \\ --rpc.laddr tcp://0.0.0.0:26657 \\ --beacon-kit.kzg.trusted-setup-path=$HOME/galileo/kzg-trusted-setup.json \\ --beacon-kit.engine.jwt-secret-path=$HOME/galileo/jwt-secret.hex \\ --beacon-kit.kzg.implementation=crate-crypto/go-kzg-4844 \\ --beacon-kit.block-store-service.enabled \\ --beacon-kit.node-api.enabled \\ --beacon-kit.node-api.logging \\ --beacon-kit.node-api.address 0.0.0.0:3500 \\ --pruning=custom \\ --home $HOME/.0gchaind/0g-home/0gchaind-home \\ --p2p.external_address $(curl -s http://ipv4.icanhazip.com):${OG_PORT}656Environment=CHAIN_SPEC=devnetWorkingDirectory=$HOME/galileoRestart=alwaysRestartSec=3LimitNOFILE=65535
[Install]WantedBy=multi-user.targetEOF
Create Systemd Service Files geth.service
Section titled “Create Systemd Service Files geth.service”sudo tee /etc/systemd/system/geth.service > /dev/null <<EOF[Unit]Description=Go Ethereum ClientAfter=network-online.targetWants=network-online.target
[Service]User=rootExecStart=$HOME/go/bin/geth \\ --config $HOME/galileo/geth-config.toml \\ --datadir $HOME/.0gchaind/0g-home/geth-home \\ --networkid 80087 \\ --port 30303 \\ --http.port 8645 \\ --authrpc.port 8551Restart=alwaysWorkingDirectory=$HOME/galileoRestartSec=3LimitNOFILE=65535
[Install]WantedBy=multi-user.targetEOF
Enable And Start Services
Section titled “Enable And Start Services”sudo systemctl daemon-reloadsudo systemctl enable 0gchaindsudo systemctl enable gethsudo systemctl start 0gchaindsudo systemctl start geth
Check Status And Logs
Section titled “Check Status And Logs”sudo systemctl status 0gchaindsudo systemctl status gethsudo journalctl -fu 0gchaind -o catsudo journalctl -fu geth -o cat
Check Block Height
Section titled “Check Block Height”0gchaind status | jq '{ latest_block_height: .sync_info.latest_block_height, catching_up: .sync_info.catching_up }'
Check Block Sync Status
Section titled “Check Block Sync Status”while true; do PORT=$(grep -A 3 '^\[rpc\]' $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml | grep -oP 'laddr = "tcp://[0-9.:]+:\K\d+') local=$(curl -s localhost:$PORT/status | jq -r '.result.sync_info.latest_block_height//0') network=$(curl -s http://8.218.94.246:26657/status | jq -r '.result.sync_info.latest_block_height//0') left=$((network - local)) echo -e "Local: \033[1;34m$local\033[0m | Network: \033[1;36m$network\033[0m | Left: \033[1;31m$left\033[0m" sleep 5done
Remove node
Section titled “Remove node”🚨 Danger
Please, before proceeding with the next step! All chain data will be lost! Make sure you have backed up your wallet key
& priv_validator_key.json
!
cd $HOMEsudo systemctl stop 0gchaind gethsudo systemctl disable 0gchaind gethsudo rm /etc/systemd/system/0gchaind.servicesudo rm /etc/systemd/system/geth.servicesudo systemctl daemon-reloadsudo rm -f $(which 0gchaind)sudo rm -rf $HOME/.0gchaind