πŸ’‘ Useful commands

βš™οΈ Service Commands

Check Logs

sudo journalctl -u story -f -o cat

Start service

sudo systemctl start story  

Stop service

sudo systemctl stop story 

Restart service

sudo systmctl restart story 

Check status

sudo systemctl status story 

Enable Service

sudo systemctl enable story 

Reload service

sudo systemctl daemon-reload

Disable service

sudo systemctl disable story 

Check synchronization status

while true; do 
  local_height=$(story status | jq -r .sync_info.latest_block_height)
  network_height=$(curl -s https://rpc.story-testnet.unitynodes.com/status | jq -r '.result.sync_info.latest_block_height')
  blocks_left=$((network_height - local_height))

  echo -e "\033[1;33m[Sync Status]\033[0m \033[1;32mNode Height:\033[0m \033[1;37m$local_height\033[0m | \033[1;32mNetwork Height:\033[0m \033[1;37m$network_height\033[0m | \033[1;32mBlocks Left:\033[0m \033[1;31m$blocks_left\033[0m"

  sleep 5
done

If "Block left - 0" - synchronized

Check the latest block of your validator

story status | jq '.SyncInfo.latest_block_height // .sync_info.latest_block_height'

View the ports used node

ss -tulpn | grep story 

βš™οΈ Key Command

Export EVM private key

story validator export --export-evm-key

βš™οΈ Validator Commands

Create validator

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

After entering the command, you will receive hash transactions, check the status in the explorer if the status is successful - you have created a validator. You can find your validator here: explorer In the Active / Inactive lists.

Validator details

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

Validator private key

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

Validator pubkey

story validator export

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/".*//')"

Enode info

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

βš™οΈ Tokens Commands

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 to another validator

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

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

Add operator

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

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 withdraw 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/iliad/geth.ipc

Peers your client is connected to

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

Check if syncing is still in progress:

will output "true" if geth is syncing

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

Check gas price

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

Check account balance

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

βš™οΈ Utility

Set Custom Port

#CHANGE PORT
STORY_PORT=33
sed -i.bak -e "s%:26658%:${STORY_PORT}658%g;
s%:26657%:${STORY_PORT}657%g;
s%:26656%:${STORY_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${STORY_PORT}656\"%;
s%:26660%:${STORY_PORT}660%g" $HOME/.story/story/config/config.toml

Reset node

story tendermint unsafe-reset-all --home $HOME/.story/story --keep-addr-book

Update server name

 sudo hostnamectl set-hostname server_name

How much SSD use node (currently)

du -sh $HOME/.story

How much RAM use node (currently)

sudo systemctl status story | grep "Memory:"

How much CPU use node (currently)

ps -C story -o %cpu --no-headers | awk '{print $1"% CPU"}'

Delete node

sudo systemctl stop story
sudo systemctl disable story
sudo systemctl stop story-geth
sudo systemctl disable story-geth
sudo rm -rf /etc/systemd/system/story.service
sudo rm -rf /etc/systemd/system/story-geth.service
sudo rm -f $(which story)
sudo rm -f $(which geth)
sudo rm -rf $HOME/.story
sudo rm -rf $HOME/story

Last updated