Skip to content

nysa-network/ki-tools

 
 

Repository files navigation

Ki Tools

This repository hosts kid, the implementation of the kichain protocol, based on Cosmos-SDK.

Quick Start

Install Golang (linux)

To install Go, visit the Go download page and copy the link of the latest Go release for Linux systems, download and unzip the archive file as follows:

wget https://dl.google.com/go/go1.18.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.18.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.18 linux/amd64

Build kid (linux)

Start by cloning 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

If your are starting with a clean ubuntu install you might need to install the build-essential package:

sudo apt update
sudo apt install build-essential

Finally, navigate to the repository folder and install the tools as follows:

cd ki-tools
make install

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

kid version --long

Building for testnet

Testnet token name (tki) is different from mainnet (xki). Testnet binaries need to support this difference. To build a testnet binary, run as follows:

cd ki-tools
make build-testnet

You can also build a static testnet binary as explained in the following section.

Build a static kid binary

Why building static binaries ?

Static binaries hermetically contain libraries that they are using. Dynamic binaries rely on libraries located elsewhere on the system, the binary only containing the address of the library. There are multiple pro and cons of static vs dynamic.

For kid, we provide a set a tool to build static binaries, as we want to ensure that:

  • Binaries and dependencies are consistent accross the validators set.
  • Build result is reproducible and can be verified by every user.

Using static, verified, binaries ensures that all nodes mainteners are running the same version of dependencies, the cosmwasm particulary. You can see this as a protection against unexpected consensus failures due to binary dependency mismatch.

Static binaries integrity can be checked by comparing sha256sum.

Requirements

To build a static binary, we rely on Docker and alpine docker images.

Install docker

To install docker, follow the official procedure for your platform

Install Qemu (Optional)

If you want to build kid to run on a platform different from your build platform, you will need to install Qemu:

For linux users:

sudo apt-get install qemu binfmt-support qemu-user-static 
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

For macOS users, Qemu should already be installed and configured when installing Docker Desktop.

Build
cd ki-tools

Build an amd64 static binary

make build-reproducible-amd64           # For mainnet
make build-testnet-reproducible-amd64   # For testnet

Build an arm64 static binary

make build-reproducible-arm64           # For mainnet
make build-testnet-reproducible-arm64   # For testnet

Note: arm64 compatiblity is proposed but not guaranteed. We recommend users to run on amd64 platforms.

Built binaries can then be found in the build folder

$ tree build
build
├── Mainnet
│   └── linux
│       ├── amd64
│       │   └── kid
│       └── arm64
│           └── kid
└── Testnet
    └── linux
        ├── amd64
        │   └── kid
        └── arm64
            └── kid

Disclaimer

The ki-tools is a modified clone of the gaia project. More about the latter can be found here.

Packages

No packages published

Languages

  • Go 37.2%
  • Python 30.0%
  • Jinja 10.6%
  • Makefile 9.8%
  • HCL 7.3%
  • Shell 4.4%
  • Dockerfile 0.7%