[DVS] Distributed Validators Synctems
April 25, 2022

KiChain

The Ki Foundation’s mission is about bridging the gap between traditional wealth and Decentralized Finance.

Hardware requirements:

Official: 4 CPU x 4 GB RAM x 160 GB SSD - Ubuntu 18.04.

1. Node installation

Install GO

The current version of ki-tools requires Go 1.16. To install it, download and unzip the archive file as follows:

wget https://dl.google.com/go/go1.16.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.16.linux-amd64.tar.gz

Then export the Go paths:

mkdir -p $HOME/go/bin
PATH=$PATH:/usr/local/go/bin
echo "export PATH=$PATH:$(go env GOPATH)/bin" >> ~/.bash_profile
source ~/.bash_profile

To test the Go installation, use the version command to check the downloaded version as follows :

go version

which should output

go version go1.16 linux/amd64

Install Ki-tools

Fetch and install the current Mainnet ki-tools version.

git clone https://github.com/KiFoundation/ki-tools.git
cd ki-tools
git checkout -b v2.0.1 tags/2.0.1
make install

Check ki-tools version

kid version --long --log_level info

This should output

name: kitools
server_name: kid
version: Mainnet-IBC-v2.0.1-889c4a2ca6b228247f5cb9366c3c0c894592da27
commit: 889c4a2ca6b228247f5cb9366c3c0c894592da27
build_tags: netgo,ledger
go: go version go1.16 darwin/amd64
...

Set up your node directory and start your relay

Create your node directory as follows:

export NODE_ROOT= <location of your choice>
mkdir -p $NODE_ROOT/kid $NODE_ROOT/kilogs
cd $NODE_ROOT

Note: The step above can be skipped. In this case the node will be created in the default location /home/<user>/.kid/

Initiate the needed configuration files using the unsafe-reset-all command:

kid init [moniker] --chain-id kichain-2

Curl the genesis file to the ./kid/config/ folder:

curl https://raw.githubusercontent.com/KiFoundation/ki-networks/v0.1/Mainnet/kichain-2/genesis.json > ./kid/config/genesis.json

The hash of the genesis file can be computed as follows:

jq -S -c -M '' /.kid/config/genesis.json | shasum -a 256

99855fdf89f5c697f8be2ecc587d79c77259e05d68268928797083bdaa614a80

Setup seeds or persistence peers of your node to the network.

seeds="[email protected]:26656"

peers="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656"

sed -i -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.kid/config/config.toml

Setup min-gas-price

sed -i 's/^minimum-gas-prices *=.*/minimum-gas-prices = "0.025uxki"/g' ~/.kid/config/app.toml

Setup pruning custom/100/0/10

sed -i 's/pruning = "default"/pruning = "custom"/g' ~/.kid/config/app.toml
sed -i 's/pruning-keep-recent = "0"/pruning-keep-recent = "100"/g' ~/.kid/config/app.toml
sed -i 's/pruning-interval = "0"/pruning-interval = "10"/g' ~/.kid/config/app.toml

Create service

sudo tee <<EOF >/dev/null /etc/systemd/system/kid.service
[Unit]
Description=Kichain Node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which kid) start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF

2. Become a Validator

This step provides procedures to register the node as a validator.

Step 3.1: Fund the Validator Account

kid keys add [WALLET_NAME]

Then fund tokens into this account ready for staking.

Step 3.2: Stake Tokens with the Validator Account

kid tx staking create-validator \
  --commission-max-change-rate=0.1 \
  --commission-max-rate=0.1 \
  --commission-rate=0.1 \
  --min-self-delegation=1 \
  --amount=1000000uxki \
  --pubkey `kid tendermint show-validator --home ./kid/` \
  --moniker=<YOUR_MONIKER> \
  --chain-id=kichain-2 \
  --gas-prices="0.025uxki" \
  --from=<WALLET_NAME> 

Useful Commands:

journalctl -u kid -f | grep height
kid status 2>&1 | jq .SyncInfo
kid tx staking edit-validator  \
  --identity=<YOUR_KEYBASE_ID> \
  --website="<YOUR_WEBSITE>" \
  --details="<YOUR_DESCRIPTION>"\  
  --chain-id=kichain-2 \
  --from=<WALLET_NAME> \
  --gas-prices=0.025uxki

Wallet command. Replace $WALLET to your wallet name or use WALLET=YOUR_WALLET_NAME to add a variable

kid q distribution rewards $(kid keys show $WALLET -a)
kid q distribution commission $(kid keys show $WALLET --bech val -a)
kid tx distribution withdraw-rewards $(kid keys show $WALLET --bech val -a) --commission --from $WALLET
kid q bank balances $(kid keys show $WALLET)

Help commands

kid tx staking create-validator --help
kid tx staking edit-validator --help
kid tx staking delegate --help

Links:

https://nodejumper.io/kichain/sync

https://github.com/KiFoundation/ki-networks/blob/v0.1/Mainnet/kichain-2/README.md

https://medium.com/ki-foundation/how-to-join-the-kichain-mainnet-5ac7160d72e3