# Useful commands

## 🖊️Working with your wallet

* **Add New Key**

```
starsd keys add wallet
```

* **Recover Existing Key**

```
starsd keys add wallet --recover
```

* **Query Wallet Balance**

```
starsd q bank balances $(starsd keys show wallet -a)
```

* **List All Keys**

```
starsd keys list
```

* **Delete Key**

```
starsd keys delete wallet
```

* **Export Key to a File**

```
starsd keys export wallet
```

* **Import Key from a File**

```
starsd keys import wallet wallet.backup
```

***

## 🔧Service

* **Info**

```
starsd status 2>&1 | jq .NodeInfo
starsd status 2>&1 | jq .SyncInfo
starsd status 2>&1 | jq .ValidatorInfo
```

* **Check Node Logs**

```
sudo journalctl -fu starsd -o cat
```

* **Check Service Status**

```
sudo systemctl status starsd
```

* **Restart Service**

```
sudo systemctl restart starsd
```

* **Stop Service**

```
sudo systemctl stop starsd
```

* **Start Service**

```
sudo systemctl start starsd
```

* **Reload, Disable, Enable**

```
sudo systemctl daemon-reload
sudo systemctl disable starsd
sudo systemctl enable starsd
```

* **Your Peer**

```
echo $(starsd tendermint show-node-id)'@'$(wget -qO- eth0.me)':'$(cat $HOME/.starsd/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')
```

***

## 🔗Validator Management🔗

* **Create New Validator**

```
starsd tx staking create-validator \
  --amount 1000000ustars \
  --from <walletName> \
  --commission-max-change-rate "0.01" \
  --commission-max-rate "0.20" \
  --commission-rate "0.05" \
  --min-self-delegation "1" \
  --pubkey $(starsd tendermint show-validator) \
  --moniker <YOUR_MONIKER_NAME> \
  --chain-id stargaze-1 \
  --identity="<YOUR_KEYBASE_ID>" \
  --details="<YOUR_DETAILS>" \
  --website="<YOUR_WEBSITE_URL>" \
  --fees 200000ustars \
  --gas-adjustment 1.5 \
  -y
```

* **Edit Validator**

```
starsd tx staking edit-validator \
  --new-moniker "YOUR_MONIKER_NAME" \
  --identity "YOUR_KEYBASE_ID" \
  --details "YOUR_DETAILS" \
  --website "YOUR_WEBSITE_URL" \
  --security-contact "Your_Email" \
  --chain-id stargaze-1 \
  --commission-rate 0.05 \
  --from <walletName> \
  --gas 350000 -y
```

* **Jail Info**

```
starsd query slashing signing-info $(starsd tendermint show-validator)
```

* **Unjail**

```
starsd tx slashing unjail --from Wallet_name --chain-id stargaze-1 --gas 350000 --fees "7000"ustars -y
```

* **Active Validators List**

```
starsd q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
```

* **Inactive Validators List**

```
starsd q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
```

* **View Validator Details**

```
starsd q staking validator $(starsd keys show wallet --bech val -a)
```

***

## 🔈Governance <a href="#governance" id="governance"></a>

* **List All Proposals**

```
starsd query gov proposals
```

* **View Specific Proposal**

```
starsd query gov proposal 1
```

* **Vote Yes**

```
starsd tx gov vote 1 yes --from Wallet_Name --gas 350000 --fees "350000"ustars --chain-id=stargaze-1 -y
```

* **Vote Тo**

```
starsd tx gov vote 1 no --from Wallet_Name --gas 350000 --fees "350000"ustars --chain-id=stargaze-1 -y
```

* **Vote Abstain**

```
starsd tx gov vote 1 abstain --from Wallet_Name --gas 350000 --fees "350000"ustars --chain-id=stargaze-1 -y
```

**Vote no\_with\_veto**

```
starsd tx gov vote 1 no_with_veto --from Wallet_Name --gas 350000 --fees "350000"ustars --chain-id=stargaze-1 -y
```

***

## ⚙️Token management <a href="#token-management" id="token-management"></a>

* **Withdraw all rewards from all validators:**

```
starsd tx distribution withdraw-all-rewards --from Wallet_Name --chain-id stargaze-1 --gas 350000 --fees "7000"ustars -y
```

* **Withdraw rewards and commission from your Validator:**

```
starsd tx distribution withdraw-rewards valoper1amxp0k0hg4edrxg85v07t9ka2tfuhamhldgf8e --from Wallet_Name --gas 350000 --fees "7000"ustars --chain-id stargaze-1 --commission -y
```

* **Delegate tokens to your validator**

```
starsd tx staking delegate Your_valoper_address "100000000"ustars --from Wallet_Name --gas 350000 --fees "7000"ustars --chain-id stargaze-1 -y
```

* **Delegate tokens to different validator**

```
starsd tx staking delegate valoper_address "100000000"ustars --from Wallet_Name --gas 350000 --fees "7000"ustars --chain-id stargaze-1 -y
```

* **Redelegate tokens to another validator**

```
starsd tx staking redelegate Your_valoper_address valoper_address "100000000"ustars --from Wallet_Name --gas 350000 --fees "7000"ustars --chain-id stargaze-1 -y
```

* **Unbond tokens from your validator**

```
starsd tx staking unbond Your_valoper_address "100000000"ustars --from Wallet_Name --gas 350000 --fees "7000"ustars --chain-id stargaze-1 -y
```

* **Send tokens to the wallet**

```
starsd tx bank send Your_wallet_address recipient_wallet_address "1000000000000000000"ustars --gas 350000 --fees "7000"ustars --chain-id stargaze-1 -y
```

**Notes:**

* Replace `Wallet_Name` with the name of your wallet.
* Replace `Your_valoper_address` and `valoper_address` with the respective validator addresses.
* Replace `Your_wallet_address` and `recipient_wallet_address` with the respective wallet addresses.
* Ensure you have sufficient `ustars` tokens to cover the fees and the amounts you intend to send.
* The `--gas` parameter specifies the maximum gas units to use for the transaction. Adjust this value if necessary.
* The `--fees` parameter specifies the fee amount in `ustars`. Ensure you have enough tokens to cover the fees.
* The `-y` flag automatically confirms the transaction without prompting for confirmation.

For more detailed information, refer to the [Stargaze documentation](https://docs.stargaze.zone/tokenomics/stars-token).

*Please exercise caution when performing transactions and ensure you have backed up your wallet information securely.*


---

# 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://service.block-pro.net/mainnet/stargaze/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.
