A new Cumulus-based Substrate node, ready for hacking
Getting Started
Follow these steps to get started with the Cumulus Template
Setup
First, complete the basic Rust setup instructions.
If necessary, refer to the setup instructions at the Substrate Developer Hub.
Build
Once the development environment is set up, build the node template. This command will build the Wasm and native code:
cargo build --release
Run
Local Testnet
Polkadot (rococo-v1 branch, better use commit hash: f3e2cbf49f179104d20b9f1b54830710ddac8be3
):
cargo build --release --features real-overseer
./target/release/polkadot build-spec --chain rococo-local --raw --disable-default-bootnode > rococo_local.json
./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay0 --validator --alice --port 50555
./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay1 --validator --bob --port 50556 \
--bootnodes /ip4/127.0.0.1/tcp/50555/p2p/<ALICE's peer id>
Substrate Parachain Template:
# this command assumes the chain spec is in a directory named polkadot that is a sibling of the working directory
./target/release/parallel -d local-test --collator --alice --ws-port 9915 --parachain-id 200 -- --chain ../polkadot/rococo_local.json \
--bootnodes /ip4/127.0.0.1/tcp/50555/p2p/<ALICE's peer id>
Registering on Local Relay Chain
In order to produce blocks you will need to register the parachain as detailed in the Substrate Cumulus Workshop by going to
Developer -> sudo -> paraSudoWrapper -> sudoScheduleParaInitialize(id, genesis)
Ensure you set the ParaId
to 200
and the parachain: Bool
to Yes
.
The files you will need are in the ./resources
folder, if you need to build them because you modified the code you can use the following commands
cargo build --release
# Build the Chain spec
./target/release/parallel build-spec --disable-default-bootnode > ./resources/template-local-plain.json
# Build the raw file
./target/release/parallel build-spec --chain=./resources/template-local-plain.json --raw --disable-default-bootnode > ./resources/template-local.json
# export genesis state and wasm
./target/release/parallel export-genesis-state --parachain-id 200 > ./resources/para-200-genesis
./target/release/parallel export-genesis-wasm > ./resources/para-200.wasm
Embedded Docs
Once the project has been built, the following command can be used to explore all parameters and subcommands:
./target/release/parallel -h
Learn More
Refer to the upstream Substrate Developer Hub Node Template to learn more about the structure of this project, the capabilities it encapsulates and the way in which those capabilities are implemented. You can learn more about The Path of Parachain Block on the official Polkadot Blog.