6

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?

2 Answers 2

6

Parachains can be seen as a function h' = f(h), where:

  • f is the wasm blob referred to as PVF (parachain validation function).
  • h is the current head data.
  • h' is the new head data.

"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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.