Validator Node
This guide will install the latest version and cannot sync from block 0. Therefore, you must use a snapshot. This guide will help you set up a Validator Node for 0G Labs. For official documentation, please refer to the Official 0G Labs docs.
⚙️ Requirements
Section titled “⚙️ Requirements”- CPU: 8 Cores
- Memory: 64GB RAM
- Disk: 1 TB of storage (NVME)
- Bandwidth: 100 Mbps (Download / Upload)
🚀 Install
Section titled “🚀 Install”1. Install Dependencies
Section titled “1. Install Dependencies”sudo apt update && sudo apt upgrade -ysudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Auto-install Script Powered by ITRocket 🚀
Special thanks to ITRocket for this Auto Install Script.
source <(curl -s https://itrocket.net/api/testnet/og/autoinstall/)
2. Create Wallet
Section titled “2. Create Wallet”To create a new wallet, use the following command. Don’t forget to save the mnemonic
0gchaind keys add $WALLET
To restore existing wallet, use the following command
0gchaind keys add $WALLET --recover
If you want to restore an existing wallet, use the following command:
0gchaind keys add $WALLET --eth --recover
Save Wallet & Validator Address
WALLET_ADDRESS=$(0gchaind keys show $WALLET -a)VALOPER_ADDRESS=$(0gchaind keys show $WALLET --bech val -a)
echo "export WALLET_ADDRESS=$WALLET_ADDRESS" >> $HOME/.bash_profileecho "export VALOPER_ADDRESS=$VALOPER_ADDRESS" >> $HOME/.bash_profilesource $HOME/.bash_profile
3. 📊 Check Block Sync
Section titled “3. 📊 Check Block Sync”Script by ITRocket:
#!/bin/bashrpc_port=$(grep -m 1 -oP '^laddr = "\K[^"]+' "$HOME/.0gchain/config/config.toml" | cut -d ':' -f 3)
while true; do local_height=$(curl -s localhost:$rpc_port/status | jq -r '.result.sync_info.latest_block_height') network_height=$(curl -s https://og-testnet-rpc.itrocket.net/status | jq -r '.result.sync_info.latest_block_height')
if ! [[ "$local_height" =~ ^[0-9]+$ ]] || ! [[ "$network_height" =~ ^[0-9]+$ ]]; then echo -e "\033[1;31mError: Invalid block height data. Retrying...\033[0m" sleep 5 continue fi
blocks_left=$((network_height - local_height)) echo -e "\033[1;33mNode Height:\033[1;34m $local_height\033[0m \033[1;33m| Network Height:\033[1;36m $network_height\033[0m \033[1;33m| Blocks Left:\033[1;31m $blocks_left\033[0m" sleep 5done
4. 🔍 Check Node Status
Section titled “4. 🔍 Check Node Status”Make sure you see "catching_up": false
:
0gchaind status 2>&1 | jq
5. Check Log
Section titled “5. Check Log”tail -f ~/.0gchain/log/chain.log
🧱 Create Validator
Section titled “🧱 Create Validator”1. Check Balance
Section titled “1. Check Balance”Change "wallet_name"
:
0gchaind q bank balances $(0gchaind keys show "wallet_name" -a)
2. Create Validator
Section titled “2. Create Validator”💡
1000000ua0gi = 1 A0GI
0gchaind tx staking create-validator \--amount 1000000ua0gi \--from $WALLET \--commission-rate 0.1 \--commission-max-rate 0.2 \--commission-max-change-rate 0.01 \--min-self-delegation 1 \--pubkey $(0gchaind tendermint show-validator) \--moniker "test" \--identity "" \--website "" \--details "I love blockchain ❤️" \--chain-id zgtendermint_16600-2 \--gas-adjustment 1.5 --gas auto --gas-prices 0.00252ua0gi \-y
3. Check Validator Info
Section titled “3. Check Validator Info”Change "wallet_name"
:
0gchaind q staking validator $(0gchaind keys show "wallet_name" --bech val -a)
🗑️ Delete Node (With Caution!)
Section titled “🗑️ Delete Node (With Caution!)”⚠️ Critical: Backup Your Validator Key!
Do not lose this key — it is required to run your validator.
File location: /root/.0gchain/config/priv_validator_key.json
sudo systemctl stop 0gchaindsudo systemctl disable 0gchaindsudo rm -rf /etc/systemd/system/0gchaind.servicesudo rm $(which 0gchaind)sudo rm -rf $HOME/.0gchainsed -i "/OG_/d" $HOME/.bash_profile
Maintained by BANGCODE
Supported by Maouam’s Node Lab