Install dependencies
Update system and install build tools
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Install Go
cd $HOME
VER="1.22.3"
sudo rm -rf /usr/local/go
wget https://golang.org/dl/go$VER.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go$VER.linux-amd64.tar.gz
rm go$VER.linux-amd64.tar.gz
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
Download execution client binary
cd $HOME/story-binary
wget -O geth-story https://github.com/piplabs/story-geth/releases/download/v0.10.0/geth-linux-amd64
chmod +x geth-story
cp geth-story $HOME/go/bin/
which geth-story
geth-story version
Download consensus client binary
wget -O story https://github.com/piplabs/story/releases/download/v0.12.1/story-linux-amd64
chmod +x story
cp story $HOME/go/bin/
which story
story version
Initialize Story app
story init --moniker test --network odyssey
Set seed
sed -i -e "s|^seeds *=.*|seeds = \"87783003e27b0143ee3014febceafbf35808e647@story-testnet-rpc.tienthuattoan.com:30656\"|" $HOME/.story/story/config/config.toml
Download genesis and addrbook
wget -O $HOME/.story/story/config/genesis.json https://snapshots.tienthuattoan.com/testnet/story/genesis.json
wget -O $HOME/.story/story/config/addrbook.json https://snapshots.tienthuattoan.com/testnet/story/addrbook.json
Enable Prometheus and disable indexing
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.story/story/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.story/story/config/config.toml
Create Geth service
sudo tee /etc/systemd/system/story-geth.service > /dev/null << EOF
[Unit]
Description=Story Execution Client service
After=network-online.target
[Service]
User=$USER
ExecStart=/root/go/bin/geth-story --odyssey --syncmode full
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Create Story service
sudo tee /etc/systemd/system/story.service > /dev/null << EOF
[Unit]
Description=Story Consensus Client service
After=network-online.target
[Service]
User=$USER
ExecStart=/root/go/bin/story run
Restart=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Enable and start geth, story
sudo systemctl daemon-reload
sudo systemctl enable story story-geth
sudo systemctl restart story story-geth
Download and restore snapshots
# Backup priv_validator_state.json
cp $HOME/.story/story/data/priv_validator_state.json $HOME/.story/story/priv_validator_state.json.backup
# Remove old data, download Story snapshot and unpack it
rm -rf $HOME/.story/story/data
wget -O story_testnet.tar.lz4 https://snapshots.tienthuattoan.com/testnet/story/story_latest.tar.lz4
# Decompress the snapshot
lz4 -c -d story_testnet.tar.lz4 | tar -x -C $HOME/.story/story
# Restore priv_validator_state.json
mv $HOME/.story/story/priv_validator_state.json.backup $HOME/.story/story/data/priv_validator_state.json
# Delete Geth data and unpack it
rm -rf $HOME/.story/geth/odyssey/geth/chaindata
mkdir -p $HOME/.story/geth/odyssey/geth
# Download the Geth snapshot
wget -O story_geth_testnet.tar.lz4 https://snapshots.tienthuattoan.com/testnet/story/story_geth_testnet.tar.lz4
# Decompress the Geth snapshot
lz4 -c -d story_geth_testnet.tar.lz4 | tar -x -C $HOME/.story/geth/odyssey/geth
# Enable and start services
sudo systemctl daemon-reload
sudo systemctl enable story story-geth
sudo systemctl restart story story-geth
Check logs
journalctl -u story -u story-geth -f