Skip to content
forked from qdrvm/kagome

Kagome - C++17 implementation of Polkadot Runtime Environment

License

Notifications You must be signed in to change notification settings

Lederstrumpf/kagome

 
 

Repository files navigation

logo

Build Status code inspector CodeFactor codecov Netlify Status

Kagome is a Polkadot Runtime Environment developed by Soramitsu add funded by Web3 Foundation grant.

Supported features

  • Extrinsic Api
    • Receives extrinsics submitted over JSON-RPC, validates them and stores in transaction pool
  • Transaction pool
    • Stores submitted transactions
    • Provides ready transactions, i.e. transaction which pre-conditions defined by tags are satisfied
  • Authorship
    • Creates a block from provided inherents and digest
    • Interacts with Polkadot Runtime to initialize and finalize block
  • Runtime
    • Uses Binaryen WASM interpreter to invoke Polkadot Runtime entries
    • Current runtime entries include:
      • BlockBuilder – checks inherents, applies extrinsics, derives inherent extrinsics, initializes and finalizes blocks
      • Core – gets version of runtime, executes blocks, gets authorities
      • Grandpa – gets grandpa authorities
      • Metadata (not used)
      • OffchainWorker (not used)
      • ParachainHost (not used)
      • TaggedTransactionQueue – validates transactions
  • Externals (aka Extensions)
    • Exposes a set functions that Runtime needs for:
      • Management of the content
      • Memory allocation
      • Cryptography
  • SCALE (polkadot-codec)
    • Implements SCALE codec for data types serialization according to spec.
  • Storage
    • Contains of key-value storage interfaces with LevelDB- and inmemory-based implementations
    • Merkle-Patricia trie implementation, described in spec
  • Clock
    • Gets current time for the peer
  • Consensus
    • Babe block production
    • Grandpa finalization
  • Crypto
    • blake2
    • ed25519
    • keccak
    • sha
    • Schnorr's vrf and sr25519 (bindings over Web3’s schnorrkel library)
    • twox
  • Networking
    • Kagome uses cpp-libp2p for peer-to-peer interactions
    • Gossiper and Gossiper observer
    • SyncClient and SyncServer

You can find more information about the components by checking reference documentation.

Trying out Kagome node

As of now there is not much things you can do with Kagome node. However, you can already execute a block production process.

Clone

To clone repository execute:

  1. git clone https://github.com/soramitsu/kagome
  2. cd kagome

Build kagome node

To build kagome node binary go to your build folder and assemble kagome_full binary using cmake:

mkdir build && cd build
cmake ..
make kagome_full -j 

Get necessary configurations for the node

  • Executable binary could be found in build/examples/kagome_full/
  • To execute kagome node you need to provide it with genesis config, keys and leveldb files
  • Example genesis config file can be found in examples/kagome_full/config/polkadot-v06.json
  • Example keys file can be found in examples/kagome_full/config/keystore.json
  • To create leveldb storage file just provide any path into kagome_full executable.

Execute kagome node

To launch kagome node execute:

cd examples/kagome_full
kagome_full --genesis config/polkadot-v06.json --keystore config/keystore.json -l ldb

This command executes kagome node which can receive extrinsics locally on port: 4224 (currently hardcoded)

Contributing guides

Before contributing to Kagome make sure to read these development guides:

  1. Terms
  2. Rules
  3. Development guide
  4. outcome::result<T> docs
  5. Tooling

Build Kagome

First build will likely take long time. However, you can cache binaries to hunter-binary-cache or even download binaries from the cache in case someone has already compiled project with the same compiler. To this end, you need to set up two environment variables:

GITHUB_HUNTER_USERNAME=<github account name>
GITHUB_HUNTER_TOKEN=<github token>

To generate github token follow the instructions. Make sure read:packages and write:packages permissions are granted (step 7 in instructions).

This project is can be built with

cd build
cmake -DCLANG_TIDY=ON ..
make -j

It is suggested to build project with clang-tidy checks, however if you wish to omit clang-tidy step, you can use cmake .. instead.

Tests can be run with:

cd build
ctest

CodeStyle

We follow CppCoreGuidelines.

Please use provided .clang-format file to autoformat the code.

Kagome in media

About

Kagome - C++17 implementation of Polkadot Runtime Environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.4%
  • CMake 6.2%
  • C 2.0%
  • Other 0.4%