🎯Useful commands

Add new key

0gchaind keys add wallet

Recover existing key

0gchaind keys add wallet --recover

List all keys

0gchaind keys list

Delete key

0gchaind keys delete wallet

Query wallet balance

0gchaind q bank balances $(0gchaind keys show wallet -a)

Create new validator

0gchaind tx staking create-validator \
--amount 1000000uaxl \
--pubkey $(0gchaind tendermint show-validator) \
--moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id zgtendermint_16600-1  \
--commission-rate 0.05 \
--commission-max-rate 0.20 \
--commission-max-change-rate 0.01 \
--min-self-delegation 1 \
--from wallet \
--gas-adjustment 1.4 \
--gas auto \
--gas-prices 100ua0gi \
-y

Edit validator

0gchaind tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id  zgtendermint_16600-1 \
--commission-rate 0.05 \
--from wallet \
--gas-adjustment 1.4 \
--gas auto \
--gas-prices 100ua0gi \
-y

Unjail validator

0gchaind tx slashing unjail --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Jail reason

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

List all active validators

0gchaind q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl

List all inactive validators

0gchaind q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl

Withdraw rewards from all validators

0gchaind tx distribution withdraw-all-rewards --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Withdraw commission and rewards from your validator

0gchaind tx distribution withdraw-rewards $(0gchaind keys show wallet --bech val -a) --commission --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Delegate to yourself

0gchaind tx staking delegate $(0gchaind keys show wallet --bech val -a) 1000000uaxl --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Delegate tokens to validator

0gchaind tx staking delegate <TO_VALOPER_ADDRESS> 1000000uaxl --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Redelegate tokens to another validator

0gchaind tx staking redelegate $(0gchaind keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 1000000uaxl --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Unbond tokens from your validator

0gchaind tx staking unbond $(0gchaind keys show wallet --bech val -a) 1000000uaxl --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

Send tokens to the wallet

0gchaind tx bank send wallet <TO_WALLET_ADDRESS> 1000000uaxl --from wallet --chain-id zgtendermint_16600-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.007uaxl -y

View validator details

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

Slashing params

0gchaind q slashing params

Signing Info

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

Get validator info

0gchaind status 2>&1 | jq .ValidatorInfo

Get sync info

0gchaind status --node http://localhost:17457 2>&1 | jq .SyncInfo

Check validator key

[[ $(0gchaind q staking validator $(0gchaind keys show wallet --bech val -a) -oj | jq -r .consensus_pubkey.key) = $(0gchaind status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\n\e[1m\e[32mTrue\e[0m\n" || echo -e "\n\e[1m\e[31mFalse\e[0m\n"

Governance

0gchaind tx gov vote 1 yes --from wallet --chain-id zgtendermint_16600-1 --gas-prices 0.007uaxl --gas-adjustment 1.5 --gas auto -y

Remove node

cd $HOME
sudo systemctl stop 0g-ai
sudo systemctl disable 0g-ai
sudo rm /etc/systemd/system/0g-ai.service
sudo systemctl daemon-reload
rm -f $(which 0gchaind)
rm -rf $HOME/.0gchain
rm -rf $HOME/0g-chain

Reload service configuration

sudo systemctl daemon-reload

Enable service

sudo systemctl enable 0g-ai

Disable service

sudo systemctl disable 0g-ai

Start service

sudo systemctl start 0g-ai

Stop service

sudo systemctl stop 0g-ai

Restart service

sudo systemctl restart 0g-ai

Check service status

sudo systemctl status 0g-ai

Check service logs

sudo journalctl -u 0g-ai -f --no-hostname -o cat

Last updated