Prepare the parachain Collator

Prepare the parachain collator

With the local relay chain running and the raw chain specification for the parachain template updated, you are ready to start the parachain collator node and export information about its runtime and genesis state.

  1. Export the WebAssembly runtime for the parachain. (We continue to use Magnet as an example for this session.)

The relay chain needs the parachain-specific runtime validation logic to validate parachain blocks. You can export the WebAssembly runtime for a parachain collator node by running the following command:

./target/release/parachain-magnet-node export-genesis-wasm --chain raw-magnet-2000.json magnet-2000-wasm
  1. Generate a parachain genesis state.

To register a parachain, the relay chain needs to know the genesis state of the parachain. You can export the entire genesis state—hex-encoded—to a file by running the following command:

./target/release/parachain-magnet-node export-genesis-state --chain raw-magnet-2000.json magnet-2000-state

You should note that the runtime and state you export must be for the genesis block. You can't connect a parachain with any previous state to a relay chain. All parachains must start from block 0 on the relay chain.

  1. Start the collator node:

nohup ./target/release/parachain-magnet-node --alice --collator --force-authoring --chain raw-magnet-2000.json --base-path ./alice --p

Last updated