๐Ÿ’ก Useful commands

โš™๏ธ Service Commands

Check Logs

sudo journalctl -u initiad -f -o cat

Start service

sudo systemctl start initiad 

Stop service

sudo systemctl stop initiad 

Restart service

sudo systmctl restart initiad 

Check status

sudo systemctl status initiad 

Enable Service

sudo systemctl enable initiad 

Reload service

sudo systemctl daemon-reload

Disable service

sudo systemctl disable initiad 

Check synchronization status

initiad status | jq | grep "catching_up"

If "true" - not synchronized // "false" - synchronized

Check the latest block of your validator and the last block of the network

local_height=$(initiad status | jq -r .sync_info.latest_block_height); network_height=$(curl -s https://rpc.initia.unitynodes.com/status | jq -r .result.sync_info.latest_block_height); blocks_left=$((network_height - local_height)); echo "Your node height: $local_height"; echo "Network height: $network_height"; echo "Blocks left: $blocks_left"

Example:

View the ports used node

ss -tulpn | grep initiad 

โš™๏ธ Key Command

Create new wallet

initiad keys add wallet

Recovery wallet

initiad keys add wallet --recover

List all wallet

initiad keys list

Delete wallet

initiad keys delete wallet

Export wallet

initiad keys export wallet

Import wallet

initiad keys import wallet wallet.backup 

Check wallet balance

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

โš™๏ธ Validator Commands

Create validator

initiad tx mstaking create-validator \
--amount 2000000uinit \
--pubkey $(initiad tendermint show-validator) \
--moniker "$YOUR_MONIKER" \ #Validator name, displayed in explorers.
--identity "" \ #Use your KeyBase ID. If you don't have one, leave it empty.
--website "" \ #Your website is available, or leave the field blank
--details "$YOUR_DETAILS" \ #Any details about your validator.
--chain-id initiation-1 \
--commission-rate 0.05 \
--commission-max-rate 0.20 \
--commission-max-change-rate 0.05 \
--from wallet \
--fees 80000uinit \
-y

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:

initiad tx mstaking create-validator \
--amount 2000000uinit \
--pubkey $(initiad tendermint show-validator) \
--moniker "Alex" \ #Validator name, displayed in explorers.
--identity "" \ #Use your KeyBase ID. If you don't have one, leave it empty.
--website "mywebsite.com" \ #Your website is available, or leave the field blank
--details "A reliable validator of your network" \ #Any details about your validator.
--chain-id initiation-1 \
--commission-rate 0.05 \
--commission-max-rate 0.20 \
--commission-max-change-rate 0.05 \
--from wallet \
--fees 80000uinit \
-y

Update validator information

initiad tx staking edit-validator \
--commission-rate 0.1 \
--new-moniker "$MONIKER" \
--identity "" \
--details "I love blockchain โค๏ธ" \
--from $WALLET \
--chain-id initiation-1 \
--gas auto --fees 80000uinit \
-y 

Validator details

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

Jailing info

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

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

Jail reason

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

Unjail command

initiad tx slashing unjail \
--chain-id initiation-1 \
--fees 80000uinit \
--from wallet \ # Or another wallet name
-y 

Information about delegation at your validator

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

Active Validators list

initiad 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

initiad 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

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

โš™๏ธ Tokens Commands

Delegate to yourself

initiad tx staking delegate $(initiad keys show $WALLET --bech val -a) 1000000uinit --from $WALLET --chain-id initiation-1 --gas auto --fees 80000uinit -y 

Delegate to another validator

initiad tx staking delegate <TO_VALOPER_ADDRESS> 1000000uinit --from wallet --chain-id initiation-1 --fees 5000uinit -y

Redelegate your stake to other validator

initiad tx staking redelegate $VALOPER_ADDRESS <TO_VALOPER_ADDRESS> 1000000uinit --from wallet --chain-id initiation-1 --fees 5000uinit -y

Unbond stake

initiad tx staking unbond $(initiad keys show $WALLET --bech val -a) 1000000uinit --from wallet --chain-id initiation-1 --fees 5000uinit -y

Send tokens

initiad tx bank send $WALLET_ADDRESS <TO_WALLET_ADDRESS> 1000000uinit --fees 300uinit -y

Check wallet balance

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

Transaction details

initiad query tx HASH_TX

Withdraw all rewards

initiad tx distribution withdraw-all-rewards --from $WALLET --chain-id initiation-1 --fees 300uinit

Withdraw rewards and commission from your validator

initiad tx distribution withdraw-rewards $VALOPER_ADDRESS --from $WALLET --commission --chain-id initiation-1 --fees 300uinit -y

โš™๏ธ Governance

List All Proposals

initiad query gov proposals

View proposal by ID

initiad query gov proposal ID

Vote "YES"

initiad tx gov vote PROPOSAL_ID yes --from wallet --chain-id initiation-1 --gas-adjustment 1.4 --gas 2000000 --fees 563000move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff -y

Vote "NO"

initiad tx gov vote PROPOSAL_ID no --from wallet --chain-id initiation-1 --gas-adjustment 1.4 --gas 2000000 --fees 563000move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff -y

Vote "NO_WITH_VETO"

initiad tx gov vote PROPOSAL_ID no_with_veto --from wallet --chain-id initiation-1 --gas-adjustment 1.4 --gas 2000000 --fees 563000move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff -y

Vote "ABSTAIN"

initiad tx gov vote PROPOSAL_ID abstain --from wallet --chain-id initiation-1 --gas-adjustment 1.4 --gas 2000000 --fees 563000move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff -y

Create new text proposal

initiad tx gov submit-proposal \
--title="Title" \ #Change Title
--description="Description" \
--deposit=1000000uinit \
--type="Text" \   #Change text proposal
--from=wallet \   #Change name wallet
--gas-adjustment 1.4 \
--gas 2000000 \
--fees 563000move/944f8dd8dc49f96c25fea9849f16436dcfa6d564eec802f3ef7f8b3ea85368ff \
-y 

โš™๏ธ Utility

Set Custom Port

# Change CUSTOM_PORT to any other value, or leave it as is.
CUSTOM_PORT=25
sed -i.bak -e "s%:26658%:${CUSTOM_PORT}658%; s%:26657%:${CUSTOM_PORT}657%; s%:6060%:${CUSTOM_PORT}060%; s%:26656%:${CUSTOM_PORT}656%; s%:26660%:${CUSTOM_PORT}660%" $HOME/.initia/config/config.toml && sed -i.bak -e "s%:9090%:${CUSTOM_PORT}090%; s%:9091%:${CUSTOM_PORT}091%; s%:1317%:${CUSTOM_PORT}317%; s%:8545%:${CUSTOM_PORT}545%; s%:8546%:${CUSTOM_PORT}546%; s%:6065%:${CUSTOM_PORT}065%" $HOME/.initia/config/app.toml && sed -i.bak -e "s%:26657%:${CUSTOM_PORT}657%" $HOME/.initia/config/client.toml
sudo systemctl restart initiad
journalctl -u initiad -f -o cat

Set Indexer

sed -i 's|^indexer *=.*|indexer = "null"|' $HOME/.initia/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/.initia/config/app.toml

Reset node

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

Get denom info

initiad q bank denom-metadata -oj | jq

Get Node Peer

echo $(initiad tendermint show-node-id)'@'$(curl -s ifconfig.me)':'$(cat $HOME/.initia/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 Initia (currently)

du -sh $HOME/.initia/

How much RAM use Initia (currently)

ps -p $(pgrep initiad) -o rss= | awk '{printf("The process uses memory:: %.2f MB\n", $1/1024)}'

How much CPU use Initia (currently)

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

Delete node

sudo systemctl stop initiad 
sudo systemctl disable initiad 
sudo rm -rf /etc/systemd/system/initiad.service
sudo rm $(which initiad )
sudo rm -rf $HOME/.initia

Last updated