subsembly
  • Introduction
  • Getting Started
    • Overview
    • Substrate Essentials
    • CLI
      • subsembly init
      • subsembly compile
      • subsembly spec
  • Development
    • Runtime Development
    • Chain Specification
    • Runtime Execution
  • Modules
    • Core
      • System
      • Executive
      • Crypto
      • Log
    • Pre-built
      • Aura
      • Balances
      • Timestamp
      • TransactionPayment
  • Advanced
    • as-scale-codec
    • subsembly-core
    • Metadata
      • Dispatcher
  • Guides
    • Create Your First Subsembly Runtime
      • Set Up
      • Start the Node
      • PolkadotJS
    • Start Your Network
      • Prepare the Network
      • Launch Validator Nodes
      • Launch the Third Node
    • Create a New Module
      • Nicks Module
      • Launch the Node
      • PolkadotJs
Powered by GitBook
On this page
  • Overview
  • The Genesis State
  • :code
  • Customising Chain Spec
  • Raw Chain Spec

Was this helpful?

  1. Development

Chain Specification

Genesis chain spec

PreviousRuntime DevelopmentNextRuntime Execution

Last updated 4 years ago

Was this helpful?

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 .

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

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:

subsembly spec --to=./chain-spec.json

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:

subsembly spec --src=./chain-spec.json --raw=./raw-chain-spec.json --wasm=./build/subsembly-wasm

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.

docs