Expand description

Substrate’s chain spec builder utility.

A chain-spec is short for chain-configuration. See the sc-chain-spec for more information.

Note that this binary is analogous to the build-spec subcommand, contained in typical substrate-based nodes. This particular binary is capable of interacting with sp-genesis-builder implementation of any provided runtime allowing to build chain-spec JSON files.

See ChainSpecBuilderCmd for a list of available commands.

§Typical use-cases.

§Generate chains-spec using default config from runtime.

Query the default genesis config from the provided runtime.wasm and use it in the chain spec.

chain-spec-builder create -r runtime.wasm default

Note: GenesisBuilder::get_preset runtime function is called.

§Display the runtime’s default GenesisConfig

Displays the content of the runtime’s default GenesisConfig

chain-spec-builder display-preset -r runtime.wasm

Note: GenesisBuilder::get_preset runtime function is called.

§Display the GenesisConfig preset with given name

Displays the content of the GenesisConfig preset for given name

chain-spec-builder display-preset -r runtime.wasm -p "staging"

Note: GenesisBuilder::get_preset runtime function is called.

§List the names of GenesisConfig presets provided by runtime.

Displays the names of the presets of GenesisConfigs provided by runtime.

chain-spec-builder list-presets -r runtime.wasm

Note: GenesisBuilder::preset_names runtime function is called.

§Generate chain spec using runtime provided genesis config preset.

Patch the runtime’s default genesis config with the named preset provided by the runtime and generate the plain version of chain spec:

chain-spec-builder create -r runtime.wasm named-preset "staging"

Note: GenesisBuilder::get_preset and GenesisBuilder::build_state runtime functions are called.

§Generate raw storage chain spec using genesis config patch.

Patch the runtime’s default genesis config with provided patch.json and generate raw storage (-s) version of chain spec:

chain-spec-builder create -s -r runtime.wasm patch patch.json

Note: GenesisBuilder::build_state runtime function is called.

§Generate raw storage chain spec using full genesis config.

Build the chain spec using provided full genesis config json file. No defaults will be used:

chain-spec-builder create -s -r runtime.wasm full full-genesis-config.json

Note: GenesisBuilder::build_state runtime function is called.

§Generate human readable chain spec using provided genesis config patch.
chain-spec-builder create -r runtime.wasm patch patch.json
§Generate human readable chain spec using provided full genesis config.
chain-spec-builder create -r runtime.wasm full full-genesis-config.json
§Extra tools.

The chain-spec-builder provides also some extra utilities: VerifyCmd, ConvertToRawCmd, UpdateCodeCmd.

Structs§

Enums§

Functions§