November 21, 2022

Installation instructions for OKP4 nodes , okp4-nemeton-1 test network

minimum recommended hardware configuration :

  • 2 cores (modern CPU's)
  • 8Gb of RAM
  • 200Gb of disk space
  • 10Mbps permanent internet connection

updating the server:

sudo apt update && sudo apt upgrade -y

install the necessary utilities:

sudo apt install curl build-essential git wget jq make gcc tmux chrony -y

specify the name of your validator, which will be visible in the explorer:

NODENAME=<NAME_VALIDATOR>

saving and importing variables :

echo "export NODENAME=$NODENAME" >> $HOME/.bash_profile
if [ ! $WALLET ]; then
	echo "export WALLET=wallet" >> $HOME/.bash_profile
fi
echo "export OKP4_CHAIN_ID=okp4-nemeton-1" >> $HOME/.bash_profile
source $HOME/.bash_profile

installing GO:

ver="1.19.1" && \
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

clone and assemble the binary file:

cd $HOME
git clone https://github.com/okp4/okp4d.git
cd okp4d
git checkout v3.0.0
make install

initializing the application:

okp4d init $NODENAME --chain-id $OKP4_CHAIN_ID

download the genesis file:

wget -qO $HOME/.okp4d/config/genesis.json "https://raw.githubusercontent.com/okp4/networks/main/chains/nemeton-1/genesis.json"

adding peers:

SEEDS=""
PEERS="[email protected]:36656,[email protected]:36656,[email protected]:36656,[email protected]:26656,[email protected]:36656,[email protected]:26656,[email protected]:17656,[email protected]:31656,[email protected]:21656,[email protected]:28656,[email protected]:51656,[email protected]:26656,[email protected]:26646,[email protected]:26656,[email protected]:33656,[email protected]:36656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.okp4d/config/config.toml

setting up pruning:

pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="50"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.okp4d/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.okp4d/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.okp4d/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.okp4d/config/app.toml

we set the minimum gas price:

sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0uknow\"/" $HOME/.okp4d/config/app.toml

enable prometheus:

sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.okp4d/config/config.toml

if necessary, disable indexing (indexer = "null"):

cd ~
nano $HOME/.okp4d/config/config.toml


ctrl O, enter, ctrrl X

resetting the chain data:

okp4d tendermint unsafe-reset-all --home $HOME/.okp4d

creating a service file:

sudo tee /etc/systemd/system/okp4d.service > /dev/null <<EOF
[Unit]
Description=okp4
After=network-online.target

[Service]
User=$USER
ExecStart=$(which okp4d) start --home $HOME/.okp4d
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF

launching the service file:

sudo systemctl daemon-reload
sudo systemctl enable okp4d
sudo systemctl restart okp4d && sudo journalctl -u okp4d -f -o cat

after the synchronization is complete, load the variables into the system:

source $HOME/.bash_profile

creating or restoring a wallet:

okp4d keys add $WALLET
okp4d keys add $WALLET --recover


we save the information, enter the commands in turn, enter your password in 1 and 2:

OKP4_WALLET_ADDRESS=$(okp4d keys show $WALLET -a)

OKP4_VALOPER_ADDRESS=$(okp4d keys show $WALLET --bech val -a)

echo 'export OKP4_WALLET_ADDRESS='${OKP4_WALLET_ADDRESS} >> $HOME/.bash_profile
echo 'export OKP4_VALOPER_ADDRESS='${OKP4_VALOPER_ADDRESS} >> $HOME/.bash_profile
source $HOME/.bash_profile


creating a validator:

  okp4d tx staking create-validator \
  --amount 1000000uknow \
  --from $WALLET \
  --commission-max-change-rate "0.1" \
  --commission-max-rate "0.2" \
  --commission-rate "0.05" \
  --min-self-delegation "1" \
  --pubkey  $(okp4d tendermint show-validator) \
  --moniker $NODENAME \
  --chain-id $OKP4_CHAIN_ID \
  --fees 550uknow

Delete a node:

sudo systemctl stop okp4d
sudo systemctl disable okp4d
sudo rm /etc/systemd/system/okp4* -rf
sudo rm $(which okp4d) -rf
sudo rm $HOME/.okp4d* -rf
sudo rm $HOME/okp4 -rf
sudo rm -rf $HOME/okp4d
sed -i '/OKP4_/d' ~/.bash_profile