{"id":13604213,"url":"https://github.com/qdrvm/kagome","last_synced_at":"2025-04-12T23:34:31.206Z","repository":{"id":37458485,"uuid":"148600712","full_name":"qdrvm/kagome","owner":"qdrvm","description":"Kagome - C++20 implementation of Polkadot Host","archived":false,"fork":false,"pushed_at":"2025-04-12T09:52:18.000Z","size":63329,"stargazers_count":168,"open_issues_count":97,"forks_count":40,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-04-12T23:34:02.087Z","etag":null,"topics":["cpp","cpp20","libp2p","polkadot","wasm"],"latest_commit_sha":null,"homepage":"https://kagome.readthedocs.io","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qdrvm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-13T07:40:03.000Z","updated_at":"2025-04-11T17:02:35.000Z","dependencies_parsed_at":"2023-10-02T07:24:40.763Z","dependency_job_id":"3aadd9eb-64de-4251-a43f-c94eccff0dc3","html_url":"https://github.com/qdrvm/kagome","commit_stats":null,"previous_names":["qdrvm/kagome","soramitsu/kagome"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrvm%2Fkagome","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrvm%2Fkagome/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrvm%2Fkagome/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qdrvm%2Fkagome/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qdrvm","download_url":"https://codeload.github.com/qdrvm/kagome/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647259,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp20","libp2p","polkadot","wasm"],"created_at":"2024-08-01T19:00:41.748Z","updated_at":"2025-04-12T23:34:31.180Z","avatar_url":"https://github.com/qdrvm.png","language":"C++","funding_links":[],"categories":["Resources"],"sub_categories":["Polkadot Host Implementation"],"readme":"[//]: # (\nCopyright Quadrivium LLC\nAll Rights Reserved\nSPDX-License-Identifier: Apache-2.0\n)\n\n![logo](/docs/image_assets/kagome-logo-(new-2020).svg)\n\n[![](https://img.shields.io/twitter/follow/qdrvm_io?label=Follow\u0026style=social)](https://twitter.com/qdrvm_io)\n\n## Intro\n\nKAGOME is a [Polkadot Host](https://github.com/w3f/polkadot-spec/tree/master/host-spec) (former Polkadot Runtime Environment) developed by [Quadrivium](https://qdrvm.io) and funded by a Web3 Foundation [grant](https://github.com/w3f/Web3-collaboration/blob/master/grants/grants.md) and Treasury proposals ( [1](https://kusama.polkassembly.io/post/1858), [2](https://polkadot.polkassembly.io/treasury/485)), [3](https://polkadot.polkassembly.io/treasury/876).\n\n\n## Status\n\n![kagome-components-Host drawio-light](https://github.com/qdrvm/kagome/assets/9370151/323c1677-b628-468c-adb8-5c09c2164fc3)\n\n\n- [x] JSON-RPC (compatible with Polkadot JS)\n    - [ ] New [unstable JSON-RPC](https://paritytech.github.io/json-rpc-interface-spec/)\n- [x] Scale codec\n- [x] Synchronizer\n    - [x] Full sync\n    - [x] Fast sync\n    - [x] Warp sync\n- [x] Transaction pool\n- [x] Consensus\n    - [x] BABE\n    - [x] GRANDPA\n- [x] Storage\n    - [x] Blockchain\n        - [x] Block storage\n        - [x] Block tree\n        - [x] Digest tracker\n    - [x] Trie storage (merkle trie)\n    - [x] RocksDB\n    - [x] Dynamic pruning\n    - [ ] Trie nodes caches\n    - [ ] State caches\n- [x] Runtime\n    - [x] Host API\n    - [x] WASM engine\n        - [x] Binaryen\n        - [x] WAVM\n        - [x] WasmEdge\n- [x] Parachains core\n   - [x] Data availability\n       - [x] Systematic chunks ([RFC-47](https://polkadot-fellows.github.io/RFCs/approved/0047-assignment-of-availability-chunks.html))\n   - [x] Approval voting\n   - [x] Disputes resolution\n   - [x] Async-Backing\n   - [ ] Elastic scaling\n- [x] Networking\n    - [x] Peer manager\n        - [x] /dot/block-announces/1\n        - [x] /paritytech/grandpa/1\n        - [x] /polkadot/validation/1\n        - [x] /polkadot/collation/1\n        - [x] /dot/transactions/1\n        - [x] /polkadot/req_collation/1\n        - [x] /dot/light/2\n        - [x] /polkadot/req_pov/1\n        - [x] /dot/state/2\n        - [x] /dot/sync/warp\n        - [x] /polkadot/req_statement/1\n        - [x] /dot/sync/2\n        - [x] /polkadot/req_available_data/1\n        - [x] /polkadot/req_chunk/1\n        - [x] /polkadot/send_dispute/1\n    - [x] Libp2p\n        - [x] Transport\n            - [x] TCP\n            - [x] QUIC\n            - [ ] WebRTC\n        - [x] Secure connection\n            - [x] Noise\n            - [x] TLS\n        - [x] Multiplexing\n            - [x] Yamux\n        - [x] Multiselect protocol\n        - [x] Peer discovery\n            - [x] Kademlia\n        - [x] Ping protocol\n        - [x] Identify protocol\n- [x] Offchain workers\n- [x] Keystore\n- [x] Telemetry support\n- [x] Prometheus metrics\n\nMore details of KAGOME development can be found within the [supported features](./README.md/#supported-features) section and in [projects board](https://github.com/soramitsu/kagome/projects/2)\n\n## Getting Started\n\n### Build\n\n#### Prerequisites\n\nIf you are using a Debian Linux system, the following command allows you to build KAGOME:\n\n```sh\ngit clone https://github.com/qdrvm/kagome\ncd kagome\nsudo chmod +x scripts/init.sh scripts/build.sh\n\nsudo ./scripts/init.sh\n./scripts/build.sh\n```\n\nYou will get KAGOME binary in the `build/node/` folder\n\nOther make commands are:\n\n```\nmake docker\nmake command args=\"gcc --version\"\nmake release\nmake release_docker\nmake debug_docker\nmake clear\n```\n\n### Installation from APT Package\n\nTo install KAGOME releases using the provided package repository, follow these steps (tested on Ubuntu 24.04.1 LTS (Noble Numbat)):\n\nUpdate your package lists and install necessary utilities:\n    \n```sh\napt update \u0026\u0026 apt install -y gpg curl\n```\n\nAdd the repository’s GPG signing key:\n    \n```sh\ncurl -fsSL https://europe-north1-apt.pkg.dev/doc/repo-signing-key.gpg | gpg --dearmor -o /usr/share/keyrings/europe-north-1-apt-archive-keyring.gpg\n```\n\nAdd the KAGOME package repository to your sources list:\n```sh\necho \"deb [signed-by=/usr/share/keyrings/europe-north-1-apt-archive-keyring.gpg] https://europe-north1-apt.pkg.dev/projects/kagome-408211 kagome main\" \u003e /etc/apt/sources.list.d/kagome.list\n```\n\nUpdate the package lists and install KAGOME:\n\n```sh\napt update \u0026\u0026 apt install -y kagome\n```\n\n### Using KAGOME\n\n#### Obtaining database snapshot (optional)\n\nIn order to avoid syncing from scratch we are maintaining the most recent snapshot of Polkadot network for KAGOME node available for anyone here: https://drive.google.com/drive/folders/1pAZ1ongWB3_zVPKXvgOo-4aBB7ybmKy5?usp=sharing\n\nAfter downloading the snapshot you can extract it in the folder where the node will be running:\n\n```\nunzip polkadot-node-1.zip\n```\n\n#### Execute KAGOME Polkadot full syncing node\n\nYou can synchronize with Polkadot using KAGOME and obtain an archive node that can be used to query the Polkadot network at any state.\n\nTo launch KAGOME Polkadot syncing node execute:\n```\ncd examples/polkadot/\nPATH=$PATH:../../build/node/\nkagome --chain polkadot.json --base-path polkadot-node-1\n```\n\n\u003e Note: If you start KAGOME for the first time, you can add the `--sync Fast` flag to synchronize using [Fast sync](https://spec.polkadot.network/#sect-sync-fast)\n\nAfter this command KAGOME will connect with other nodes in the network and start importing blocks. You may play with your local node using polkadot js apps: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer\n\nYou will also be able to see your node on https://telemetry.polkadot.io/. If you need to identify it more easily you can add `--name \u003cnode-name\u003e` flag to node's execution command and find your node in telemetry by typing its name.\n\nRun `kagome --help` to explore other CLI flags.\n\n\n#### Execute KAGOME block_validator node in development mode\n\nThe easiest way to get started with KAGOME is to run it in development mode, which is a single node network:\n\n```\nkagome --dev\n```\n\nThat executes node with default accounts Alice and Bob. You can read about these accounts [here](https://kagome.readthedocs.io/en/latest/tutorials/first_kagome_chain.html#launch-kagome-network).\n\nTo launch with wiping existing data you can do:\n\n```\nkagome --dev-with-wipe\n```\n\n#### Run KAGOME node in validator mode\n\nTo start the KAGOME validator:\n```\ncd examples/first_kagome_chain\nPATH=$PATH:../../build/node/\nkagome --validator --chain localchain.json --base-path base_path\n```\n\nThis command executes a KAGOME full node with an authority role.\n\n#### Running KAGOME as a Service\n\nYou can run KAGOME as a service using a systemd service file. Below is an example of a service file to launch KAGOME Kusama validator:\n```sh\n[Unit]\nDescription=Kagome Node\n\n[Service]\nUser=kagome\nGroup=kagome\nLimitCORE=infinity\nLimitNOFILE=65536\nExecStart=kagome \\ # should be in path\n  --name kagome-validator \\\n  --base-path /home/kagome/dev/kagome-fun/kusama-node-1 \\\n  --public-addr=/ip4/212.11.12.32/tcp/30334 \\ # Address should be publicly accessible\n  --validator \\\n  --listen-addr=/ip4/0.0.0.0/tcp/30334 \\\n  --chain kusama \\\n  --prometheus-port=9615 \\\n  --prometheus-external \\\n  --wasm-execution Compiled \\\n  --telemetry-url 'wss://telemetry.polkadot.io/submit/ 1' \\\n  --rpc-port=9944 \\\n  --node-key 63808171009b35fc218f207442e355b0634561c84e0aec2093e3515113475624\n\nRestart=always\nRestartSec=10\n\n[Install]\nWantedBy=multi-user.target\n```\n\n##### Adding the Service File\n\n1. Copy the service file content into a new file named kagome.service.\n2. Move the file to the systemd directory:\n\n`sudo mv kagome.service /etc/systemd/system/`\n\n##### Starting the Kagome Node\n\nTo start the Kagome node using systemd:\n1. Reload the systemd manager configuration:\n```sh\nsudo systemctl daemon-reload\n```\n\n2. (Optionally) Enable the Kagome service to start on boot:\n```sh\nsudo systemctl enable kagome\n```\n\n3. Start the Kagome service:\n```sh\nsudo systemctl start kagome\n```\n\n4. Check the status of the Kagome service:\n```sh\nsudo systemctl status kagome\n```\n\n#### Run KAGOME with collator\n\nRead [this](./examples/adder-collator) tutorial\n\n\n\n## Contributing Guides\n\nPlease refer to the [Contributor Documentation](./docs/source/development/dev-guide.md).\n\n## Modules\n* [api](./core/api)\n    * JSON-RPC based on specification from [PSP](https://github.com/w3f/PSPs/blob/master/PSPs/drafts/psp-6.md) and Polkadot JS [documentation](https://polkadot.js.org/docs/substrate/rpc). Uses HTTP and WebSockets for transport. \n* [application](./core/application)\n    * Implements logic for running KAGOME node, such as processing CLI flags and defining an execution order of different modules\n* [assets](./core/assets)\n    * Artifacts needed to run in development mode\n* [authority_discovery](./core/authority_discovery)\n    * Logic for finding peer information by authority id provided\n* [authorship](./core/authorship)\n    * Mechanism for building blocks from extrinsics provided by the transaction pool\n* [blockchain](./core/blockchain)\n    * Implements blockchain logic such as fork handling and block digest information processing\n* [clock](./core/clock)\n    * Implements a clock interface that is used to access the system time\n    * Implements timer interface that is used to schedule events\n* [common](./core/common)\n    * A set of miscellaneous primitives, data structures, and helpers that are widely used in the project to simplify development\n* [consensus](./core/consensus)\n    * Implementation of [BABE](https://spec.polkadot.network/#sect-block-production) block production mechanism\n    * Implementation of [Grandpa](https://spec.polkadot.network/#sect-finality) finality gadget\n* [containers](./core/containers)\n    * An implementation of a container that serves as an allocator for frequently created objects\n* [crypto](./core/crypto)\n    * Crypto primitives implementation such as DSAs, Hashers, VRF, Random generators\n* [filesystem](./core/filesystem)\n    * A convenient interface for working with directories in the project\n* [host_api](./core/host_api)\n    * [Host APIs](https://spec.polkadot.network/#chap-host-api) exposed by the Polkadot runtime as WASM import functions needed to handle storage, cryptography, and memory\n* [injector](./core/injector)\n    * A mechanism for matching class interfaces to their corresponding implementations using the [Boost dependency injector](https://github.com/boost-ext/di)\n* [log](./core/log)\n    * A configuration of KAGOME logger\n* [macro](./core/macro)\n    * Convenience macros \n* [metrics](./core/metrics)\n    * Prometheus metrics to retrieve KAGOME node execution statistics\n* [network](./core/network)\n    * A set of networking substream protocols implementation on top of [cpp-libp2p](https://github.com/libp2p/cpp-libp2p/) library\n* [offchain](./core/offchain)\n    * [Offchain worker](https://spec.polkadot.network/#sect-offchain-api) implementation\n* [outcome](./core/outcome)\n    * Convenient functions for [boost outcome](https://www.boost.org/doc/libs/1_81_0/libs/outcome/doc/html/index.html)\n* [parachain](./core/parachain)\n    * Parachains logic such as collation protocol, backing, availability and validity\n* [runtime](./core/runtime)\n    * Integration of Binaryen and WAVM WebAssembly engines with Host APIs\n* [scale](./core/scale)\n    * Scale codec for some primitives\n* [storage](./core/storage)\n    * Storage and trie interfaces with RocksDB implementation\n* [subscription](./core/subscription)\n    * Subscription engine\n* [telemetry](./core/telemetry)\n    * Connection to telemetry such as https://telemetry.polkadot.io/\n* [transaction_pool](./core/transaction_pool)\n    * Pool of transactions to be included into the block\n* [utils](./core/utils)\n    * Utils such as profiler, pruner, thread pool\n\nYou can find more information about the components by checking [reference documentation](https://kagome.netlify.com). Check out tutorials and more examples in the official documentation: https://kagome.readthedocs.io/\n\n## KAGOME in media\n\n* Press-release: [Soramitsu to implement Polkadot Runtime Environment in C++](https://medium.com/web3foundation/w3f-grants-soramitsu-to-implement-polkadot-runtime-environment-in-c-cf3baa08cbe6)\n* [KAGOME: C++ implementation of PRE](https://www.youtube.com/watch?v=181mk2xvBZ4\u0026t=) presentation at DOTCon (18.08.19)\n* [KAGOME and consensus in Polkadot](https://www.youtube.com/watch?v=5OrevTjaiPA) presentation (in Russian) during Innopolis blockchain meetup (28.10.19)\n* [Web3 Builders: Soramitsu | C++ Implementation of Polkadot Host](https://www.youtube.com/watch?v=We3kiGzg60w) Polkadot's Web3 builders online presentation\n* [Building alternative clients](https://youtu.be/TnENz6I9l8A?si=yF4oo2zQ6LdPW13N) Polkadot Decoded 2023 presentation\n* [Polkadot Host architecture in 2024](https://www.youtube.com/watch?v=Lv2KQ2EDyM8\u0026pp=ygUKc3ViMCBrYW1pbA%3D%3D) Sub0 Asia 2024 presentation\n* [Building Kagome: Polkadot's Journey Towards Client Diversity](https://youtu.be/tkem7nYd5Y0?feature=shared) AwesomeDOT Podcast\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdrvm%2Fkagome","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdrvm%2Fkagome","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdrvm%2Fkagome/lists"}