Nillion CLI Cheatsheet
Chain ID:
nillion-chain-testnet-1
Current Node Version:
v0.2.5
Useful commands
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 throughjq
Wallet generate and recover
Add new key
nilchaind keys add KEY
Recover key (via existing mnemonic)
nilchaind keys add KEY --recover
List all keys
nilchaind keys list
Delete key
nilchaind keys delete KEY
Wallet
Wallet balance
nilchaind q bank balances $(nilchaind keys show KEY -a) --node https://nillion-t-rpc.noders.services:443
Send
nilchaind tx bank send YOUR_KEY RECEIVER_ADDRESS 1000000unil \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Withdraw rewards from all validators
nilchaind tx distribution withdraw-all-rewards \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Withdraw Rewards including Commission
nilchaind tx distribution withdraw-rewards VALIDATOR_ADRESS \
--commission \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Delegate tokens to yourself
nilchaind tx staking delegate $(nilchaind keys show KEY --bech val -a) 1000000unil \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Delegate tokens to validator
nilchaind tx staking delegate VALIDATOR_ADDRESS 1000000unil \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Redelegate tokens to another validator
nilchaind tx staking redelegate $(nilchaind keys show KEY --bech val -a) VALIDATOR_ADDRESS 1000000unil \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Unbond tokens from your validator
nilchaind tx staking unbond $(nilchaind keys show KEY --bech val -a) unil \
--chain-id andromeda-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Governance
List of all proposals
nilchaind query gov proposals --node https://nillion-t-rpc.noders.services:443
Check vote
nilchaind query gov proposal PROPOSAL_NUMBER \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--output json | jq
Vote
Vote options:
- yes
- no
- no_with_veto
- abstain
nilchaind tx gov vote PROPOSAL_NUMBER VOTE_OPTION \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--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.
nilchaind tx staking create-validator \
--amount 1000000unil \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(nilchaind 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 nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Edit validator
nilchaind tx staking edit-validator \
--new-moniker "YOUR_MONIKER_NAME" \
--identity "YOUR_KEYBASE_ID" \
--details "YOUR_DETAILS" \
--website "YOUR_WEBSITE_URL" \
--chain-id nillion-chain-testnet-1 \
--commission-rate 0.05 \
--from KEY \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
Unjail
nilchaind tx slashing unjail \
--chain-id nillion-chain-testnet-1 \
--node https://nillion-t-rpc.noders.services:443 --fees 20000unil \
--from KEY
Jail reason
nilchaind query slashing signing-info $(nilchaind tendermint show-validator)
Validator details
nilchaind q staking validator $(nilchaind keys show KEY --bech val -a)
Maintenance
Get validator info
nilchaind status 2>&1 | jq .ValidatorInfo
Get sync info
nilchaind status 2>&1 | jq .SyncInfo
Get node peer
echo $(nilchaind tendermint show-node-id)'@'$(curl -s ifconfig.me)':'$(cat ~/.nillionapp/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')
Check if validator key is correct
[[ $(nilchaind q staking validator $(nilchaind keys show KEY --bech val -a) -oj | jq -r .consensus_pubkey.key) = $(nilchaind 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://nillion-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.001unil\"/" ~/.nillionapp/config/app.toml
###Enable prometheus
sed -i -e "s/prometheus = false/prometheus = true/" ~/.nillionapp/config/config.toml
Reset chain data
nilchaind tendermint unsafe-reset-all --keep-addr-book --home ~/.nillionapp
Service Management
Reload service configuration
sudo systemctl daemon-reload
Enable service
sudo systemctl enable nilchaind
Disable service
sudo systemctl disable nilchaind
Start service
sudo systemctl start nilchaind
Stop service
sudo systemctl stop nilchaind
Restart service
sudo systemctl restart nilchaind
Check service status
sudo systemctl status nilchaind
Check service logs
sudo journalctl -u nilchaind -f --no-hostname -o cat
Remove node
cd $HOME
sudo systemctl stop nilchaind
sudo systemctl disable nilchaind
sudo rm /etc/systemd/system/nillion.service
sudo systemctl daemon-reload
rm -f $(which nilchaind)
rm -rf ~/.nillionapp
rm -rf $HOME/nilchain