Story Protocol Installation Guide
This guide provides step-by-step instructions for installing a Story Protocol node on your system. Before you begin, ensure you have the necessary prerequisites.
Prerequisites
- Operating System: Linux (Ubuntu/Debian recommended) or macOS
- Go: Version 1.18 or higher
- Git: For cloning the repository
- Terminal: Access to a command-line interface
Hardware Requirement
Ensure your system meets the following hardware requirements to run the Story Protocol node efficiently:
- CPU: 4 cores or more
- RAM: 8 GB or more
- Disk Space: 200 GB SSD or more
- Network: Broadband internet connection with at least 1 Mbps upload/download speed
Installation
1. Setup prerequisites
sudo apt update -q
sudo apt install -y -qq make unzip clang pkg-config lz4 libssl-dev build-essential git jq ncdu bsdmainutils htop aria2 pv
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | head -n1)
wget "https://dl.google.com/go/${GO_VERSION}.linux-amd64.tar.gz"
sudo tar -C /usr/local -xzf "${GO_VERSION}.linux-amd64.tar.gz"
rm "${GO_VERSION}.linux-amd64.tar.gz"
echo "export GOROOT=/usr/local/go" | tee -a ~/.profile
echo "export GOPATH=\$HOME/go" | tee -a ~/.profile
echo "export PATH=\$PATH:/usr/local/go/bin:\$HOME/go/bin" | tee -a ~/.profile
source ~/.profile
2. Install Story & Geth
OS_TYPE=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH_TYPE=$(uname -m)
ARCH_TYPE=$(echo $ARCH_TYPE | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
STORY_NAME="story-${OS_TYPE}-${ARCH_TYPE}"
STORY_DOWNLOAD_URL="https://github.com/piplabs/story/releases/download/v0.12.1/${STORY_NAME}"
wget $STORY_DOWNLOAD_URL
sudo chmod +x $STORY_NAME
sudo mv $STORY_NAME /usr/local/bin/story
OS_TYPE=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH_TYPE=$(uname -m)
ARCH_TYPE=$(echo $ARCH_TYPE | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
GETH_NAME="geth-${OS_TYPE}-${ARCH_TYPE}"
GETH_DOWNLOAD_URL="https://github.com/piplabs/story-geth/releases/download/v0.10.1/${GETH_NAME}"
wget $GETH_DOWNLOAD_URL
sudo chmod +x $GETH_NAME
sudo mv $GETH_NAME /usr/local/bin/story-geth
Verify the installation by checking the version
story version
story-geth version
3. Configure the Node
Use story init
to set up your node for the Odyssey testnet. Replace 'Your Node Name'
with a unique identifier.
CHAIN_ID='odyssey'
MONIKER='Your Node Name'
DAEMON_HOME=$HOME/.story/story
story init --network $CHAIN_ID --moniker $MONIKER --home $DAEMON_HOME
4. Install and Initialize Cosmovisor
Download the Cosmovisor binary using the go install
command
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
cosmovisor version
Initialize Cosmovisor
DAEMON_NAME=story DAEMON_HOME=$HOME/.story/story cosmovisor init $(which story)
5. Create Service
To ensure that the Story and Geth processes run continuously and restart automatically on failure, you can create a systemd service. This will help manage the lifecycle of the processes and ensure they start on boot.
Create a new systemd service file for Story:
sudo tee /etc/systemd/system/story.service >/dev/null <<EOF
[Unit]
Description=Cosmovisor Story Node
After=network-online.target
[Service]
User=$USER
Type=simple
WorkingDirectory=$HOME/.story/story
ExecStart=$(which cosmovisor) run run --home $HOME/.story/story
Restart=on-failure
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
Environment="DAEMON_NAME=story"
Environment="DAEMON_HOME=$HOME/.story/story"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=$PATH"
[Install]
WantedBy=multi-user.target
EOF
Create a new systemd service file for Geth:
sudo tee /etc/systemd/system/story-geth.service >/dev/null <<EOF
[Unit]
Description=Story execution daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which story-geth) --odyssey --syncmode full --datadir $HOME/.story/geth/odyssey --http --http.addr 127.0.0.1 --http.port 8545 --ws --ws.addr 127.0.0.1 --ws.port 8546 --http.vhosts=*
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
Environment="PATH=$PATH"
[Install]
WantedBy=multi-user.target
Now apply the service configuration and start the services
sudo systemctl enable story.service
sudo systemctl enable story-geth.service
sudo systemctl restart story.service
sudo systemctl restart story-geth.service
To check the logs for the story service, use the following command:
sudo journalctl -fu story -o cat
To view the logs for the geth service, use the following command:
sudo journalctl -fu story-geth -o cat
6. Applying Peers
To enhance network synchronization, we recommend applying our peers by following the steps below, or you can change the RPC URL to your own desired RPC URL:
PERSISTENT_PEERS=$(curl "https://scan.aldebaranode.xyz/api/scan/peers?rpc_url=https://rpc-story-testnet.aldebaranode.xyz" | jq -r 'flatten | join(",")')
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PERSISTENT_PEERS\"/" $HOME/.story/story/config/config.toml
7. Applying Snapshot
To apply a snapshot for faster synchronization, follow the steps below:
Download snapshot
STORY_SNAPSHOT_URL="https://snapshots.aldebaranode.xyz/story/default/story.tar.lz4"
STORY_GETH_SNAPSHOT_URL="https://snapshots.aldebaranode.xyz/story/default/geth.tar.lz4"
(echo $STORY_SNAPSHOT_URL; echo $STORY_GETH_SNAPSHOT_URL) | aria2c -x 16 -s 16 -k 1M -i -
Stop Service
sudo systemctl stop story
sudo systemctl stop story-geth
Backup Files
cp $HOME/.story/story/data/priv_validator_state.json $HOME/.story/priv_validator_state.json.backup
Remove Old Data
rm -rf $HOME/.story/story/data
rm -rf $HOME/.story/geth/odyssey/geth/chaindata
Extract Snapshot
mkdir -p $HOME/.story/story/data
mkdir -p $HOME/.story/geth/odyssey/geth/chaindata
lz4 -d -c story.tar.lz4 | pv | sudo tar xv -C $HOME/.story/story/ > /dev/null
lz4 -d -c geth.tar.lz4 | pv | sudo tar xv -C $HOME/.story/geth/odyssey/geth/ > /dev/null
Restore Files
cp $HOME/.story/priv_validator_state.json.backup $HOME/.story/story/data/priv_validator_state.json
Start Service
sudo systemctl start story
sudo systemctl start story-geth