Useful commands

# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export MANTRA_CHAIN_ID="mantra-hongbai-1"" >> $HOME/.bash_profile
source $HOME/.bash_profile

WALLET MANAGEMENT

Add Wallet Specify the value <wallet> with your own wallet name

#Add new key
mantrachaind keys add wallet

#Recover Wallet
mantrachaind keys add wallet --recover

#List Wallet
mantrachaind keys list

#Delete Wallet
mantrachaind keys delete wallet

#Check Wallet Balance
mantrachaind q bank balances $(mantrachaind keys show wallet -a)

VALIDATOR MANAGEMENT

Please adjust , MONIKER , YOUR_KEYBASE_ID , YOUR_DETAILS , YOUR_WEBSITE_URL

#Create Validator
mantrachaind tx staking create-validator \
--amount=10000000uom \
--pubkey=$(mantrachaind tendermint show-validator) \
--moniker=$MONIKER \
--identity="YOUR_KEYBASE_ID" \
--details="YOUR_DETAILS" \
--website="YOUR_WEBSITE_URL" \
--chain-id=$MANTRA_CHAIN_ID \
--commission-rate=0.10 \
--commission-max-rate=0.20 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1000 \
--from=wallet \
--gas-adjustment=1.5 \
--gas="auto" \
--gas-prices=10uom\ 
-y

#Edit Validator
mantrachaind tx staking edit-validator \
--new-moniker="YOUR MONIKER" \
--identity="IDENTITY KEYBASE" \
--details="DETAILS VALIDATOR" \
--website="LINK WEBSITE" \
--chain-id=$MANTRA_CHAIN_ID \
--from=wallet \
--gas-adjustment=1.5 \
--gas="auto" \
--gas-prices=10uom\ 
-y

#Unjail Validator
mantrachaind tx slashing unjail --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Check Jailed Reason
mantrachaind query slashing signing-info $(mantrachaind tendermint show-validator)

TOKEN MANAGEMENT

#Withdraw Rewards
mantrachaind tx distribution withdraw-all-rewards --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Withdraw Rewards with Comission
mantrachaind tx distribution withdraw-rewards $(mantrachaind keys show wallet --bech val -a) --commission --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Delegate Token to your own validator
mantrachaind tx staking delegate $(mantrachaind keys show wallet --bech val -a) 1000000uaum --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Delegate Token to other validator
mantrachaind tx staking redelegate $(mantrachaind keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 1000000uaum --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Unbond Token from your validator
mantrachaind tx staking unbond $(mantrachaind keys show wallet --bech val -a) 1000000uaum --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#Send Token to another wallet
mantrachaind tx bank send wallet <TO_WALLET_ADDRESS> 1000000uaum --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

GOVERNANCE

#Vote You can change the value of yes to no,abstain,nowithveto
mantrachaind tx gov vote 1 yes --from wallet --chain-id $MANTRA_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10uom -y

#List all proposals
mantrachaind query gov proposals

#Create new text proposal
mantrachaind tx gov submit-proposal \
--title="Title" \
--description="Description" \
--deposit=100000000uom \
--type="Text" \
--from=wallet \
--gas-adjustment 1.5 \
--gas "auto" \
--gas-prices=10uom\ 
-y

SERVICES MANAGEMENT

# Reload Service
sudo systemctl daemon-reload

# Enable Service
sudo systemctl enable mantrachaind

# Disable Service
sudo systemctl disable mantrachaind

# Start Service
sudo systemctl start mantrachaind

# Stop Service
sudo systemctl stop mantrachaind

# Restart Service
sudo systemctl restart mantrachaind

# Check Service Status
sudo systemctl status mantrachaind

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

UTILITY

#Set Indexer NULL / KV
sed -i 's|^indexer *=.*|indexer = "null"|' $HOME/.mantrachaind/config/config.toml

#Get Validator info
mantrachaind status 2>&1 | jq .ValidatorInfo

#Get denom info
mantrachaind q bank denom-metadata -oj | jq

#Get sync status
mantrachaind status 2>&1 | jq .SyncInfo.catching_up

#Get latest height
mantrachaind status 2>&1 | jq .SyncInfo.latest_block_height

#Reset Node
mantrachaind tendermint unsafe-reset-all --home $HOME/.mantrachaind --keep-addr-book

DELETE NODE

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

Last updated