# Useful commands

```bash
# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export CHEQD_CHAIN_ID="cheqd-mainnet-1"" >> $HOME/.bash_profile
source $HOME/.bash_profile
```

### WALLET MANAGEMENT

{% hint style="info" %}
*Add Wallet Specify the value \<wallet> with your own wallet name*
{% endhint %}

```bash
#Add new wallet
cheqd-noded keys add wallet

#Recover Wallet
cheqd-noded keys add wallet --recover

#List Wallet
cheqd-noded keys list

#Delete Wallet
cheqd-noded keys delete wallet

#Check Wallet Balance
cheqd-noded q bank balances $(cheqd-noded keys show wallet -a)
```

### VALIDATOR MANAGEMENT

{% hint style="info" %}
*Please adjust , MONIKER , YOUR\_KEYBASE\_ID , YOUR\_DETAILS , YOUR\_WEBSITE\_URL*
{% endhint %}

```bash
#Create Validator
cheqd-noded tx staking create-validator \
--amount=1000000ncheq \
--pubkey=$(cheqd-noded tendermint show-validator) \
--moniker=$MONIKER \
--identity="YOUR_KEYBASE_ID" \
--details="YOUR_DETAILS" \
--website="YOUR_WEBSITE_URL" \
--chain-id=$CHEQD_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=25ncheq \ 
-y

#Edit Validator
cheqd-noded tx staking edit-validator \
--new-moniker="YOUR MONIKER" \
--identity="IDENTITY KEYBASE" \
--details="DETAILS VALIDATOR" \
--website="LINK WEBSITE" \
--chain-id=$CHEQD_CHAIN_ID \
--from=wallet \
--gas-adjustment=1.5 \
--gas="auto" \
--gas-prices=25ncheq \ 
-y

#Unjail Validator
cheqd-noded tx slashing unjail --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Check Jailed Reason
cheqd-noded query slashing signing-info $(cheqd-noded tendermint show-validator)
```

### TOKEN MANAGEMENT

```bash
#Withdraw Rewards
cheqd-noded tx distribution withdraw-all-rewards --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Withdraw Rewards with Comission
cheqd-noded tx distribution withdraw-rewards $(cheqd-noded keys show wallet --bech val -a) --commission --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Delegate Token to your own validator
cheqd-noded tx staking delegate $(cheqd-noded keys show wallet --bech val -a) 100000ncheq --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Delegate Token to other validator
cheqd-noded tx staking redelegate $(cheqd-noded keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 100000ncheq --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Unbond Token from your validator
cheqd-noded tx staking unbond $(cheqd-noded keys show wallet --bech val -a) 100000ncheq --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#Send Token to another wallet
cheqd-noded tx bank send wallet <TO_WALLET_ADDRESS> 100000ncheq --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y
```

### GOVERNANCE

```bash
#Vote, You can change the value of yes to no,abstain,nowithveto
cheqd-noded tx gov vote 1 yes --from wallet --chain-id $CHEQD_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 25ncheq -y

#List all proposals
cheqd-noded query gov proposals

#Create new text proposal
cheqd-noded tx gov submit-proposal \
--title="Title" \
--description="Description" \
--deposit=10000000ncheq \
--type="Text" \
--from=wallet \
--gas-adjustment 1.5 \
--gas "auto" \
--gas-prices=25ncheq \ 
-y 
```

### SERVICES MANAGEMENT

```bash
# Reload Service
sudo systemctl daemon-reload

# Enable Service
sudo systemctl enable cheqd-noded

# Disable Service
sudo systemctl disable cheqd-noded

# Start Service
sudo systemctl start cheqd-noded

# Stop Service
sudo systemctl stop cheqd-noded

# Restart Service
sudo systemctl restart cheqd-noded

# Check Service Status
sudo systemctl status cheqd-noded

# Check Service Logs
sudo journalctl -u cheqd-noded -f --no-hostname -o cat
```

### UTILITY

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

#Get Validator info
cheqd-noded status 2>&1 | jq .ValidatorInfo

#Get denom info
cheqd-noded q bank denom-metadata -oj | jq

#Get sync status
cheqd-noded status --node tcp://localhost:11657  2>&1 | jq .SyncInfo.catching_up

#Get latest height
cheqd-noded status --node tcp://localhost:11657 2>&1 | jq .SyncInfo.latest_block_height

#Reset Node
cheqd-noded tendermint unsafe-reset-all --home $HOME/.cheqdnode --keep-addr-book
```

### DELETE NODE

{% hint style="warning" %} <mark style="color:red;">**WARNING! Use this command wisely Backup your key first it will remove node from your system**</mark>
{% endhint %}

```bash
sudo systemctl stop cheqd-noded && sudo systemctl disable cheqd-noded && sudo rm /etc/systemd/system/cheqd-noded.service && sudo systemctl daemon-reload && sudo rm -rf $(which cheqd-noded) && rm -rf $HOME/.cheqdnode
```
