OKP4 | Testnet - установка ноды
Server requirements: - 2 CPU
- 8 RAM
- 200 GB storage
Prepare server:
Update system dependencies:
Код:
sudo apt update
sudo apt install
Install go (version 19+ is needed)
Код:
wget -c https://golang.org/dl/go1.19.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xvzf go1.19.2.linux-amd64.tar.gz
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
source ~/.profile
go version
rm -rf go1.19.2.linux-amd64.tar.gz
Install make, zip and jq:
Код:
apt install make unzip jq git
Node installation:
Код:
mkdir okp4
#make directory okp4
cd okp4
#go to the directory okp4
wget -P /root/okp4 https://github.com/okp4/okp4d/archive/refs/heads/main.zip
#download the repository
unzip main.zip
#unzip main.zip
rm main.zip
#delete zip
cd okp4d-main
#go to the directory okp4d-main
sudo apt install build-essential
make build install
okp4d version
CHAIN_ID=okp4-nemeton-1
#declare a variable
MONIKER="SmartHamster"
#change SmartHamster on your name of node
okp4d init $MONIKER --chain-id $CHAIN_ID
#initialize the node
Change genesis:
Код:
cd /root/.okp4d/config
rm genesis.json
wget genesis.json https://raw.githubusercontent.com/okp4/networks/main/chains/nemeton-1/genesis.json
Add peers:
Код:
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
Start the node:
Now the node does not work as a service, we need to create a service file so that it worked in the background when we close the terminal:
Код:
sudo tee /etc/systemd/system/okp4d.service > /dev/null <<EOF
Next, copy as one command:
Код:
[Unit]
Description=Okp4 Node
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=/root/go/bin/okp4d start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Copying the executable:
Код:
cd okp4/okp4d-main
sudo cp ./target/dist/okp4d /usr/local/bin/ || exit
Run the service file:
Код:
sudo systemctl daemon-reload
sudo systemctl enable okp4d
sudo systemctl restart okp4d
sudo systemctl status okp4d
View logs:
Код:
journalctl -u okp4d -f -o cat
View the synchronization process (false - the node is synchronized):
Код:
curl http://localhost:26657/status | jq .result.sync_info.catching_up
After your node is fully synchronized, you can proceed to create a validator:
Код:
okp4d keys add wallet
#create wallet - SAVE MNEMONIC!!!
We go to the tap and ask for coins
Now the transaction to create the validator:
Код:
okp4d tx staking create-validator \ --amount=1000000uknow \ --pubkey=$(okp4d tendermint show-validator) \ --moniker="<NODENAME>" \ --chain-id=okp4-nemeton \ --commission-rate="0.01" \ --commission-max-rate="0.10" \ --commission-max-change-rate="0.01" \ --min-self-delegation="1000000" \ --fees=1000uknow \ --from=wallet \ -y
#change <NODENAME> on name of your node
Explorer
Withdraw rewards
Код:
okp4d tx distribution withdraw-rewards $(okp4d keys show wallet --bech val -a) --commission --from wallet --chain-id okp4-nemeton-1 --gas-prices 0.1uknow --gas-adjustment 1.5 --gas auto -y
Delegate 259 KNOW
Код:
okp4d tx staking delegate $(okp4d keys show wallet --bech val -a) 259000000uknow --from wallet --chain-id okp4-nemeton-1 --gas-prices 0.1uknow --gas-adjustment 1.5 --gas auto -y