Kagome is a Polkadot Runtime Environment developed by Soramitsu add funded by Web3 Foundation grant.
- 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
- Exposes a set functions that Runtime needs for:
- 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.
As of now there is not much things you can do with Kagome node. However, you can already execute a block production process.
To clone repository execute:
git clone https://github.com/soramitsu/kagome
cd kagome
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
- 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.
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)
Before contributing to Kagome make sure to read these development guides:
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
We follow CppCoreGuidelines.
Please use provided .clang-format file to autoformat the code.
- Press-release: Soramitsu to implement Polkadot Runtime Environment in C++
- Kagome: C++ implementation of PRE presentation at DOTCon (18.08.19)
- Kagome and consensus in Polkadot presentation (in Russian) during Innopolis blockchain meetup (28.10.19)