Chain Specification
Genesis chain spec
Overview
A chain specification file is used to define network communications, consensus-related information and initial account balances that Substrate nodes must have at genesis. For more information, please refer to Substrate docs.
The Genesis State
Chain spec provides initial state of the runtime to the node. Some modules require specific storage keys to be populated before running. For instance, chain spec contains accounts with initial account balances for the Balances
module, initial list of authorities for Aura
module, etc.
:code
:code
Apart from the module specific information chain spec contains initial runtime logic compiled into wasm
. It is placed as a value of "code" key.
Customising Chain Spec
This command will produce new default chain-spec file with predefined test accounts and Aura authorities:
Once you have the chain spec file, you are free to modify fields of the JSON file to suit your needs. For example, change initial balances of accounts, replace authorities, etc.
Raw Chain Spec
Before chain spec is supplied to the runtime, it needs to converted to raw so that the runtime can parse it correctly it. In order to do that, one must execute:
Chain spec files must be converted to raw to make sure that all nodes can sync and build on the same chain even after runtime upgrades.
Last updated