Skip to main content

CLI Cheatsheet

Chain ID: union-testnet-8 | Current Node Version: v0.24.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

uniond keys add KEY

Recover key (via existing mnemonic)

uniond keys add KEY --recover

List all keys

uniond keys list

Delete key

uniond keys delete KEY

Wallet

Wallet balance

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

Send

uniond tx bank send YOUR_KEY RECEIVER_ADDRESS 1000000muno \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Withdraw rewards from all validators

uniond tx distribution withdraw-all-rewards \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Withdraw Rewards including Commission

uniond tx distribution withdraw-rewards VALIDATOR_ADRESS \
--commission \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Delegate tokens to yourself

uniond tx staking delegate $(uniond keys show KEY --bech val -a) 1000000muno \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Delegate tokens to validator

uniond tx staking delegate VALIDATOR_ADDRESS 1000000muno \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Redelegate tokens to another validator

uniond tx staking redelegate $(uniond keys show KEY --bech val -a) VALIDATOR_ADDRESS 1000000muno \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Unbond tokens from your validator

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

Governance

List of all proposals

uniond query gov proposals --node https://union-t-rpc.noders.services:443

Check vote

uniond query gov proposal PROPOSAL_NUMBER \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--output json | jq

Vote

Vote options:

  • yes
  • no
  • no_with_veto
  • abstain
uniond tx gov vote PROPOSAL_NUMBER VOTE_OPTION \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--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.

uniond tx staking create-validator \
--amount 1000000muno \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(uniond 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 union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Edit validator

uniond tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id union-testnet-8 \
--commission-rate 0.05 \
--from KEY \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \

Unjail

uniond tx slashing unjail \
--chain-id union-testnet-8 \
--node https://union-t-rpc.noders.services:443 --fees 3000muno \
--from KEY

Jail reason

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

Validator details

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

Maintenance

Get validator info

uniond status 2>&1 | jq .ValidatorInfo

Get sync info

uniond status 2>&1 | jq .SyncInfo

Get node peer

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

Check if validator key is correct

[[ $(uniond q staking validator $(uniond keys show KEY --bech val -a) -oj | jq -r .consensus_pubkey.key) = $(uniond 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://union-t-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.001muno\"/" ~/.union/config/app.toml

###Enable prometheus

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

Reset chain data

uniond tendermint unsafe-reset-all --keep-addr-book --home ~/.union

Service Management

Reload service configuration

sudo systemctl daemon-reload

Enable service

sudo systemctl enable uniond

Disable service

sudo systemctl disable uniond

Start service

sudo systemctl start uniond

Stop service

sudo systemctl stop uniond

Restart service

sudo systemctl restart uniond

Check service status

sudo systemctl status uniond

Check service logs

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

Remove node

cd $HOME
sudo systemctl stop uniond
sudo systemctl disable uniond
sudo rm /etc/systemd/system/union.service
sudo systemctl daemon-reload
rm -f $(which uniond)
rm -rf ~/.union
rm -rf $HOME/unionlabs