# Useful commands

## 🔧Service🔧

**Info**

```
curl -s http://localhost:26657/status | jq
curl -s http://localhost:26657/status | jq .result.sync_info
```

**Check node logs**

```
sudo journalctl -fu story-geth -o cat
sudo journalctl -fu story -o cat
```

**Check service status**

```
sudo systemctl status story
```

**Restart service**

```
sudo systemctl restart story-geth
sudo systemctl restart story
```

**Stop service**

```
sudo systemctl stop nolusd
```

**Start service**

```
sudo systemctl stop story-geth
sudo systemctl stop story
```

**Reload, disable, enable**

```
sudo systemctl daemon-reload
sudo systemctl disable story
sudo systemctl disable story-geth
sudo systemctl enable story
sudo systemctl enable story-geth
```

**Your node peer**

```
echo "$(curl localhost:$(sed -n '/\[rpc\]/,/laddr/ { /laddr/ {s/.*://; s/".*//; p} }' $HOME/.story/story/config/config.toml)/status | jq -r '.result.node_info.id')@$(wget -qO- eth0.me):$(sed -n '/Address to listen for incoming connection/{n;p;}' $HOME/.story/story/config/config.toml | sed 's/.*://; s/".*//')"
```

**Your enode**

```
geth --exec "admin.nodeInfo.enode" attach ~/.story/geth/odyssey/geth.ipc
```

***

## 🔗Validator Management🔗

**Validator info**

```
curl localhost:$(sed -n '/\[rpc\]/,/laddr/ { /laddr/ {s/.*://; s/".*//; p} }' $HOME/.story/story/config/config.toml)/status | jq
```

**Check Validator public key**

```
story validator export
```

**Check Validator private key**

```
cat $HOME/.story/story/config/private_key.txt
```

***

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

**Add operator**

```
story validator add-operator --operator <OPERATOR_EVM_ADDRESS> --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Unstake from yourself**

```
story validator unstake --validator-pubkey $(story validator export | grep "Compressed Public Key (base64)" | awk '{print $NF}') --unstake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Unstake**

```
story validator unstake --validator-pubkey <VALIDATOR_PUB_KEY_IN_BASE64> --unstake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Delegate to yourself**

```
story validator stake --validator-pubkey $(story validator export | grep "Compressed Public Key (base64)" | awk '{print $NF}') --stake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Delegate**

```
story validator stake --validator-pubkey <VALIDATOR_PUB_KEY_IN_BASE64> --stake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Delegate on behalf of other delegator**

```
story validator stake-on-behalf --validator-pubkey <VALIDATOR_PUB_KEY_IN_BASE64> --delegator-pubkey <DELEGATOR_PUB_KEY_IN_BASE64> --stake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Unstake on behalf of other delegator. To do so, you must be a registered authorized operator for this delegator**

```
story validator unstake-on-behalf --validator-pubkey <VALIDATOR_PUB_KEY_IN_BASE64> --delegator-pubkey <DELEGATOR_PUB_KEY_IN_BASE64> --unstake 1000000000000000000 --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Remove operator**

```
story validator remove-operator --operator <OPERATOR_EVM_ADDRESS> --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

**Set or change withdrawal address**

```
story validator set-withdrawal-address --withdrawal-address <YOUR_EVM_ADDRESS> --private-key $(cat $HOME/.story/story/config/private_key.txt | grep "PRIVATE_KEY" | awk -F'=' '{print $2}')
```

## ⛓️Geth commands⛓️

**Check the latest block**

```
geth --exec "eth.blockNumber" attach ~/.story/geth/odyssey/geth.ipc
```

**Peers your client is connected to**

```
geth --exec "admin.peers" attach ~/.story/geth/odyssey/geth.ipc
```

**Check if syncing is still in progress: will output "true" if geth is syncing**

```
geth --exec "eth.syncing" attach ~/.story/geth/odyssey/geth.ipc
```

**Check gas price**

```
geth --exec "eth.gasPrice" attach ~/.story/geth/odyssey/geth.ipc
```

**Check account balance**

```
geth --exec "eth.getBalance('<YOUR_EVM_ADDRESS>')" attach ~/.story/geth/odyssey/geth.ipc
```


---

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