How to join the KiChain Mainnet

Tarek Awwad
Ki Foundation
Published in
6 min readAug 11, 2020

⚠️ On the 8th of November 2021, the KiChain mainnet has upgraded from kichain-1 to kichain-2 to add the IBC support. The tutorial found in this post is deprecated. To join the chain after this date please refer to the following tutorial. ⚠️

Here we are, it's finally time to launch the KiChain Mainnet. As announced recently, the Mainnet will launch on the — — of August 2020. The KiChain is a Cosmos based chain, secured by validators ruled by the Tendermint protocol. This article provides a step-by-step tutorial for initiating a validator on the upcoming KiChain Mainnet.

The process of running a validator on the KiChain Mainnet consists of 4 steps: installing Go, installing Ki-tools, starting and synching a KiChain Node and finally, declaring a validators. The steps are detailed hereafter.

⚙️ Recommended hardware specs

To participate in this Mainnet you must have a server with the minimum following specifications:

- Ubuntu 18.04 OS
- 2 CPUs (recommended 4CPUs)
- 4GB RAM
- 80GB SSD (recommended 160GB SSD)

You must allow incoming connections on ports 26656 and have a static IP address.

✅ Install Golang

To install Go, visit the Go download page and copy the link of the following Go release for Linux systems:

https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz

Downloading and unzip the archive file as follows:

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

Finally, export the Go paths like so:

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

This should output :

go version go1.13.5 linux/amd64

🛠 Install ki-tools

Start by clone this repository. If you are here, you most likely have git installed already, otherwise just run:

sudo apt install git

And now you can clone the repository as follows:

git clone https://github.com/KiFoundation/ki-tools.git

Make sure your are on the master branch. Indeed, this branch contains the tools for the mainnet validator installation, while the testnet branch holds the tools for installing Testnet validators.

cd ki-tools
git checkout master

If your are starting with a clean ubuntu (which is recommended) install you might need to install the build-essential package:

sudo apt update
sudo apt install build-essential

Finally, install the tools as follows:

make install

To test the installation, check the downloaded version as follows :

kid version --long

It must output something like this :

name: ki-tools
server_name: kid
client_name: kicli
version: 0.1–14-g5814c4b-Mainnet
commit: 5814c4bd64a2a2f7d388d9155c2d4b69b11fb03c
build_tags: netgo,ledger
go: go version go1.13.5 linux/amd64

🚀 Deploy a Kichain node

  • And follow the dedicated tutorial hereunder.

You will first need a couple of basic tools such as curl and vim (or whatever tools that can replace them). Go ahead and install them :

sudo apt install vim
sudo apt install curl

Once done, create a folder to contain your node information:

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

Initiate the needed configuration files using the unsafe-reset-allcommand:

kid unsafe-reset-all --home ./kid

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

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

Once done, you need to give a name to your node and indicate the seed server to which it should connect to join the network. All of this can be done in the config.toml that can be found in the ./kid/config/ directory. Change the default moniker to whatever you want (the default name is the machine name).

Since the network infrastructures can vary from one node to the other, we recommend that you manually set your external listen address. This can be done by filling in the external_address field as follows:

external_address="tcp://IP:PORT"

Where, IP is the public IP of your node and PORT is your listen address that defaults to 26656.

To allow your node to connect to the network, provide the following seed node address in the seeds field:

seeds="24cbccfa8813accd0ebdb09e7cdb54cff2e8fcd9@51.89.166.197:26656"

Then provide in the field persistent_peers the address of the following persistent peers to ensure that your node is always connected to the network:

persistent_peers="81396d4703a2e3cbd136c7324e4df5686fd48218@35.180.8.214:26656,c597db55d9a609b8b77c3d37ecf1fa9a67117cc0@144.217.82.4:26656,e195adf87e7ee724d21cacc9c59c74fd6d7977c0@54.37.233.162:26656"

🛑 To protect your node from being spammed by empty transactions, we recommend you to set a minimum gas price. For this, edit the minimum-gas-price parameter in the file ./kid/config/app.toml as follows:

minimum-gas-price="0.025uxki"

Now that the node is configured, you can start it.

kid start --home ./kid/ &> ./kilogs/ki-node.log &

This command will start the block synchronisation process where your node retrieves the current state of the blockchain from the other nodes. The process output is redirected to the ki-node.loglog file. It can be visualised as follows:

tail -f kilogs/ki-node.log

and it looks like this:

I[2020-02-12|08:52:14.376] Executed block            module=state height=1 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.393] Committed state module=state height=1 txs=0 appHash=HASHHASHASH...
I[2020-02-12|08:52:14.442] Executed block module=state height=2 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.449] Committed state module=state height=2 txs=0 appHash=HASHHASHASH...
I[2020-02-12|08:52:14.474] Executed block module=state height=3 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.481] Committed state module=state height=3 txs=0 appHash=HASHHASHASH...
I[2020-02-12|08:52:14.507] Executed block module=state height=4 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.514] Committed state module=state height=4 txs=0 appHash=HASHHASHASH...
I[2020-02-12|08:52:14.539] Executed block module=state height=5 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.547] Committed state module=state height=5 txs=0 appHash=HASHHASHASH...
I[2020-02-12|08:52:14.572] Executed block module=state height=6 validTxs=0 invalidTxs=0
I[2020-02-12|08:52:14.579] Committed state module=state height=6 txs=0 appHash=HASHHASHASH...
...

Note : You will need to wait for the end of the synchronisation process before proceeding to the validator creation.

The previous steps will start the node in a relay mode. That is, it is relaying transactions and blocks, but note validating new blocks. To enable the validation process, you need to create and declare your own validator. Start by create your validator wallet by generating a new key pair as follows (Here we call it wallet-1 but you can call it whatever you want):

kicli keys add wallet-1 --home ./kicli/

Enter your password twice and then save the generated addresses, keys and passphrase.

🤑 Get some tokens

Launching a validator requires a wallet with a positive XKI balance. To get XKI, contact us by email or simply join our Slack space. Once acquired, your tokens can be managed from within the Ki Desktop Wallet which you can know more about in this post.

🏆 Initiate your validator

Now that your wallet has a positive balance, you can create your validator through a staking transaction:

kicli tx staking create-validator \
--commission-max-change-rate=0.1 \
--commission-max-rate=0.1 \
--commission-rate=0.1 \
--min-self-delegation=1 \
--amount=5000000uxki \
--pubkey `kid tendermint show-validator --home ./kid/` \
--moniker=<YOUR VALIDATOR NAME> \
--chain-id=kichain-1 \
--gas-prices=0.025uxki \
--from=wallet-1 \
--home ./kicli/

To know more about the various possible configurations of your validator, please refer to the dedicated documentation. Once this transaction has passed, and if the bonded amount is sufficient to be in the active validator list, your validator will automatically start validating new blocks. You can check the list of active validators and a bunch of details on the blockchain's transactions, blocks and accounts on the Ki Explorer.

Bonus: To make your validator more identifiable and to attach additional information to it (e.g., a website), you can use an editing transaction as follow :

kicli tx staking edit-validator  \
--identity=<Keybase Key> \
--chain-id=kichain-1 \
--from=wallet-1 \
--gas-prices=0.025uxki \
--home ./kicli/

This will refer to an existing Keybase account and use its associated information (e.g. avatar image) as meta data for you validator.

Before wrapping up this tutorial, it is important to point out the following: this tutorial is a basic How-To that allows you to join kiChain with the minimum required steps from a functional perspective. It assumes that you’ve already configured your server following the best security practices (e.g. setting up a firewall, configuring permissions, etc…). Moreover, we encourage you to improving the robustness of you validator by taking further steps such as using services, increasing the file limit, using sentry nodes, setting automatic backups etc…

A new journey begins with the Mainnet launch and we are thrilled to have all of the validators onboard. In future posts, we will get into the details of the tools and utility of the KiChain and its token.

--

--

Tarek Awwad
Ki Foundation

Computer Scientist - PhD - Chief Blockchain Architect @Ki_Foundation - #Blockchain #DistributedSystems #Crowdsourcing #MachineLearning #DataMining