# 📜  Useful Commands

### *Service operations* <a href="#service-operations" id="service-operations"></a>

Check logs

```bash
sudo journalctl -u story -f
```

Start service

```bash
sudo systemctl start story
```

Stop service

```bash
sudo systemctl stop story
```

Restart service

```bash
sudo systemctl restart story
```

Check service status

```bash
sudo systemctl status story
```

Reload services

```bash
sudo systemctl daemon-reload
```

Enable Service

```bash
sudo systemctl enable story
```

Disable Service

```bash
sudo systemctl disable story
```

Node info

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

Your node peer

```bash
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

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

### *Staking* <a href="#staking" id="staking"></a>

Delegate to yourself

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

Delegate

```bash
story validator stake --chain-id 1315 --validator-pubkey <VALIDATOR_PUB_KEY_IN_HEX> --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

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

Add operator

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

Unstake from yourself

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

Unstake

```bash
story validator unstake --chain-id 1315 --validator-pubkey <VALIDATOR_PUB_KEY_IN_HEX> --unstake 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.

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

Remove operator

```bash
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

```bash
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}')
```

### *Validator operations* <a href="#validator-operations" id="validator-operations"></a>

Validator info

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

Check Validator public key

```bash
story validator export
```

Check Validator private key

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

### *Geth commands* <a href="#geth-commands" id="geth-commands"></a>

Check the latest block

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

Peers your client is connected to

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

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

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

Check gas price

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

Check account balance

```bash
geth --exec "eth.getBalance('<YOUR_EVM_ADDRESS>')" attach ~/.story/geth/aeneid/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://services.validexis.com/testnets/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.
