# Useful commands

```bash
# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export XION_CHAIN_ID="xion-testnet-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
xiond keys add wallet

#Recover Wallet
xiond keys add wallet --recover

#List Wallet
xiond keys list

#Delete Wallet
xiond keys delete wallet

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

### VALIDATOR MANAGEMENT

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

```bash
#check pubkey 
xiond tendermint show-validator

#Make file validator.json
tee $HOME/.xiond/validator.json > /dev/null << EOF
{
    "pubkey": YOUR_PUBKEY,
    "amount": "1000000uxion",
    "moniker": "MONIKER",
    "identity": "YOUR_KEYBASE_ID",
    "website": "YOUR_WEBSITE_URL",
    "details": "YOUR_DETAILS.",
    "commission-rate": "0.1",
    "commission-max-rate": "0.2",
    "commission-max-change-rate": "0.01",
    "min-self-delegation": "1"
}
EOF 

#Create Validator
xiond --home $HOME/.xiond tx staking create-validator $HOME/.xiond/validator.json --from wallet --chain-id $XION_CHAIN_ID --gas 220000 --gas-prices 1uxion

#Unjail Validator
xiond tx slashing unjail --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

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

### TOKEN MANAGEMENT

```bash
#Withdraw Rewards
xiond tx distribution withdraw-all-rewards --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#Withdraw Rewards with Comission
xiond tx distribution withdraw-rewards $(xiond keys show wallet --bech val -a) --commission --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#Delegate Token to your own validator
xiond tx staking delegate $(xiond keys show wallet --bech val -a) 100000uxion --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#Delegate Token to other validator
xiond tx staking redelegate $(xiond keys show wallet --bech val -a) <TO_VALOPER_ADDRESS> 100000uxion --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#Unbond Token from your validator
xiond tx staking unbond $(xiond keys show wallet --bech val -a) 100000uxion --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#Send Token to another wallet
xiond tx bank send wallet <TO_WALLET_ADDRESS> 100000uxion --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion
```

### GOVERNANCE

```bash
#Vote, You can change the value of yes to no,abstain,nowithveto
xiond tx gov vote 1 yes --from wallet --chain-id $XION_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1uxion 

#List all proposals
xiond query gov proposals

#Create new text proposal
xiond tx gov submit-proposal \
--title="Title" \
--description="Description" \
--deposit=10000000uxion \
--type="Text" \
--from=wallet \
--gas-adjustment 1.5 \
--gas "auto" \
--gas-prices=1uxion
```

### SERVICES MANAGEMENT

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

# Enable Service
sudo systemctl enable xiond

# Disable Service
sudo systemctl disable xiond

# Start Service
sudo systemctl start xiond

# Stop Service
sudo systemctl stop xiond

# Restart Service
sudo systemctl restart xiond

# Check Service Status
sudo systemctl status xiond

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

### UTILITY

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

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

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

#Get sync status
xiond status 2>&1 | jq .sync_info.catching_up

#Get latest height
xiond status 2>&1 | jq .sync_info.latest_block_height

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.syanodes.my.id/xion/useful-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
