CLI Cheatsheet

Chain ID: swisstronik_1291-1

Useful Commands

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

Key Management

Add new key

Copy

swisstronikd keys add wallet

Recover existing key

Copy

swisstronikd keys add wallet --recover

List All key

Copy

swisstronikd keys list

Delete key

Copy

swisstronikd keys delete wallet

Export Key (save to back up wallet)

Copy

swisstronikd keys export wallet

Import key

Copy

swisstronikd keys import wallet wallet.backup

Query Wallet Balance

Copy

swisstronikd q bank balances $(swisstronikd keys show wallet -a)

Token Faucet

Copy

https://faucet.testnet.swisstronik.com/

Validator Management

Create Validator

Copy

swisstronikd tx staking create-validator \
--amount 1000000uswtr \
--from wallet \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--min-self-delegation 1 \
--pubkey $(swisstronikd tendermint show-validator) \
--moniker "Your Moniker" \
--identity "Your Keybase ID" \
--website "Your Website" \
--details "Your Details" \
--chain-id swisstronik_1291-1 \
--keyring-backend test --gas-prices 300000uswtr \
--gas-adjustment="1.5" \
--gas="auto" \
-y

Edit Validator

Copy

swisstronikd tx staking edit-validator \
--new-moniker="MONIKER" \
--from wallet \
--commission-rate 0.1 \
--identity "Your Keybase ID" \
--website "Your Website" \
--details "Your Details" \
--chain-id swisstronik_1291-1 \
--keyring-backend test --gas-prices 300000uswtr \
--gas-adjustment="1.5" \
--gas="auto" \
-y

Unjail Validator

Copy

swisstronikd tx slashing unjail --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Signing Info

Copy

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

List of all active validators

Copy

swisstronikd q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl 

List of all inactive validators

Copy

swisstronikd q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED") or .status=="BOND_STATUS_UNBONDING")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl 

View validators details

Copy

swisstronikd q staking validator $(swisstronikd keys show wallet --bech val -a) 

Token Management

Withdraw rewards from all validators

Copy

swisstronikd tx distribution withdraw-all-rewards --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Withdraw commission and rewards from your validator

Copy

swisstronikd tx distribution withdraw-rewards $(swisstronikd keys show wallet --bech val -a) --commission --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Delegate to your validator

Copy

swisstronikd tx staking delegate $(swisstronikd keys show wallet --bech val -a) 1000000swtr --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Delegate to other

Copy

swisstronikd tx staking delegate TO_VALOPER_ADDRESS 1000000swtr --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Rede legate your stake to other validators

Copy

swisstronikd tx staking redelegate $(swisstronikd keys show wallet --bech val -a) TO_VALOPER_ADDRESS 1000000swtr --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Unbond stake

Copy

swisstronikd tx staking unbond $(swisstronikd keys show wallet --bech val -a) 1000000swtr --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Send tokens

Copy

swisstronikd tx bank send wallet TO_WALLET_ADDRESS 1000000swtr --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Governance

List all proposals

Copy

swisstronikd query gov proposals

Vote YES / NO / ABSTAIN / NO_WITH_VETO

Copy

swisstronikd tx gov vote 1 yes --from wallet --chain-id swisstronik_1291-1 --gas-prices 300000uswtr --gas-adjustment 1.5 --gas="auto" -y 

Create new text proposal

Copy

swisstronikd tx gov submit-proposal \
--title="Title" \
--description="Description" \
--deposit=100000000swtr \
--type="Text" \
--from=wallet \
--gas-prices 300000uswtr\ 
--gas-adjustment 1.5 \
--gas "500000" \
-y 

Utility

Set Indexer NULL / KV

Copy

sed -i 's|^indexer *=.*|indexer = "null"|' $HOME/.swisstronikd /config/config.toml

Set Custom Port

Copy

CUSTOM_PORT=55
sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${CUSTOM_PORT}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${CUSTOM_PORT}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${CUSTOM_PORT}060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${CUSTOM_PORT}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${CUSTOM_PORT}660\"%" $HOME/.swisstronikd/config/config.toml
sed -i.bak -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${CUSTOM_PORT}317\"%; s%^address = \":8080\"%address = \":${CUSTOM_PORT}080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${CUSTOM_PORT}090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${CUSTOM_PORT}091\"%; s%^address = \"0.0.0.0:8545\"%address = \"0.0.0.0:${CUSTOM_PORT}545\"%; s%^ws-address = \"0.0.0.0:8546\"%ws-address = \"0.0.0.0:${CUSTOM_PORT}546\"%" $HOME/.swisstronikd/config/app.toml

Get Validator info

Copy

swisstronikd status 2>&1 | jq .ValidatorInfo

Get denom info

Copy

swisstronikd q bank denom-metadata -oj | jq

Get sync status

Copy

swisstronikd status 2>&1 | jq .SyncInfo.catching_up

Get latest height

Copy

swisstronikd status 2>&1 | jq .SyncInfo.latest_block_height

Reset Node

Copy

swisstronikd tendermint unsafe-reset-all --home $HOME/.swisstronikd --keep-addr-book

Delete Node

Copy

sudo systemctl stop swisstronikd && sudo systemctl disable swisstronikd && sudo rm /etc/systemd/system/swisstronikd.service && sudo systemctl daemon-reload && rm -rf $HOME/.swisstronikd && sudo rm -rf $(which swisstronikd) 

Services Management

Copy

# Reload Service
sudo systemctl daemon-reload

# Enable Service
sudo systemctl enable swisstronikd

# Disable Service
sudo systemctl disable swisstronikd 

# Start Service
sudo systemctl start swisstronikd 

# Stop Service
sudo systemctl stop swisstronikd 

# Restart Service
sudo systemctl restart swisstronikd 

# Check Service Status
sudo systemctl status swisstronikd 

# Check Service Logs
sudo journalctl -u swisstronikd -f --no-hostname -o cat

Last updated