sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev libleveldb-dev jq build-essential bsdmainutils git make ncdu htop screen unzip bc lz4 gcc -y
cd $HOME && \
ver="{{goVersion}}" && \
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \
sudo rm -rf /usr/local/go && \
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \
rm "go$ver.linux-amd64.tar.gz" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version
The output should be: go version go{{goVersion}} linux/amd64
git clone {{binaryUrl}}
cd story
git checkout {{nodeVersion}}
go build -o story ./client
mv $HOME/story/story $HOME/go/bin/
story version
The output should be: Version {{nodeVersion}}
cd $HOME
wget -O geth https://github.com/piplabs/story-geth/releases/download/v0.11.0/geth-linux-amd64
chmod +x $HOME/geth
mv $HOME/geth ~/go/bin/
echo 'export {{chainName}}_moniker="Node_name"' >> $HOME/.profile
echo 'export {{chainName}}_port="111"' >> $HOME/.profile
source $HOME/.profile
{{appName}} init ${{chainName}}_moniker --network odyssey
cd $HOME
wget -O genesis.json "https://snapshots.stakeup.tech/{{chainName}}/genesis.json" --inet4-only
mv genesis.json ~/.{{dirName}}/config
peers={{peersChain}} && \
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.{{dirName}}/config/config.toml && \
seeds="6b0ffcce9b59b91ceb8eea5d4599e27707e3604a@seeds.stakeup.tech:10217" && \
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.{{dirName}}/config/config.toml
cd $HOME/.{{dirName}}/config && \
indexer="null" && \
snapshot_interval="1000" && \
pruning="default" && \
sed -i.bak -e "s/^indexer *=.*/indexer = \"$indexer\"/" config.toml && \
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" story.toml && \
sed -i.bak -e "s/^pruning *=.*/pruning = \"$pruning\"/" story.toml
cd $HOME/.{{dirName}}/config && \
sed -i.bak \
-e "s/:\s*26656/:${{{chainName}}_port}56/g" \
-e "s/:\s*26657/:${{{chainName}}_port}57/g" \
-e "s/:\s*26658/:${{{chainName}}_port}58/g" \
-e "s/:\s*26660/:${{{chainName}}_port}59/g" \
config.toml
sed -i.bak \
-e "s/:\s*1317/:${{{chainName}}_port}17/g" \
-e "s/:\s*8551/:${{{chainName}}_port}51/g" \
story.toml
sudo tee /etc/systemd/system/{{appName}}-geth.service > /dev/null <<EOF
[Unit]
Description={{chainName}}-geth
After=network-online.target
[Service]
User=$USER
ExecStart=$(which geth) --odyssey --syncmode full --http --http.api eth,net,web3,engine --http.vhosts '*' --http.addr 0.0.0.0 --http.port ${{{chainName}}_port}45 --authrpc.port ${{{chainName}}_port}51 --ws --ws.api eth,web3,net,txpool --ws.addr 0.0.0.0 --ws.port ${{{chainName}}_port}46
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload &&
sudo systemctl enable {{appName}}-geth &&
sudo systemctl restart {{appName}}-geth && sudo journalctl -u {{appName}}-geth -f -o cat
sudo tee /etc/systemd/system/{{appName}}.service > /dev/null <<EOF
[Unit]
Description={{chainName}}
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.story/story
ExecStart=$(which {{appName}}) run
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload &&
sudo systemctl enable {{appName}} &&
sudo systemctl restart {{appName}} && sudo journalctl -u {{appName}} -f -o cat