Story Node Binary Update & Fine-tune (EP6)

TL;DR:

Story Node Binary Update & Fine-tune (EP6)

TL;DR:

  • Story Binary update
  • Turn client to run in the background as a service
  • story endpoint details

Hey there! The new Story Protocol binary update is out, enhancing network performance and storage management. Here’s how to update your binary, run your clients as background services, and use the Story Protocol endpoints effectively.

1. Update Story Binary

Since the update is released for Story client only, we will focus the story client. I will also stop geth client since the new block height will not be sync if story client is not running. Also, I want to turn both them to service in the step 2.

1.1 Check current version

# change to your path where you store binary 
cd story_bin/story_client 
 
./story  version

You should expected something like this:

If you get 0.9.12, you don’t need to do anything. if not, continue.

1.2 Stop the client

Since I run the Story directly via command line, I just press Ctrl+C. However, if you run it as a service, you can stop them using command below.

# replace "story-consensus" name with your story sevice name.   
sudo systemctl stop story-consensus 
 
# replace "story-execution-geth" name with your geth service name 
sudo systemctl stop story-execution-geth

1.3 Download and Execute the New Binary

Since I used the compiled library from the release page instead of building from the source, I will simply download the new version and replace the old one.

If you plan to modify or add something before compiling, you should install Git, check out the source code, make your changes, and then compile it. To compile, you will need Go.

For me, I use this command:

#navigate to your story binary 
cd $HOME/story_bin 
 
#Download binary 
wget https://story-geth-binaries.s3.us-west-1.amazonaws.com/story-public/story-linux-amd64-0.9.12-9ae4a63.tar.gz -O story.tar.gz 
 
#extract - This will extract the new  story file into existing story_client directory  
tar zxvf story.tar.gz --strip-components=1 -C story_client 
 
#make it executable 
chmod +x story

Check version:

./story version

Actually, after making it executable, you should be able to run it, and it will work perfectly. However, I want to turn both into background services so they are easier to manage and control.

2. Configure Clients as Background Services

To make life easier, we’ll configure both the consensus (geth) and execution (story) clients to run in the background as services. This means they’ll automatically start up whenever your server does.

2.1 Create a Service File for Each Client

Let’s create a service file for each client in /etc/systemd/system/

For Story Client:

sudo nano /etc/systemd/system/story-consensus.service

Paste the following:

[Unit] 
Description=Story Consensus Client 
After=network.target 
 
[Service] 
WorkingDirectory=/home/huicom/story_bin/story_client 
ExecStart=/home/huicom/story_bin/story_client/story run 
Restart=always 
User=huicom 
LimitNOFILE=4096 
 
[Install] 
WantedBy=multi-user.target

Note 1: Replace User=huicom with your Linux username in both service files.
Note 2: ExecStart specifies the path, binary, and parameters for execution.

For geth Client:

sudo nano /etc/systemd/system/story-execution-geth.service

Paste the following:

[Unit] 
Description=Story Geth Client 
After=network.target 
 
[Service] 
ExecStart=/home/huicom/story_bin/geth_client/geth --iliad --syncmode full 
Restart=always 
User=huicom 
LimitNOFILE=4096 
 
[Install] 
WantedBy=multi-user.target

Note 1: Replace User=huicom with your Linux username in both service files.
Note 2: ExecStart specifies the path, binary, and parameters for execution.

2.2 Enable and Start Both Services

Enable both services so they start on reboot:

sudo systemctl enable story-consensus 
sudo systemctl enable story-execution-geth

2.3 Start the services now

sudo systemctl start story-consensus 
sudo systemctl start story-execution-geth

After you start both, you story clients should be run properly.

2.4 see log

#story 
journalctl -u story-consensus.service -f 
 
#geth 
journalctl -u story-execution-geth.service -f

3. Bonus: Story Protocol Endpoints

You don’t need to run all of these commands to get the client working. Here’s a comprehensive list of story client endpoints and commands that you can use to interact with your Story node. These will help you manage your node, check block heights, and interact with blockchain data:

# Get Node Status: 
# Provides general information about the node status, including syncing state, block height, and validator status. 
curl -s http://127.0.0.1:26657/status | jq 
 
# Get Consensus State: 
# Returns the current state of the consensus process, such as round state, validators, and proposals. 
curl -s http://127.0.0.1:26657/consensus_state | jq 
 
# Get Validators: 
# Fetches the list of current validators participating in the consensus. 
curl -s http://127.0.0.1:26657/validators | jq 
 
# Get Blockchain Info: 
# Returns information about the blockchain from a specific block height range. 
# Replace <minHeight> and <maxHeight> with the desired block heights. 
curl -s "http://127.0.0.1:26657/blockchain?minHeight=<minHeight>&maxHeight=<maxHeight>" | jq 
 
# Get Block by Height: 
# Retrieves information about a specific block by height. Replace <height> with the block height. 
curl -s "http://127.0.0.1:26657/block?height=<height>" | jq 
 
# Get Latest Block: 
# Fetches the latest block information. 
curl -s http://127.0.0.1:26657/block | jq 
 
 
# Get Node Network Info: 
# Provides information about the network state, including peers and connections. 
curl -s http://127.0.0.1:26657/net_info | jq 
 
# Get Consensus Parameters: 
# Returns the current consensus parameters, such as block size and evidence parameters. 
curl -s http://127.0.0.1:26657/consensus_params | jq 
 
# Get Genesis File: 
# Retrieves the genesis file that defines the initial state of the blockchain. 
curl -s http://127.0.0.1:26657/genesis | jq

That’s it! Follow these steps to keep your Story node updated and running smoothly. If you have any questions or need further assistance, feel free to reach out. Happy node running!