When registering a parachain on a relay-chain you need to provide something called head data (or also referred as genesis state) and wasm.
What is this head data and how do I get that?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communityParachains can be seen as a function h' = f(h)
, where:
"Head data" is just a small payload of data. For example, Cumulus stores a Substrate block header in head data.
Upon the registration of a parachain, h0 needs to be provided. This is a very first head data and in case of Cumulus that will be the block header of the genesis block, the block 0.
In cumulus one can obtain head data using the export-genesis-state
subcommand of cumulus-based collator. Similarly, genesis wasm can be obtain using export-genesis-wasm
.
More information can be found in this tutorial.
For the curious, parachain heads are maintained in the relay chain storage using a map, defined as
// The head-data of every registered para.
#[pallet::storage]
#[pallet::getter(fn para_head)]
pub(super) type Heads<T: Config> = StorageMap<_, Twox64Concat, ParaId, HeadData>;
Source from polkadot code base: https://github.com/paritytech/polkadot/blob/aa4b5fc5df538fe281af8379fba45bc1937a2dd9/runtime/parachains/src/paras/mod.rs#L550-L553