# Useful commands

## Information

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

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

# check status
curl localhost:26657/status

# check balance
lavad q bank balances <address>

# check the validator pubkey
lavad tendermint show-validator

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

# check TX_HASH information
lavad query tx <TX_HASH>

# network parameters
lavad q staking params
lavad q slashing params

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

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

# view active set
lavad 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
lavad 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)
lavad tx distribution withdraw-all-rewards --from <name_wallet> --chain-id lava-testnet-2 --gas 350000 --fees "7000"ulava   -y

# collect rewards from a separate validator or rewards + commission from your own validator
lavad  tx distribution withdraw-rewards <valoper_address> --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 --commission -y

# delegate yourself into the steak some more (so 1 coin is sent)
lavad tx staking delegate <valoper_address> "100000000"ulava --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# redelegation to another validator
lavad tx staking redelegate <src-validator-addr> <dst-validator-addr> "100000000"ulava --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# unbond 
lavad tx staking unbond <addr_valoper> "100000000"ulava --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# send coins to another address
lavad tx bank send <name_wallet> <address> "100000000"ulava --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# get out of jail
lavad tx slashing unjail --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y
```

## Working with wallets

```
# display wallet list
lavad keys list

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

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

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

# show all supported addresses
lavad debug addr <wallet_addr>

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

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

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

## Delete node

```
sudo systemctl stop lavad
sudo systemctl disable lavad
rm /etc/systemd/system/lavad.service
sudo systemctl daemon-reload
cd $HOME
rm -rf GHFkqmTzpdNLDd6T
rm -rf .lava
rm -rf $(which lavad)
```

## Governance

```
# list of proposals
lavad q gov proposals

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

# vote in favor of the proposal
lavad tx gov vote 1 yes --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# make a deposit on the proposal
lavad tx gov deposit 1 1000000ulava --from <name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y

# create a proposal
lavad tx gov submit-proposal --title="Randomly reward" --description="Reward 10 testnet participants who completed more than 3 tasks" --type="Text" --deposit="11000000ulava" --from=<name_wallet> --gas 350000 --fees "7000"ulava --chain-id=lava-testnet-2 -y
```


---

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