πŸ’‘ Useful commands

βš™οΈ Service Commands

Check Logs

sudo journalctl -u nilchaind -f -o cat

Start service

sudo systemctl start nilchaind 

Stop service

sudo systemctl stop nilchaind 

Restart service

sudo systmctl restart nilchaind 

Check status

sudo systemctl status nilchaind 

Enable Service

sudo systemctl enable nilchaind 

Reload service

sudo systemctl daemon-reload

Disable service

sudo systemctl disable nilchaind  

Check synchronization status

while true; do 
  local_height=$(nilchaind status | jq -r .sync_info.latest_block_height)
  network_height=$(curl -s https://rpc.nillion-testnet.unitynodes.com/status | jq -r '.result.sync_info.latest_block_height')
  blocks_left=$((network_height - local_height))

  echo -e "\033[1;33m[Sync Status]\033[0m \033[1;32mNode Height:\033[0m \033[1;37m$local_height\033[0m | \033[1;32mNetwork Height:\033[0m \033[1;37m$network_height\033[0m | \033[1;32mBlocks Left:\033[0m \033[1;31m$blocks_left\033[0m"

  sleep 5
done

If "Block left - 0" - synchronized

Check the latest block of your validator

nilchaind status | jq '.SyncInfo.latest_block_height // .sync_info.latest_block_height'

View the ports used node

ss -tulpn | grep nilchaind 

βš™οΈ Key Command

Create new wallet

nilchaind keys add wallet

Recovery wallet

nilchaind keys add wallet --recover

List all wallet

nilchaind keys list

Delete wallet

nilchaind keys delete wallet

Export wallet

nilchaind keys export wallet

Import wallet

nilchaind  keys import wallet wallet.backup 

Check wallet balance

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

βš™οΈ Validator Commands

Create validator

# Create validator.json file
touch $HOME/.nillionapp/config/validator.json

# Find your pubkey
nilchaind comet show-validator

#Open a validator.json file
nano $HOME/.nillionapp/config/validator.json

#Paste this into the open validator.json file, pre-replacing all values ​​that start with $ 
{
  "pubkey": {
    "@type": "/cosmos.crypto.ed25519.PubKey",
    "key": ""
  },
  "amount": "1000000unil",
  "moniker": "Oliver",
  "identity": "", 
  "website": "", 
  "security": "", 
  "details": "Trusted Blockchain validator", 
  "commission-rate": "0.05",
  "commission-max-rate": "0.2",
  "commission-max-change-rate": "0.2",
  "min-self-delegation": "1"
}

#After entering and changing all values, save the file with the key combination Ctrl + X and press Enter

#Run command create validator
nilchaind tx staking create-validator $HOME/validator.json --from wallet --chain-id nillion-chain-testnet-1 --fees 0unil

You can leave the text after # unchanged - it's a commented hint that won't affect validator creation.

β—½ Replace the following values with your own: WALLET - usually it's 'wallet', or your wallet's name. MONIKER - any convenient name for your validator, displayed in the explorer. IDENTITY - validator's avatar, displayed in the explorer. Create a KeyBase ID following the instructions or leave it empty, and it will default to a standard one. DETAILS - details about your validator, also displayed in the explorer.

Replace all necessary values indicated above with the $ sign to successfully create your validator. β—½ Example: {

  "pubkey": {
    "@type": "/cosmos.crypto.ed25519.PubKey",
    "key": ""
  },
  "amount": "1000000unil",
  "moniker": "Oliver",
  "identity": "", 
  "website": "https://mywebsite.com", 
  "security": "myemail@gmail.com", 
  "details": "Trusted Blockchain validator", 
  "commission-rate": "0.05",
  "commission-max-rate": "0.2",
  "commission-max-change-rate": "0.2",
  "min-self-delegation": "1"
}

Update validator information

nilchaind tx staking edit-validator \
--new-moniker "" \
--identity "" \
--details "" \
--website "" \
--chain-id nillion-chain-testnet-1 \
--commission-rate 0.05 \
--from wallet \
--gas-adjustment 1.4 \
--gas auto \
--gas-prices  \
-y

Validator details

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

Jailing info

nilchaind q staking validator $(nilchaind keys show wallet --bech val -a) | grep -E "jailed"

If "true" - your validator is jailed // "false" - your validator is not jailed

Jail reason

nilchaind q slashing signing-info $(nilchaind tendermint show-validator)

Unjail command

nilchaind tx slashing unjail --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Information about delegation at your validator

nilchaind q staking validator $(nilchaind keys show wallet --bech val -a) | grep -E "tokens"

Active Validators list

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

Inactive Validator list

nilchaind q staking validators -oj --limit=2000 | 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 

Signing Info

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

βš™οΈ Tokens Commands

Delegate to yourself

nilchaind tx staking delegate $(nilchaind keys show wallet --bech val -a)  --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Delegate to another validator

nilchaind tx staking redelegate $(nilchaind keys show wallet --bech val -a) TO_VALOPER_ADDRESS --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Redelegate your stake to other validator

nilchaind tx staking redelegate $(nilchaind keys show wallet --bech val -a) <TO_VALOPER_ADDRESS>  --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Unbond stake

nilchaind tx staking unbond $(nilchaind keys show wallet --bech val -a)  --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Send tokens

nilchaind tx bank send wallet <TO_WALLET_ADDRESS>  --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Check wallet balance

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

Transaction details

nilchaind query tx HASH_TX

Withdraw all rewards

nilchaind tx distribution withdraw-all-rewards --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Withdraw rewards and commission from your validator

nilchaind tx distribution withdraw-rewards $(nilchaind keys show wallet --bech val -a) --commission --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

βš™οΈ Governance

List All Proposals

nilchaind query gov proposals

View proposal by ID

nilchaind query gov proposal ID

Vote "YES"

nilchaind tx gov vote 1 yes --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Vote "NO"

nilchaind tx gov vote 1 no --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Vote "NO_WITH_VETO"

nilchaind tx gov vote 1 NoWithVeto --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Vote "ABSTAIN"

nilchaind tx gov vote 1 abstain --from wallet --chain-id nillion-chain-testnet-1 --gas-adjustment 1.4 --gas auto --gas-prices  -y

Create new text proposal

nilchaind tx gov submit-proposal \
--title="Title" \ #Change Title
--description="Description" \
--deposit=1000000unil \
--type="Text" \   #Change text proposal
--from=wallet \   #Change name wallet
--fees 500unil
-y 

βš™οΈ Utility

Set Custom Port


#PORT 29
sed -i.bak -e "s%:1317%:1617%g; 
s%:8080%:8380%g;
s%:9090%:9390%g;
s%:9091%:9391%g;
s%:8545%:8845%g;
s%:8546%:8846%g;
s%:6065%:6365%g" $HOME/.nillionapp/config/app.toml	
sed -i.bak -e "s%:26658%:29658%g;
s%:26657%:29657%g;
s%:6060%:6360%g;
s%tcp://0.0.0.0:26656%tcp://0.0.0.0:29656%g;
s%:26660%:29660%g" $HOME/.nillionapp/config/config.toml
sed -i.bak -e "s%:26657%:29657%g" $HOME/.nillionapp/config/client.toml
sudo systemctl restart nilchaind && sudo journalctl -u nilchaind -f -o cat 

Set Indexer

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

Update Pruning

sed -i.bak -e 's|^pruning *=.*|pruning = "custom"|; s|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|; s|^pruning-keep-every *=.*|pruning-keep-every = "0"|; s|^pruning-interval *=.*|pruning-interval = "17"|' $HOME/.nillionapp/config/app.toml

Reset node

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

Get denom info

nilchaind q bank denom-metadata -oj | jq

Get Node Peer

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

Update server name

 sudo hostnamectl set-hostname server_name

How much SSD use node (currently)

du -sh $HOME/.nillionapp/

How much RAM use node (currently)

sudo systemctl status nilchaind | grep "Memory:"

How much CPU use node (currently)

ps -C nilchaind -o %cpu --no-headers | awk '{print $1"% CPU"}'

Delete node

sudo systemctl stop nilchaind  
sudo systemctl disable nilchaind 
sudo rm -rf /etc/systemd/system/nilchaind.service
sudo rm $(which nilchaind)
sudo rm -rf $HOME/.nillionapp
sudo rm -rf $HOME/nilliond

Last updated