# Useful commands

```bash
# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export ALIGNEDLAYER_CHAIN_ID="alignedlayer"" >> $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
alignedlayerd keys add wallet

#Recover Wallet
alignedlayerd keys add wallet --recover

#List Wallet
alignedlayerd keys list

#Delete Wallet
alignedlayerd keys delete wallet

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

### VALIDATOR MANAGEMENT

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

```bash
#Create Validator
alignedlayerd tx staking create-validator \
--amount=10000000stake \
--pubkey=$(alignedlayerd tendermint show-validator) \
--moniker=$MONIKER \
--identity="YOUR_KEYBASE_ID" \
--details="YOUR_DETAILS" \
--website="YOUR_WEBSITE_URL" \
--chain-id=$ALIGNEDLAYER_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=10stake\ 
-y

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

#Unjail Validator
alignedlayerd tx slashing unjail --from wallet --chain-id $ALIGNEDLAYER_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10stake -y

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

### TOKEN MANAGEMENT

```bash
alignedlayerd tx distribution withdraw-all-rewards --from wallet --chain-id $ALIGNEDLAYER_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10stake -y

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

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

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

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

#Send Token to another wallet
alignedlayerd tx bank send wallet <TO_WALLET_ADDRESS> 1000000stake --from wallet --chain-id $ALIGNEDLAYER_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 10stake -y
```

### GOVERNANCE

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

#List all proposals
alignedlayerd query gov proposals

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

### SERVICES MANAGEMENT

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

# Enable Service
sudo systemctl enable alignedlayerd

# Disable Service
sudo systemctl disable alignedlayerd

# Start Service
sudo systemctl start alignedlayerd

# Stop Service
sudo systemctl stop alignedlayerd

# Restart Service
sudo systemctl restart alignedlayerd

# Check Service Status
sudo systemctl status alignedlayerd

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

### UTILITY

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

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

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

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

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

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