Common Commands

Node Command

Check Node status

RPC_PORT=26657
curl -s 127.0.0.1:$RPC_PORT/status | jq .

Check P2P Connection Status

P2P_PORT=26656 && ss -anp | grep $P2P_PORT

Wallet Command

Create/Recovery Wallet

WALLET_NAME=wallet_name
# create
0gchaind keys add $WALLET_NAME
# recovery
0gchaind keys add $WALLET_NAME --recover

Query balance

WALLET_NAME=wallet_name
0gchaind q bank balances $(0gchaind keys show $WALLET_NAME -a) 

Validator Commands

Update validator information

WALLET_NAME=wallet_name

0gchaind tx staking edit-validator \
    --commission-rate 0.1 \
    --new-moniker "$MONIKER" \
    --identity "12345678" \
    --details "0gchain" \
    --from $WALLET_NAME \
    --chain-id zgtendermint_16600-2 \
    --gas auto \
    --gas-adjustment=1.4 \
    -y

Query Jail Reason

0gchaind q slashing signing-info $(0gchaind tendermint show-validator)

Unjail validator

WALLET_NAME=wallet_name

0gchaind tx slashing unjail \
    --chain-id zgtendermint_16600-2 \
    --fees 20000ua0gi \
    --from $WALLET_NAME

Query validator

WALLET_NAME=wallet_name

0gchaind q staking validator $(0gchaind keys show $WALLET_NAME --bech val -a)

Signing Info

0gchaind q staking signing-info $(0gchaind tendermint show-validator) 

Query Active Validators

LIMIT=6000

0gchaind q staking validators -oj --limit=$LIMIT | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '.operator_address + "  " + .voting_power + "  " + .description.moniker' | sort -gr | nl

Token Management

Delegate Token

VALOPER_ADDRESS=$(0gchaind keys show wallet --bech val -a)
AMOUNT=100000ua0gi
WALLET_NAME=wallet_name
CHAIN_ID=zgtendermint_16600-2
GAS_PRICE=0.15ua0gi

0gchaind tx staking delegate \
    $VALOPER_ADDRESS $AMOUNT \
    --from $WALLET_NAME \
    --chain-id $CHAIN_ID \
    --gas-adjustment 1.4 \
    --gas auto \
    --gas-prices $GAS_PRICE \
    -y

Send Token To Another Address

FRON_WALLET=wallet_name
TO_ADDRESS=address
AMOUNT=1000000uinit
CHAIN_ID=zgtendermint_16600-2
GAS_PRICE=0.15ua0gi

initiad tx bank send $FRON_WALLET $TO_ADDRESS $AMOUNT \
    --from $FRON_WALLET \
    --chain-id $CHAIN_ID \
    --gas-adjustment 1.4 \
    --gas auto \
    --gas-prices $GAS_PRICE \
    -y

Withdraw Rewards From All Delegated Validators

WALLET_NAME=wallet_name
CHAIN_ID=zgtendermint_16600-2
GAS_PRICE=0.15ua0gi

0gchaind tx distribution withdraw-all-rewards \
    --from $WALLET_NAME \
    --chain-id $CHAIN_ID \
    --gas-adjustment 1.4 \
    --gas auto \
    --gas-prices $GAS_PRICE \
    -y

Withdraw Commision From Your Validator

WALLET_NAME=wallet_name
CHAIN_ID=zgtendermint_16600-2
GAS_PRICE=0.15ua0gi

0gchaind tx distribution withdraw-rewards $(0gchaind keys show wallet --bech val -a) \
    --commission \
    --from $WALLET_NAME \
    --chain-id $CHAIN_ID \
    --gas-adjustment 1.4 \
    --gas auto \
    --gas-prices $GAS_PRICE \
    -y

Governance

Query proposal by ID

0gchaind query gov proposal <proposal_id>

Vote

WALLET_NAME=wallet_name
CHAIN_ID=zgtendermint_16600-2

0gchaind tx gov vote <proposal_id> yes|no|no_with_veto|abstain \
    --from $WALLET_NAME \
    --chain-id $CHAIN_ID \
    --gas-adjustment 1.4 \
    --gas auto \
    -y

Maintenance

Reset all data

DIR=~/.0gchain
0gchaind tendermint unsafe-reset-all --keep-addr-book --home $DIR --keep-addr-book

Get Node Sync Info

RPC_PORT=26657
curl -s http://127.0.0.1:$RPC_PORT/status | jq .

or

0gchaind status 2>&1 | jq .

Get Live Peers

RPC_PORT=26657
curl -sS http://127.0.0.1:$RPC_PORT/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'

Show Self Peer

echo $(0gchaind tendermint show-node-id)'@'$(curl -s ifconfig.me)':'$(cat ~/.0gchain/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')

Last updated