# Useful commands

```bash
# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export XENROCK_CHAIN_ID="gardia-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
#Add new wallet
zenrockd keys add wallet

#Recover Wallet
zenrockd keys add wallet --recover

#List Wallet
zenrockd keys list

#Delete Wallet
zenrockd keys delete wallet

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

### VALIDATOR MANAGEMENT

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

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

#Make file validator.json
tee $HOME/.zrchain/validator.json > /dev/null << EOF
{
    "pubkey": YOUR_PUBKEY,
    "amount": "1000000urock",
    "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
zenrockd --home $HOME/.zrchain tx staking create-validator $HOME/.zrchain/validator.json --from wallet --chain-id $XENROCK_CHAIN_ID --gas 220000 --gas-prices 1urock

#Unjail Validator
zenrockd tx slashing unjail --from wallet --chain-id $XENROCK_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1urock 

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

### TOKEN MANAGEMENT

```bash
#Withdraw Rewards
zenrockd tx distribution withdraw-all-rewards --from wallet --chain-id $XENROCK_CHAIN_ID --gas-adjustment 1.5 --gas auto --gas-prices 1urock 

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

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

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

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

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

### GOVERNANCE

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

#List all proposals
zenrockd query gov proposals

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

### SERVICES MANAGEMENT

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

# Enable Service
sudo systemctl enable zenrockd

# Disable Service
sudo systemctl disable zenrockd

# Start Service
sudo systemctl start zenrockd

# Stop Service
sudo systemctl stop zenrockd

# Restart Service
sudo systemctl restart zenrockd

# Check Service Status
sudo systemctl status zenrockd

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

### UTILITY

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

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

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

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

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

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


---

# 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/zenrock/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.
