Loading

๐Ÿ“š Node installation

Update packages

sudo apt update && sudo apt upgrade -y

Install dependencies

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

Install Go

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

Download binary for work

git clone {{binaryUrl}}
cd {{dirName}}
git checkout {{nodeVersion}}
make install

Specify variables, for ease of work

echo 'export {{chainName}}_moniker="Validator_name"' >> $HOME/.profile
echo 'export {{chainName}}_wallet="Wallet_name"' >> $HOME/.profile
echo 'export {{chainName}}_port="111"' >> $HOME/.profile
source $HOME/.profile

Initialize the node

{{appName}} init ${{chainName}}_moniker --chain-id {{chainId}}

Set the settings

{{appName}} config chain-id {{chainId}} && \
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

Create wallet

{{appName}} keys add ${{chainName}}_wallet

Save the wallet. Or restore if there is a mnemonic:

{{appName}} keys add ${{chainName}}_wallet --recover

Download Genesis

wget -O genesis.json "https://snapshots.stakeup.tech/{{chainName}}/genesis.json" --inet4-only
mv genesis.json ~/.{{dirName}}/config

Optional Settings

Memory optimization
cd $HOME/.{{dirName}}/config && \
indexer="null" && \
snapshot_interval="0" && \
pruning="custom" && \
pruning_keep_recent="1000" && \
pruning_interval="50" && \
sed -i.bak -e "s/^indexer *=.*/indexer = \"$indexer\"/" config.toml && \
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" app.toml && \
sed -i.bak -e "s/^pruning *=.*/pruning = \"$pruning\"/" app.toml && \
sed -i.bak -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" app.toml && \
sed -i.bak -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" app.toml
Change port
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" \
    -e "s/:\s*6060/:${{{chainName}}_port}61/g" \
    config.toml

sed -i.bak \
    -e "s/:\s*1317/:${{{chainName}}_port}17/g" \
    -e "s/:\s*8080/:${{{chainName}}_port}80/g" \
    -e "s/:\s*9090/:${{{chainName}}_port}90/g" \
    -e "s/:\s*9091/:${{{chainName}}_port}91/g" \
    app.toml && \
echo 'export {{chainName}}_node=http://localhost:${{{chainName}}_port}52' >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
{{appName}} config node ${{chainName}}_node

Create a service file

sudo tee /etc/systemd/system/{{appName}}.service > /dev/null <<EOF
[Unit]
Description={{chainName}}
After=network-online.target

[Service]
User=$USER
ExecStart=$(which {{appName}}) start
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