# Useful commands

## Information

```
# check the blocks
quasarnoded status 2>&1 | jq ."SyncInfo"."latest_block_height"

# check the logs
journalctl -u quasarnoded -f -o cat

# check status
curl localhost:26657/status

# check balance
quasarnoded q bank balances <address>

# check the validator pubkey
quasarnoded tendermint show-validator

# check the validator
quasarnoded query staking validator <valoper_address>
quasarnoded query staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker=="<name_moniker>")' | jq

# check TX_HASH information
quasarnoded query tx <TX_HASH>

# network parameters
quasarnoded q staking params
quasarnoded q slashing params

# check how many blocks are missed by the validator and from which block is active
quasarnoded q slashing signing-info $(nolusd tendermint show-validator)

# find out the validator creation transaction (replace your valoper_address)
quasarnoded query txs --events='create_validator.validator=<your_valoper_address>' -o=json | jq .txs[0].txhash -r

# view active set
quasarnoded q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl

# view inactive set
quasarnoded q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl
```

## Transactions

```
# collect rewards from all validators to whom delegated (no commission)
quasarnoded tx distribution withdraw-all-rewards --from <name_wallet> --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# collect rewards from a separate validator or rewards + commission from your own validator
quasarnoded tx distribution withdraw-rewards <valoper_address> --from <name_wallet> --commission --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# delegate yourself into the steak some more (so 1 coin is sent)
quasarnoded tx staking delegate <valoper_address> 1000000unls --from <name_wallet> --fees 5000unls -y

# redelegation to another validator
quasarnoded tx staking redelegate <src-validator-addr> <dst-validator-addr> 1000000unls --from <name_wallet> --fees 5000unls -y

# unbond 
quasarnoded tx staking unbond <addr_valoper> 1000000uqsr --from <name_wallet> --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# send coins to another address
quasarnoded tx bank send <name_wallet> <address> 1000000uqsr --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# get out of jail
quasarnoded tx slashing unjail --from <name_wallet> --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y
```

## Working with wallets

```
# display wallet list
quasarnoded keys list

# show account key
quasarnoded keys show <name_wallet> --bech acc

# show validator key
quasarnoded keys show <name_wallet> --bech val

# show consensus key
quasarnoded keys show <name_wallet> --bech cons

# show all supported addresses
quasarnoded debug addr <wallet_addr>

# show private key
quasarnoded keys export <name_wallet> --unarmored-hex --unsafe

# requesting an account
quasarnoded q auth account $(nolusd keys show <name_wallet> -a) -o text

# delete wallet
quasarnoded keys delete <name_wallet>
```

## Delete node

```
sudo systemctl stop quasarnoded && \
sudo systemctl disable quasarnoded && \
rm /etc/systemd/system/quasarnoded.service && \
sudo systemctl daemon-reload && \
cd $HOME && \
rm -rf quasar && \
rm -rf .quasarnode && \
rm -rf $(which quasarnoded)
```

## Governance

```
# list of proposals
quasarnoded q gov proposals

# to see the result of the vote
quasarnoded q gov proposals --voter <ADDRESS>

# vote in favor of the proposal
quasarnoded tx gov vote 1 yes --from <name_wallet> --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# make a deposit on the proposal
quasarnoded tx gov deposit 1 1000000uqsr --from <name_wallet> --chain-id quasar-test-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y

# create a proposal
quasarnoded tx gov submit-proposal --title="Randomly reward" --description="Reward 10 testnet participants who completed more than 3 tasks" --type="Text" --deposit="11000000uqsr" --from=<name_wallet> --chain-id quasar-1 --gas-adjustment 1.4 --gas auto --gas-prices 0.1uqsr -y
```

## Peers and RPC

```
FOLDER=.nolus

# find out your peer
PORTR=$(grep -A 3 "\[p2p\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+") && \
echo $(quasarnoded tendermint show-node-id)@$(curl ifconfig.me)$PORTR

# get the RPC port
echo -e "\033[0;32m$(grep -A 3 "\[rpc\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+")\033[0m"

# check the number of peers
PORT=
curl -s http://localhost:$PORT/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr | split(":")[2])"' | wc -l

# moniker list of connected peers
curl -s http://localhost:$PORT/net_info | jq '.result.peers[].node_info.moniker'

# Check prevotes/precommits. Useful for updates
curl -s localhost:$PORT/consensus_state | jq '.result.round_state.height_vote_set[0].prevotes_bit_array' && \
curl -s localhost:$PORT/consensus_state | jq '.result.round_state.height_vote_set[0].precommits_bit_array'

# check prevote of your validator
curl -s localhost:$PORT/consensus_state -s | grep $(curl -s localhost:26657/status | jq -r .result.validator_info.address[:12])
```


---

# 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/testnet/quasar/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.
