Skip to main content

CLI Cheatsheet

Chain ID: auto | Current Node Version: v5.5.0

This cheatsheet collects commonly used CLI commands for node operators to easily copy and paste. A few conventions we follow:

  • Capitalized words indicate placeholders
  • Always use our own [NODERS]TEAM RPC endpoints
  • Always specify --chain-id and --node flags even when they are unnecessary
  • Query CLI command always uses --output json flag and pipes result through jq

Wallet generate and recover

Add new key

zenrockd keys add KEY

Recover key (via existing mnemonic)

zenrockd keys add KEY --recover

List all keys

zenrockd keys list

Delete key

zenrockd keys delete KEY

Wallet

Wallet balance

zenrockd q bank balances $(zenrockd keys show KEY -a) --node https://zenrock-rpc.noders.services:443

Send

zenrockd tx bank send YOUR_KEY RECEIVER_ADDRESS 1000000urock \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Withdraw rewards from all validators

zenrockd tx distribution withdraw-all-rewards \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Withdraw Rewards including Commission

zenrockd tx distribution withdraw-rewards VALIDATOR_ADRESS \
--commission \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Delegate tokens to yourself

zenrockd tx staking delegate $(zenrockd keys show KEY --bech val -a) 1000000urock \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Delegate tokens to validator

zenrockd tx staking delegate VALIDATOR_ADDRESS 1000000urock \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Redelegate tokens to another validator

zenrockd tx staking redelegate $(zenrockd keys show KEY --bech val -a) VALIDATOR_ADDRESS 1000000urock \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Unbond tokens from your validator

zenrockd tx staking unbond $(zenrockd keys show KEY --bech val -a) urock \
--chain-id andromeda-1 \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Governance

List of all proposals

zenrockd query gov proposals --node https://zenrock-rpc.noders.services:443

Check vote

zenrockd query gov proposal PROPOSAL_NUMBER \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--output json | jq

Vote

Vote options:

  • yes
  • no
  • no_with_veto
  • abstain
zenrockd tx gov vote PROPOSAL_NUMBER VOTE_OPTION \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Validator management

Create Validator

note

We use example filed values instead of capitalized dummy words for demo purpose in this command. Please make sure to adjust accordingly for your use.

zenrockd tx staking create-validator \
--amount 1000000urock \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(zenrockd tendermint show-validator) \
--moniker '[NODERS]TEAM SERVICE' \
--website "https://noders.team" \
--identity "220491ADDD660741" \
--details "Trusted blockchain validator and web3 developer team" \
--security-contact="office@noders.team" \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Edit validator

zenrockd tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id auto \
--commission-rate 0.05 \
--from KEY \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \

Unjail

zenrockd tx slashing unjail \
--chain-id auto \
--node https://zenrock-rpc.noders.services:443 --fees 3000urock \
--from KEY

Jail reason

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

Validator details

zenrockd q staking validator $(zenrockd keys show KEY --bech val -a)

Maintenance

Get validator info

zenrockd status 2>&1 | jq .ValidatorInfo

Get sync info

zenrockd status 2>&1 | jq .SyncInfo

Get node peer

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

Check if validator key is correct

[[ $(zenrockd q staking validator $(zenrockd keys show KEY --bech val -a) -oj | jq -r .consensus_pubkey.key) = $(zenrockd 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"

Get live peers

curl -sS https://zenrock-rpc.noders.services:443/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'

Set minimum gas price

sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.001urock\"/" ~/.zrchain/config/app.toml

###Enable prometheus

sed -i -e "s/prometheus = false/prometheus = true/" ~/.zrchain/config/config.toml

Reset chain data

zenrockd tendermint unsafe-reset-all --keep-addr-book --home ~/.zrchain

Service Management

Reload service configuration

sudo systemctl daemon-reload

Enable service

sudo systemctl enable zenrockd

Disable service

sudo systemctl disable zenrockd

Start service

sudo systemctl start zenrockd

Stop service

sudo systemctl stop zenrockd

Restart service

sudo systemctl restart zenrockd

Check service status

sudo systemctl status zenrockd

Check service logs

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

Remove node

cd $HOME
sudo systemctl stop zenrockd
sudo systemctl disable zenrockd
sudo rm /etc/systemd/system/zenrock.service
sudo systemctl daemon-reload
rm -f $(which zenrockd)
rm -rf ~/.zrchain
rm -rf $HOME/zrchain