> For the complete documentation index, see [llms.txt](https://nodersua.gitbook.io/about-nodersua/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nodersua.gitbook.io/about-nodersua/archive/ojo/useful-commands.md).

# Useful Commands

***Information***

```bash
# Check the blocks
ojod status 2>&1 | jq ."SyncInfo"."latest_block_height"
```

```bash
# Check logs
journalctl -u ojod -f -o cat
```

```bash
# Check status
ojod status 2>&1 | jq .SyncInfo
```

```bash
# Check balance
ojod q bank balances $WALLET_OJO
```

```bash
# Check pubkey of validator
ojod tendermint show-validator
```

```bash
# Check validator
ojod q staking validator $VALOPER_OJO
dymd q staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker="$MONIKER_OJO")' | jq
```

```bash
# Check information of TX_HASH
ojod q tx <TX_HASH>
```

```bash
# Check how many blocks were passed by the validator and from which block the asset
ojod q slashing signing-info $(ojod tendermint show-validator)
```

***Transactions***

```bash
# Collect rewards from all validators delegated to them (without commission)
ojod tx distribution withdraw-all-rewards --from <name_wallet> --fees 5000uojo -y
```

```bash
# Collect rewards from a separate validator or rewards + commission from your own validator
ojod tx distribution withdraw-rewards ${VALOPER_OJO} --from <name_wallet> --fees 5000uojo --commission -y
```

```bash
# Delegate yourself (this is how 1 coin is sent)
ojod tx staking delegate ${VALOPER_OJO} 1000000uojo --from <name_wallet> --fees 5000uojo -y
```

```bash
# Redelegate to other validator
ojod tx staking redelegate <src-validator-addr> <dst-validator-addr> 1000000uojo --from <name_wallet> --fees 5000uojo -y
```

```bash
# Unbond 
ojod tx staking unbond ${VALOPER_OJO} 1000000uojo --from <name_wallet> --fees 5000uojo -y
```

```bash
# Send tokens to other adress
ojod tx bank send <name_wallet> <address> 1000000uojo --fees 5000uojo -y
```

```bash
# Unjail
ojod tx slashing unjail --from <name_wallet> --fees 5000uojo -y
```

! If the transactions are not sent with the error account sequence mismatch, expected 18, got 17: incorrect account sequence, then add the flag -s 18 to the command (replace the number with the one that is waiting for the sequence)

***Work with wallets***

```bash
# Chech the wallets list
ojod keys list
```

```bash
# Delete wallet
ojod keys delete <name_wallet>
```

***Delete Node***

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

***Governance***

```bash
# List proposals
ojod q gov proposals
```

```bash
# Check voting result
ojod q gov proposals --voter $VALOPER_OJO
```

```bash
# Vote
ojod tx gov vote 1 yes --from $WALLET_OJO
```

```bash
# Make Deposit for proposal
ojod tx gov deposit 1 1000000uojo --from $WALLET_OJO
```

***Peers and RPC***

```bash
FOLDER=.ojo

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

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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://nodersua.gitbook.io/about-nodersua/archive/ojo/useful-commands.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
