Skip to content

ChainKit is a toolkit for blockchain development. It includes primitives for creating, building and running decentralized applications.

License

Notifications You must be signed in to change notification settings

blocklayerhq/chainkit

Repository files navigation

ChainKit

CircleCI GoDoc

ChainKit is a toolkit for blockchain development. It includes primitives for creating, building and running decentralized applications built on top of Tendermint and the Cosmos SDK.

Key features:

  • Scaffold: Generate all the Tendermint & Cosmos SDK boilerplate automatically to get started in seconds.
  • Build and Run: Under the hood, chainkit packages your app in a Docker container.
  • Testnet: Anyone in the world can join your network by running one command. Under the hood, chainkit uses IPFS and libp2p to share data and discover peers.

chainkit demo

Installing

Requirements:

From this repository, run:

$ make
$ cp chainkit /usr/local/bin

Usage

Create, Build & Start

In order to create a new (empty) application, just run the following:

$ cd ~/go/src/github.com
$ chainkit create demoapp

You can then start by running:

$ cd demoapp
$ chainkit start

Then open http://localhost:42001/ to see Tendermint's RPC interface or open the Explorer url.

You can also access the CLI: If chainkit is running in the current terminal, go to a new one and go to chainkit's project directory.

$ cd demoapp
$ chainkit cli --help
$ chainkit cli status

All CLI commands usually accessible from a Cosmos-SDK application is available in the same way via chainkit cli ....

Edit the genesis file before the chain starts

It may be useful to edit the genesis file before the chain starts: either to add new accounts with funds or to add more validators. In order to do so, use the following command:

$ cd demoapp
$ chainkit start --edit-genesis

It'll spawn an editor (taken from the $EDITOR env variable if it exists) with the original genesis file. Once you apply your changes, you can review the diff before applying the new genesis file, or revert the changes.

Please note that if the chain has been started already (or any block has been created), this command won't work. The genesis is "sealed" once a new block has been created.

Testnet

Anyone in the world can join your network. They'll need to run:

$ chainkit create demoapp
$ chainkit join <network ID>

where <network ID> is found in the output from starting the first node, or, for a mainnet, published by the network operator.

Under the hood, chainkit uses IPFS to transfer your network's manifest, genesis file and Docker image between nodes.

A built-in discovery mechanism (using libp2p DHT) allows nodes to discover themselves in a completely decentralized fashion.

Moving an existing project to chainkit

When chainkit creates a new project, it generates two files:

  • chainkit.yml
  • Dockerfile

It's useful to understand what they contain in order to move an existing project to chainkit. If the project already contains a Dockerfile, you won't need to change it.

Chainkit.yml:

name: myapp
image: chainkit-myapp
binaries:
  cli: myappcli
  daemon: myappd

The name is simply the name of the project (taken from chainkit create myapp).

The image is the docker image built by chainkit. You can specify your own image if you already have a build system building a docker image.

The last field binaries contain the binaries of the CLI and the Daemon of a cosmos app. It must map to what's inside the docker image, both binary names have to exist after you run a docker build using the Dockerfile of the project.

About

ChainKit is a toolkit for blockchain development. It includes primitives for creating, building and running decentralized applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published