Skip to main content

CLI Cheatsheet

Essential CLI commands for managing your Union node and validator.

Key Management

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 Operations

Check Wallet Balance

uniond q bank balances $(uniond keys show KEY -a) --node https://m-union-rpc.ruangnode.com:443

Send Tokens

uniond tx bank send YOUR_KEY RECEIVER_ADDRESS 1000000au \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Withdraw Rewards from All Validators

uniond tx distribution withdraw-all-rewards \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Withdraw Rewards Including Commission

uniond tx distribution withdraw-rewards VALIDATOR_ADDRESS \
--commission \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Staking Operations

Delegate Tokens to Yourself

uniond tx staking delegate $(uniond keys show KEY --bech val -a) 1000000au \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Delegate Tokens to Validator

uniond tx staking delegate VALIDATOR_ADDRESS 1000000au \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Redelegate Tokens to Another Validator

uniond tx staking redelegate $(uniond keys show KEY --bech val -a) VALIDATOR_ADDRESS 1000000au \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Unbond Tokens from Your Validator

uniond tx staking unbond $(uniond keys show KEY --bech val -a) 1000000au \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Governance

List All Proposals

uniond query gov proposals --node https://m-union-rpc.ruangnode.com:443

Check Vote

uniond query gov proposal PROPOSAL_NUMBER \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 \
--output json | jq

Vote on Proposal

Vote options: yes, no, no_with_veto, abstain

uniond tx gov vote PROPOSAL_NUMBER VOTE_OPTION \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Validator Management

Create Validator

uniond tx staking create-validator \
--amount 1000000au \
--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 "YOUR_MONIKER" \
--website "https://yourwebsite.com" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--security-contact="your@email.com" \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--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-1 \
--commission-rate 0.05 \
--from KEY \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au

Unjail Validator

uniond tx slashing unjail \
--chain-id union-1 \
--node https://m-union-rpc.ruangnode.com:443 --fees 100au \
--from KEY

Check Jail Reason

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

Get Validator Details

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

Node 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 $HOME/.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://m-union-rpc.ruangnode.com: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.001au\"/" $HOME/.union/config/app.toml

Enable Prometheus

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

Reset Chain Data

uniond tendermint unsafe-reset-all --keep-addr-book --home $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

Complete Node Removal

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