How to set up okp4 validator in nemeton testnet and monitor your validator

What is OKP4

OKP4 is the next generation of data applications on cosmos and It is a domain-specific layer-1 dedicated to trust-minimized data sharing.

The blockchain orchestrates assets shared by participants into the Dataverse: data, algorithms, software, storage and computation to enable a new generation of applications.

OKP4 make any contributor can earns rewards thanks to these new value chains.

Use OKP4, Join Data Spaces. Or create ones on your own terms.

Official guide

Hardware requirements

  • 4 core CPU

  • 8G RAM

  • 200GB SSD

Prerequisites

Install go

sudo rm -rf /usr/local/go;
curl https://dl.google.com/go/go1.19.2.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf - ;
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile

Use go version to check the installation

Install other necessary tools

sudo apt-get update -y && sudo apt-get upgrade -y;
sudo apt-get install curl build-essential jq git make vim -y;

Build from source

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

Verify by run okp4d version

The output should be v3.0.0

Run the node

Init the node

moniker="your_moniker_name"
okp4d init $moniker --chain-id=okp4-nemeton-1
okp4d config chain-id okp4-nemeton-1

Get genesis file

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

Set seeds and peers

PEERS="256e77194b694d5e2acccc6f1982df62b157bceb@65.108.200.248:26656,7b2ce3563dd4c00c5923658e9fe843583fa688e7@162.55.232.162:26656,f3c65bc92c0debc0fefaa4e5ede505001b239f48@65.109.136.199:26656,8540b60b47caf9d10daa6d9e3e7dce3edb02d70a@95.217.118.96:26656,0c38c4b267756d389ecf207985301a9bfeba3ed8@167.235.21.165:26656,24fbac02738005cfa9d8263d01dc7cc113d6b708@162.248.225.244:26656,ead118d7cbe51cbabf5a77b69db7255512f41023@88.208.34.134:26656,f575a4c927d28990c84004d9af555f9956b1f22f@195.201.194.249:26656,4ea26ce893d8f4f89a7b49b9bd77e0fbd914e029@65.109.88.162:26656,a06417f8518fbf6f779e4012dbf72f194a95b48f@65.21.138.124:26656,f99bc1d701d399df1b28bd3ad780cbcd0a5ac7f2@154.12.225.88:26656,ccccce7552e027ab75786e06bdfcc8b18cee8080@142.132.212.19:26656"
seeds="a7f1dcf7441761b0e0e1f8c6fdc79d3904c22c01@seeds.cros-nest.com:36656,e711b6631c3e5bb2f6c389cbc5d422912b05316b@seed.ppnv.space:16256,2f9e54645aca860f703e3f756fa7c472b829a9a9@tenderseed.ccvalidators.com:26009"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.okp4d/config/config.toml
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" ~/.okp4d/config/config.toml

Pruning settings

pruning="custom" && \
pruning_keep_recent="100" && \
pruning_keep_every="0" && \
pruning_interval="10" && \
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

Start node

sudo tee <<EOF >/dev/null /etc/systemd/system/okp4d.service
[Unit]
Description=okp4d daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which okp4d) start
Restart=on-failure
RestartSec=3
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && \
sudo systemctl enable okp4d && \
sudo systemctl start okp4d

Check log

sudo journalctl -u okp4d -f

Check sync status

curl -s localhost:26657/status | jq .result | jq .sync_info

If"catching_up":false means your nodes already synced.

Change addrbook

wget -O $HOME/.okp4d/config/addrbook.json "https://raw.githubusercontent.com/sergiomateiko/addrbooks/main/okp4/addrbook.json"

Create validator

If you are genesis validator,there is no need to create validator again.

Create wallet

okp4d keys add yourwalletname

Remember to save your mnemonic, it cannot be recovered if you lost it

Get test token

Get your wallet address

okp4d keys list

You can ask test token from others.

After that,you can query your wallet balance by

okp4d query bank balances Youraddress

Create validator

In nemeton testnet, there are 150 active validators. You can become an active validator by staking enough uknow.

daemon=okp4d
denom=uknow
moniker=yourmonikername
chainid=nemeton-1
$daemon tx staking create-validator \
    --amount=1000000$denom \
    --pubkey=$($daemon tendermint show-validator) \
    --moniker=$moniker \
    --chain-id=$chainid \
    --commission-rate=0.05 \
    --commission-max-rate=0.2 \
    --commission-max-change-rate=0.1 \
    --min-self-delegation=1000000 \
    --fees 100uknow \
    --from=yourwalletname

You can check your validator on blockchain explorer https://explore.okp4.network/okp4 testnet/staking later.

Monitor (optional)

Install node exporter

Node exporter can export your server's data like CPU, memory.

sudo  apt-get update &&  sudo  apt-get upgrade -y && \
wget https://github.com/prometheus/node_exporter/releases/download/v1.2.2/node_exporter-1.2.2.linux-amd64.tar.gz && \
tar xvf node_exporter-1.2.2.linux-amd64.tar.gz && \
rm node_exporter-1.2.2.linux-amd64.tar.gz && \
sudo mv node_exporter-1.2.2.linux-amd64 node_exporter && \
chmod +x  $HOME/node_exporter/node_exporter && \
mv $HOME/node_exporter/node_exporter /usr/bin && \
rm -Rvf  $HOME/node_exporter/

sudo tee /etc/systemd/system/exporterd.service > /dev/null <<EOF
[Unit]
Description=node_exporter
After=network-online.target
[Service]
User=$USER
ExecStart=/usr/bin/node_exporter
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload && \
sudo systemctl enable exporterd && \
sudo systemctl restart exporterd

sudo journalctl -u exporterd -f

Log should be like this.

example logs
example logs

Open the 9100 port on your server, you can get metrics from node exporter at http://YOURIP:9100/metrics

Open prometheus metrics on your node

cd
sed -i "s/prometheus-retention-time = 0/prometheus-retention-time = 60/g" $HOME/.okp4d/config/app.toml
sed -i "s/prometheus = false/prometheus = true/g" $HOME/.okp4d/config/config.toml
sudo systemctl restart okp4d

Install prometheus

Install prometheus on your monitor server.

cd
wget https://github.com/prometheus/prometheus/releases/download/v2.30.1/prometheus-2.30.1.linux-amd64.tar.gz && \
tar xvf prometheus-2.30.1.linux-amd64.tar.gz && \
rm prometheus-2.30.1.linux-amd64.tar.gz && \
mv prometheus-2.30.1.linux-amd64 prometheus

Add monitor

vim prometheus/prometheus.yml 

Add config like this under scrape_configs and restart promethues

 - job_name: "node_exporter"

    static_configs:
      - targets: ["nodeip:9100"]
        labels:
          label: "okp4"

  - job_name: "node"

    static_configs:
      - targets: ["nodeip:26660"]
        labels:
          label: "okp4"

Set system service

sudo tee /etc/systemd/system/prometheusd.service > /dev/null <<EOF
[Unit]
Description=prometheus
After=network-online.target
[Service]
User=$USER
ExecStart=$HOME/prometheus/prometheus --config.file="/root/prometheus/prometheus.yml"
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload && \
sudo systemctl enable prometheusd && \
sudo systemctl restart prometheusd

sudo journalctl -u prometheusd -f

Install grafana

Install docker

sudo apt update -y && sudo apt upgrade -y
sudo apt-get install ca-certificates curl gnupg lsb-release -y
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
sudo systemctl restart docker

Use docker to start grafana

sudo docker run -d -p 3000:3000 --name grafana grafana/grafana:9.0.5

Open http://yourip:3000 The default username and password are admin, click add your first data source,add promethues data source.

add your data source
add your data source

Enter http://YourpromethuesserverIP:9090 at the URL (remember to open port 9090 of the Promethues server). If promethues and grafana are on the same host, enter http://localhost:9090 and click Save & test to save and test when you are done.

Import dashboard https://github.com/silentnoname/Node-runner/blob/main/monitor/okp4_dashboard.json

import dashboard
import dashboard

Select proper data source, click import and you will see dashboard like this.

example dashboard
example dashboard

Set alert

First click on the Contact point under Alerting in the left menu bar to add a notification method, there are discord, dinging, etc.

add contact points
add contact points

Next, set alert for each panel on dashboard.

add alert
add alert

This is a example alert.

example alert
example alert

More info

Official website:

Official twitter:

Official Docs:

Other useful command

Service management

Check logs

sudo journalctl -u okp4d -f

Run/Restart node

sudo systemctl restart okp4d

Stop node

sudo systemctl stop okp4d

Get node info

Sync info

okp4d status 2>&1 | jq .SyncInfo

Validator info

okp4d status 2>&1 | jq .ValidatorInfo

Node info

okp4d status 2>&1 | jq .NodeInfo

Get node id

okp4d tendermint show-node-id

Wallet management

Show all wallets

okp4d keys list

Recover wallet

okp4d keys add yourwalletname --recover

Delete wallet

okp4d keys delete yourwalletname

Query balances

okp4d query bank balances youraddress

Send tokens

okp4d tx bank send yourwalletname receiveraddress <num>uknow --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

1know=1000000uknow

Vote

okp4d tx gov vote proposal_id option --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

options include yes/no/no_with_veto/abstain

Delegete,Withdraw reward

Delegate

okp4d tx staking delegate validatoraddress <num>uknow  --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

Undelegate

okp4d tx staking unbond validatoraddress <num>uknow  --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

Withdraw staking reward and commission

okp4d tx distribution withdraw-rewards validatoraddress --commission --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

Withdraw all rewards

okp4d tx distribution withdraw-all-rewards --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow

Validator management

Edit validator info

okp4d tx staking edit-validator \
  --new-moniker="Your moniker" \
  --identity="your keybase id" \
  --website="your website" \
  --details="Your descripptions" \
  --from=yourwalletname \
  --fees 100uknow \
  --chain-id=nemeton-1

If you want to show your validator logo on the block explorer. you need to register a keybase account and upload your logo. set --identity="your keybase id"

Unjail

okp4d tx slashing unjail --from yourwalletname -y --chain-id=nemeton-1 --fees 100uknow
Subscribe to Silent ⚛| validator
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.