Node CLI Cheatsheet

  • Network Type: Testnet
  • Chain-id: self-dev-1
  • Current Node version: v
  • CLI Cheatsheet

    • Always be careful with the capitalized words
    • Specify --chain-id

    Wallet Management

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

    selfchaind keys add wallet

    Recover Wallet

    selfchaind keys add wallet --recover

    List Wallet

    selfchaind keys list

    Delete Wallet

    selfchaind keys delete wallet

    Check Wallet Balance

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

    Validator Management

    Please adjust <wallet> , MONIKER , YOUR_KEYBASE_ID , YOUR_DETAILS , YOUUR_WEBSITE_URL

    Create Validator (Staking)

    
    selfchaind tx staking create-validator \
    --amount="1000000000uself" \
    --pubkey=$(selfchaind tendermint show-validator) \
    --moniker=vinjan \
    --identity=7C66E36EA2B71F68 \
    --website=https://service.vinjan.xyz \
    --details=🎉Proffesional Stake & Node Validator🎉 \
    --chain-id=self-dev-1 \
    --commission-rate="0.1" \
    --commission-max-rate="0.15" \
    --commission-max-change-rate="0.05" \
    --min-self-delegation=1000000000 \
    --from=wallet \
    --gas-adjustment=1.2 \
    --gas-prices="0.5uself" \
    --gas=auto

    Edit Validator

    selfchaind tx staking edit-validator \
    --new-moniker="" \
    --identity="" \
    --chain-id=self-dev-1 \
    --from=wallet \
    --gas-adjustment=1.2 \
    --gas-prices="0.5uself" \
    --gas=auto

    Unjail Validator

    selfchaind tx slashing unjail --from wallet --chain-id self-dev-1 --gas-prices 0.5uself --gas-adjustment 1.2 --gas auto

    Check Jailed Reason

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

    Token Management

    Withdraw Rewards

    selfchaind tx distribution withdraw-all-rewards --from wallet --chain-id self-dev-1  --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Withdraw Rewards with Comission

    selfchaind tx distribution withdraw-rewards $(selfchaind keys show wallet --bech val -a) --commission --from wallet --chain-id self-dev-1  --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Delegate Token to your own validator

    selfchaind tx staking delegate $(selfchaind keys show wallet --bech val -a) 1000000uself --from wallet --chain-id self-dev-1  --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Delegate Token to other validator

    selfchaind staking redelegate $(selfchaind keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 1000000uself --from wallet --chain-id self-dev-1  --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Unbond Token from your validator

    selfchaind tx staking unbond $(selfchaind keys show wallet --bech val -a) 1000000uself --from wallet --chain-id self-dev-1  --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Send Token to another wallet

    selfchaind tx bank send wallet <TO_WALLET_ADDRESS> 1000000uself --from wallet --chain-id self-dev-1

    Governance

    Vote You can change the value of yes to no,abstain,nowithveto

    selfchaind tx gov vote 1 yes --from wallet --chain-id self-dev-1 --gas-adjustment 1.2 --gas-prices 0.5uself --gas auto -y

    Other

    Set Your own Custom Ports You can change value CUSTOM_PORT=20 To any other ports

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

    Enable Indexing usually enabled by default

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

    Disable Indexing

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

    Reset Chain Data

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

    Delete Node

    WARNING! Use this command wisely Backup your key first it will remove Defund from your system

    sudo systemctl stop selfchaind
    sudo systemctl disable selfchaind
    sudo rm /etc/systemd/system/selfchaind.service
    sudo systemctl daemon-reload
    rm -f $(which selfchaind)
    rm -rf .selfchain
    rm -rf selfchain