#run-time #spec #chain #substrate #builder #preset #build

bin+lib staging-chain-spec-builder

Utility for building chain-specification files for Substrate-based runtimes based on sp-genesis-builder

6 releases (major breaking)

6.0.0 Sep 26, 2024
5.0.0 Jul 18, 2024
3.0.0 Jul 13, 2024
2.0.0 Jun 24, 2024
0.0.0 Oct 16, 2023

#11 in #preset

Download history 3/week @ 2024-08-26 13/week @ 2024-09-16 123/week @ 2024-09-23 58/week @ 2024-09-30 15/week @ 2024-10-07 9/week @ 2024-10-14 6/week @ 2024-10-21 36/week @ 2024-11-04 27/week @ 2024-11-11 97/week @ 2024-11-18 44/week @ 2024-11-25 66/week @ 2024-12-02 103/week @ 2024-12-09

315 downloads per month
Used in polkadot-sdk

GPL-3.0-or-later…

175KB
2.5K SLoC

Release

Polkadot SDK stable2409


lib.rs:

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. ```bash chain-spec-builder create -r runtime.wasm default


_Note:_ [`GenesisBuilder::get_preset`][sp-genesis-builder-get-preset] runtime function is
called.


##### Display the runtime's default `GenesisConfig`

Displays the content of the runtime's default `GenesisConfig`
```bash
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.

Dependencies

~81–120MB
~2.5M SLoC