Validator Node

This guide is the most lazy docs i made from previous Guide

Auto Installer by ItRocket.net

sudo apt update
sudo apt install curl git make jq build-essential gcc unzip wget lz4 aria2 -y

Create or Import Wallet

# to create a new wallet, use the following command. don’t forget to save the mnemonic
0gchaind keys add $WALLET

# to restore exexuting wallet, use the following command
0gchaind keys add $WALLET --recover

# save wallet and 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_profile
echo "export VALOPER_ADDRESS="$VALOPER_ADDRESS >> $HOME/.bash_profile
source $HOME/.bash_profile

# check sync status, once your node is fully synced, the output from above will print "false"
0gchaind status 2>&1 | jq 

# before creating a validator, you need to fund your wallet and check balance
0gchaind query bank balances $WALLET_ADDRESS 

Node Sync Status Checker

#!/bin/bash
rpc_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 5
done

After sync complete. Create Validator

Create Validator

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 "Your Moniker Name" \
--identity "Keybase ID" \
--website "YOUR WEBSITE" \
--details "YOUR NODE DESCRIPTION" \
--chain-id zgtendermint_16600-2 \
--gas-adjustment 1.5 --gas auto --gas-prices 0.00252ua0gi \
-y

Last updated