# Useful commands

```bash
# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export TERP_CHAIN_ID="90u-2"" >> $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
#Create Wallet
terpd keys add wallet

#Recover Wallet
terpd keys add wallet --recover

#List Wallet
terpd keys list

#Delete Wallet
terpd keys delete wallet

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

### VALIDATOR MANAGEMENT

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

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

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

#Unjail Validator
terpd tx slashing unjail --from wallet --chain-id $TERP_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10terpx -y

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

### TOKEN MANAGEMENT

```bash
#Withdraw Rewards
terpd tx distribution withdraw-all-rewards --from wallet --chain-id $TERP_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10terpx -y

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

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

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

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

#Send Token to another wallet
terpd tx bank send wallet <TO_WALLET_ADDRESS> 1000000terpx --from wallet --chain-id $TERP_CHAIN_ID --gas-adjustment 1.5 --gas auto  -y
```

### GOVERNANCE

```bash
#Vote You can change the value of yes to no,abstain,nowithveto
terpd tx gov vote 1 yes --from wallet --chain-id $TERP_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10terpx -y

#List all proposals
terpd query gov proposals

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

### SERVICES MANAGEMENT

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

# Enable Service
sudo systemctl enable terpd

# Disable Service
sudo systemctl disable terpd

# Start Service
sudo systemctl start terpd

# Stop Service
sudo systemctl stop terpd

# Restart Service
sudo systemctl restart terpd

# Check Service Status
sudo systemctl status terpd

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

### UTILITY

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

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

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

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

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

#Reset Node
terpd tendermint unsafe-reset-all --home $HOME/.terp --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 terpd && sudo systemctl disable terpd && sudo rm /etc/systemd/system/terpd.service && sudo systemctl daemon-reload && sudo rm -rf $(which terpd) && rm -rf $HOME/.terp && rm -rf $HOME/terp-core
```
