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="8cdeb85dada114c959c36bb59ce258c65ae3a09c@88.198.242.163:36656,84da5ad673d086c5c0b4a8da8b8b1c1c29e1d81e@142.132.130.196:36656,da8e2423cb90fba519e685aa47669eb861ea18c4@65.108.249.79:36656,30092d2717053f1c0813e8354c07c761c9c3ac5c@194.163.161.234:26656,08c925f04cb7a324b1aa91b472faa99c7cccc6ab@65.108.56.126:36656,bc648d1d8aef7f622d38f47ab8a0ecaee9791c46@54.36.109.62:26656,15fdc722cd49ef7676205b6ad3120a84728d948c@65.108.225.158:17656,1655cdc8fdfe1dc2209d47ff68c02a417ef9ed52@135.181.222.179:31656,eef77b5ae1c37f3e5809ff928c329dde906be388@65.108.133.73:21656,b0b56d944cf1cc569a1e77e0923e075bad94d755@141.95.145.41:28656,977373e6ff096d43c928e14724b8c6d9d7f48cb7@5.9.147.185:51656,a49302f8999e5a953ebae431c4dde93479e17155@141.95.153.244:26656,c030413e39be95c397c6681639f5d48675554c0c@51.79.78.121:26646,2caca21c4c83bc71b551c84801018c9d84b11f8b@135.181.59.182:26656,5a343f58402802a83ac546a22f66b1a799480dec@95.216.2.232:33656,a7f1dcf7441761b0e0e1f8c6fdc79d3904c22c01@38.242.150.63: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