Skip to main content

CLI Cheatsheet

Chain ID: althea_258432-1 | Current Node Version: v1.4.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

althea keys add KEY

Recover key (via existing mnemonic)

althea keys add KEY --recover

List all keys

althea keys list

Delete key

althea keys delete KEY

Wallet

Wallet balance

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

Send

althea tx bank send YOUR_KEY RECEIVER_ADDRESS 1000000aalthea \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Withdraw rewards from all validators

althea tx distribution withdraw-all-rewards \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Withdraw Rewards including Commission

althea tx distribution withdraw-rewards VALIDATOR_ADRESS \
--commission \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Delegate tokens to yourself

althea tx staking delegate $(althea keys show KEY --bech val -a) 1000000aalthea \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Delegate tokens to validator

althea tx staking delegate VALIDATOR_ADDRESS 1000000aalthea \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Redelegate tokens to another validator

althea tx staking redelegate $(althea keys show KEY --bech val -a) VALIDATOR_ADDRESS 1000000aalthea \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Unbond tokens from your validator

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

Governance

List of all proposals

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

Check vote

althea query gov proposal PROPOSAL_NUMBER \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--output json | jq

Vote

Vote options:

  • yes
  • no
  • no_with_veto
  • abstain
althea tx gov vote PROPOSAL_NUMBER VOTE_OPTION \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--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.

althea tx staking create-validator \
--amount 1000000aalthea \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(althea 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 althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Edit validator

althea tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id althea_258432-1 \
--commission-rate 0.05 \
--from KEY \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \

Unjail

althea tx slashing unjail \
--chain-id althea_258432-1 \
--node https://althea-rpc.noders.services:443 --fees 30000000aalthea \
--from KEY

Jail reason

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

Validator details

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

Maintenance

Get validator info

althea status 2>&1 | jq .ValidatorInfo

Get sync info

althea status 2>&1 | jq .SyncInfo

Get node peer

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

Check if validator key is correct

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

###Enable prometheus

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

Reset chain data

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

Service Management

Reload service configuration

sudo systemctl daemon-reload

Enable service

sudo systemctl enable althea

Disable service

sudo systemctl disable althea

Start service

sudo systemctl start althea

Stop service

sudo systemctl stop althea

Restart service

sudo systemctl restart althea

Check service status

sudo systemctl status althea

Check service logs

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

Remove node

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