Connect Substrate blockchains to Polkadot with Cumulus
In this hands-on workshop, participants will start a Polkadot-like relay chainn, register parachains, make cross-chain asset transfers, and convert their own Substrate runtimes to parachains using Cumulus.
Before you start you need to do a substrate comprehension check and ensure your hardware can build and run this (rather resource intensive) set of software.
If you are here without any former substrate experience, you are likely to not understand or complete this tutorial. Before you continue please complete the following tutorials:
We will reference these assuming you have already understand all the steps involved in these, and have your machine configured for substrate based code base compilation.
Any machine may_ handle building a parachain template, but it is a very resource intensive process! We suggest running these builds on a machine with no less than:
- 16 GB of RAM (32 is suggested)
- 4 CPU cores (8 is suggested)
- 50 GB of free HDD/SSD space
Without the minimal RAM here, you are likely to run out of memory resulting in a SIGKILL
error!
This generally happens on the polkadot-service
build - so be sure to monitor your RAM usage
(with something like htop) and lookout for swap starting to be used.
If you cannot use a machine with the minimums here,you can try a few things that trade longer build times for limited RAM usage.
- Use Less threads cargo's
j
flag == the number of threads to use to build. Try to use just a few less than you have available total and monitor RAM usage. - Cargo's codegen units feature makes more optimized builds, and uses less ram, but much longer compile times!
# use less codegen units
RUSTFLAGS="-C codegen-units=1" cargo build --release
# set the number of cores/threads to compile (used to build cumulus/polkadot on rpi 3)
cargo build --release -j 1
Try one, or both of these methods together, to trade time for limited RAM machines.
Eventually
polkadot-service
will be less monolithic, but this is presently a low priority. It builds a node for every network in the polkadot repo.
At the moment, parachains are very tightly coupled with the relay chainn's codebase they are connecting to. If you want to connect your parachian to a running relay network like the rococo test network, you must be sure that you are testing against the exact same build of that relay chainn.
This workshop has been tested on commits:
- Polkadot @
aa386760
- Parachain Template @
9c65875f
- Polkadot JS Apps @
e9876dd5
- _It is generally expected that the hosted Polkadot JS Apps should work. If you have issues, build and host this UI yourself, at this commit.
NOTE: you must use these commits exactly to ensure that you do not run into conflicts as parachain development development is actively making breaking changes between commits on these repositories!
We on the devhub team do our best to keep the parachain template & this workshop updated presently with the latest release of Polkadot. But do not assume this is the case! Check with us in the Rococo matrix channel when breaking changes and testnet resets occur.
Read about The Path of a Parachain Block on the official Polkadot Blog.
Refer to Acknowledgement & Contribution
Cumulus is pre-release software that is still under development. While this workshop strives to be useful, the material it covers may change or break before Cumulus is fully released. Nothing presented here is ready for use in value-bearing blockchains!