Usefull commands for Babylon Chain

🔑 Key management

👛

Change wallet in the commands to your own wallet name.

Add new key

babylond keys add wallet

Recover existing key

babylond keys add wallet --recover

List all keys

babylond keys list

Delete key

babylond keys delete wallet

Export key to the file

babylond keys export wallet

Import key from the file

babylond keys import wallet wallet.backup

Query wallet balance

babylond q bank balances $( babylond keys show wallet -a)

🧙 Validator management

🙋‍♀️

Make sure to change values for moniker, identity, details website to your own values.

Edit existing validator

babylond tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id bbn-test-3 \
--commission-rate 0.05 \
--from wallet \
--gas-adjustment 1.5 \
--gas auto \
--gas-prices 0.001ubbn \
-y

Unjail validator

babylond tx slashing unjail --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto
 --gas-prices 0.001ubbn -y

Jail reason

babylond query slashing signing-info $( babylond tendermint show-validator)

List all active validators

babylond 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

babylond 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

View validator details

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

🪙 Token management

Withdraw rewards from all validators

babylond tx distribution withdraw-all-rewards --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Withdraw commission and rewards from your validator

babylond tx distribution withdraw-rewards $( babylond keys show wallet --bech val -a) --commission --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Delegate tokens to yourself

babylond tx staking delegate $( babylond keys show wallet --bech val -a) 1000000000000ubbn --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Delegate tokens to validator

babylond tx staking delegate <TO_VALOPER_ADDRESS> 1000000000000ubbn --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn  -y

Redelegate tokens to another validator

babylond tx staking redelegate $( babylond keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 1000000$ubbn --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Unbond tokens from your validator

babylond tx staking unbond $( babylond keys show wallet --bech val -a) 1000000$ubbn --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Send tokens to the wallet

babylond tx bank send wallet <TO_WALLET_ADDRESS> 1000000$ubbn --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

🏛️ Governance

List all proposals

babylond query gov proposals

View proposal by id

babylond query gov proposal 1

Vote 'Yes'

babylond tx gov vote 1 yes --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Vote 'No'

babylond tx gov vote 1 no --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Vote 'Abstain'

babylond tx gov vote 1 abstain --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

Vote 'NoWithVeto'

babylond tx gov vote 1 NoWithVeto --from wallet --chain-id bbn-test-3 --gas-adjustment 1.5 --gas auto --gas-prices 0.001ubbn -y

⚡️ Utility

Update Indexer

Disable indexer

sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.babylon/config/config.toml

Enable indexer

sed -i -e 's|^indexer *=.*|indexer = "kv"|' $HOME/.babylon/config/config.toml

Update pruning

sed -i \
  -e 's|^pruning *=.*|pruning = "custom"|' \
  -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "2000"|' \
  -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
  -e 's|^pruning-interval *=.*|pruning-interval = "100"|' \
  $HOME/.babylon/config/app.toml

🔧 Maintenance

Get validator info

babylond status 2>&1 | jq .ValidatorInfo

Get sync info

babylond status 2>&1 | jq .SyncInfo

Enable prometheus

sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.babylon/config/config.toml

Reset chain data

babylond tendermint unsafe-reset-all --keep-addr-book --home $HOME/.babylon --keep-addr-book

Remove node

☢️

Make sure you have backed up your priv_validator_key.json!

cd $HOME
sudo systemctl stop babylond
sudo systemctl disable babylond
sudo rm /etc/systemd/system/babylond.service
sudo systemctl daemon-reload
rm -f $(which babylond)
rm -rf $HOME/.babylon
rm -rf $HOME/babylon

⚙️ Service Management

Reload service configuration

sudo systemctl daemon-reload

Enable service

sudo systemctl enable babylond

Disable service

sudo systemctl disable babylond

Start service

sudo systemctl start babylond

Stop service

sudo systemctl stop babylond

Restart service

sudo systemctl restart babylond

Check service status

sudo systemctl status babylond

Check service logs

sudo journalctl -u babylond -f --no-hostname -o cat