🎯Useful commands

Check node status

initiad status | jq

Query your validator

initiad q mstaking validator $(initiad keys show $WALLET_NAME --bech val -a) 

Query missed blocks counter & jail details of your validator

initiad q slashing signing-info $(initiad tendermint show-validator)

Unjail your validator

initiad tx slashing unjail --from $WALLET_NAME --gas=2000000 --fees=300000uinit -y

Delegate tokens to your validator

initiad tx mstaking delegate $(initiad keys show $WALLET_NAME --bech val -a)  <AMOUNT>uinit --from $WALLET_NAME --gas=2000000 --fees=300000uinit -y

Get your p2p peer address

initiad status | jq -r '"\(.NodeInfo.id)@\(.NodeInfo.listen_addr)"'

Edit your validator

initiad tx mstaking edit-validator --website="<WEBSITE>" --details="<DESCRIPTION>" --moniker="<NEW_MONIKER>" --from=$WALLET_NAME --gas=2000000 --fees=300000uinit -y

Send tokens between wallets

initiad tx bank send $WALLET_NAME <TO_WALLET> <AMOUNT>uinit --gas=2000000 --fees=300000uinit -y

Query your wallet balance

initiad q bank balances $WALLET_NAME

Monitor server load

sudo apt update
sudo apt install htop -y
htop

Query active validators

initiad q mstaking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \
| jq -r '.voting_power + " - " + .description.moniker' \
| sort -gr | nl

Query inactive validators

initiad q mstaking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' \
| jq -r '.voting_power + " - " + .description.moniker' \
| sort -gr | nl

Check logs of the node

sudo journalctl -u initiad -f -o cat

Restart the node

sudo systemctl restart initiad

Stop the node

sudo systemctl stop initiad

Delete the node from the server

# !!! IF YOU HAVE CREATED A VALIDATOR, MAKE SURE TO BACKUP `priv_validator_key.json` file located in $HOME/.initia/config/ 
sudo systemctl stop initiad
sudo systemctl disable initiad
sudo rm /etc/systemd/system/initiad.service
rm -rf $HOME/.initia
sudo rm /usr/local/bin/initiad

Example gRPC usage

wget https://github.com/fullstorydev/grpcurl/releases/download/v1.7.0/grpcurl_1.7.0_linux_x86_64.tar.gz
tar -xvf grpcurl_1.7.0_linux_x86_64.tar.gz
chmod +x grpcurl
./grpcurl  -plaintext  localhost:$GRPC_PORT list
### MAKE SURE gRPC is enabled in app.toml
# grep -A 3 "\[grpc\]" $HOME/.initia/config/app.toml

Example REST API query

curl localhost:$API_PORT/cosmos/mstaking/v1beta1/validators
### MAKE SURE API is enabled in app.toml
# grep -A 3 "\[api\]" $HOME/.initia/config/app.toml

Last updated