Building Parachains on Rococo
Rococo is a Polkadot testnet built for testing parachains. Rococo utilizes Cumulus and HRMP (Horizontal Relay-routed Message Passing) in order to send transfers and messages between parachains and the Relay Chain. Every message is sent to the Relay Chain, then from the Relay Chain to the desired parachain. Rococo currently runs three test parachains (Tick, Trick, and Track), as well as several externally developed parachains.
Who is building Parachains?
As of now, the list of parachains are as follows:
- Rococo (Tick, Trick, and Track)
- Mandala
- Darwinia
- Plasm
- Robonomics
- Turbulence
Parachain Workshop
If you are interested in running and launching your own parachain, Parity Technologies has created a parachain workshop. There is also a Rococo Element chat channel as well as Cumulus' GitHub repository available.
Obtaining ROC
There currently isn't a faucet available for ROC and disbursements are only limited to parachain builders for the time being. It's recommended at this point to run your own parachains testnet locally.
How to connect to a Parachains
If you would like to connect to a parachain via Polkadot-JS Apps, you may do so by clicking on the network selection at the top left hand corner of the navigation and selecting any parachain of choice. For the purpose of these following examples, we will be using the Rococo testnet "Custom Node" underneath "Development", according to the parachain workshop.
How to make Cross Chain transfers
To send a transfer between parachains, navigate to "Accounts" > "Transfer". From here, you'll need to select the parachain node that you are running. Next, enter in the amount that you'd like to send to another parachain. Be sure to select the correct parachain you'd like to send an amount to. Once you've hit the "Submit" button, you should see a green notification, indicating a successful transfer.
Downward Transfers
Downward transfers are when an account on the Relay Chain sends a transfer to their account on a different parachain. This type of transfer uses a depository and mint model, meaning that when the DOT leave the sender's account on the Relay Chain and are transferred into an account on a parachain, the parachain mints a corresponding amount of tokens on the parachain.
For example, we can send tokens from Alice's account on the Relay Chain to her account on parachain 200. To do so, we will need to head to the "Network" > "Parachains" tab and click on the "Transfer to chain" button.
Notice here, that we can select which parachain to send the funds to, specify the amount to be sent, and add any comments or a memo for the transfer.
Upward Transfers
Upward transfers occur from a parachain to an account on the Relay Chain. To proceed with this kind of transfer, we need to be connected to a parachain node on the network and be on the "Network" > "Parachains" tab. Click on the "Transfer to chain" button.
Note that the toggle should be set to off, ensuring that the funds go to the Relay Chain and not another parachain.
Lateral Transfers
This type of transfer is only possible with at least two different registered parachains. In true XCMP, lateral transfers would allow for messages to be sent directly from one parachain to another. However, this is not yet implemented, so the Relay Chain is helping us deliver messages for the time being. Lateral transfers work through the depository model, which means that in order to transfer tokens from chain 200 to chain 300, there must already be tokens owned by chain 200 deposited on chain 300. The reasoning behind this can be found on this page here. Lateral transfers are called HRMP, Horizontal Relay-Chain Message Passing.
Before we can actually send funds from one parachain to another, we must ensure that the chain's account on the recipient chain has some funds in it. In this example, Alice will be sending some funds from her account on parachain 200 to her account on parachain 300.
We can get that parachain account address, from our parachain 300's terminal:
2020-08-26 14:46:34 Parachain Account: 5Ec4AhNv5ArwGxtngtW8qcVgzpCAu8nokvnh6vhtvvFkJtpq
From Alice's account on the Relay Chain, she is able to send some amount to parachain 200's depository.
Alice is now able to send from her account on parachain 200 to her account on parachain 300.
Rococo V1 Parachain Requirements
The purpose of this document is to clearly describe the requirements for chain builders who wish to participate as parachains in the Rococo V1 test network. Furthermore, this document aims to provide helpful guidance in order to create a more successful outcome for all involved.
Rococo is the environment for parachain and XCMP testing and will undergo rapid changes, updates and chain state resets as it develops. After the initial tests are successful on Rococo, we envision that in the long run it will be integrated into the Westend test network.
General Strategy
In order to improve Rococo quickly the network will be regularly updated and restarted. This generally involves the update of the client and runtime code as well as the reset of the chain state. The initial parachains will be onboarded every few days, with new parachains only added when the network is running stably. During periods of instability we may de-register parachains to de-load the network, with the intent of re-registering those parachains once stability has improved. When the network appears to be scaling smoothly we will register parachains on a first-come, first-serve basis.
The minimal requirements for any parachain candidate to be considered for the parachain registration process are the following:
- Maintain at least two Rococo V1 validator nodes
- Maintain at least one parachain collator nodes
- Sign-up through the Rococo V1 Parachain Registration form
Update: 15. Jan. 2021
- If you are considered to be included, the Rococo team will get in touch with you through the
Element handle provided in the sign-up form, a rough estimate of going forward will be (in no
certain order):
- second batch: Kilt, Interlay (week of 18. January 2021)
- third batch: Darwinia, Phala, Crust, HydraDX
- fourth batch: Bifrost, Starks Network, Clover, Zenlink
- fith batch: ChainX, Robonomics, Patract Hub, MathWallet
- sixth batch: we will communicate timely
- You will have 2 days to get everything up and running after the Rococo team lets you know
- Make sure you build, run, and test a local setup based on the
rococo-v1
branch for a while (you will be asked for proof) - The Rococo team will help you get your chain deployed
- Don't worry, if you registered, your slot is secured
- If your chain doesn't start to produce blocks within 5 hours after approval, the Rococo team reserves the right to de-register your proposal at any time
- The Rococo team reserves a right for this timing to change, but everybody will try their best to notify you
Requirements as an example walk-through
- Maintain at least two validator (full block authoring node) for
Rococo.
- Treat this like a production grade Polkadot node - see Run a Validator (Polkadot)
- Node Setup - use one of the options below
- Build from source:
git clone https://github.com/paritytech/polkadot
cd polkadot
git checkout rococo-v1
cargo build --release --features=real-overseer
./target/release/polkadot --validator --chain rococo --name <your_rococo_validator_name>
- Use Docker:
docker run -d parity/rococo:<tag_following_polkadot> --validator --chain rococo --name <your_rococo_validator_name>
- Build from source:
- Check your node on the Rococo Telemetry
- Generate your Rococo V1 ValidatorId Address
- Follow
Rococo Validator Lounge
announcements for Rococo V1 validator updates, which can require one of the following
scenarios
- Update client
- Update client and purge-chain
- Maintain at least one collator (full block authoring node) for your team’s parachain.
cd <root_cumulus_based_parachain_code>
cargo build --release
./target/release/<parachain_collator_name> --version
./target/release/<parachain_collator_name> export-genesis-state --parachain-id <your_registered_parachain_id> > genesis-state
./target/release/<parachain_collator_name> export-genesis-wasm > genesis-wasm
./target/release/<parachain_collator_name> --collator --parachain-id <your_registered_parachain_id> --execution wasm --chain rococo
- Sign up through the Rococo V1 Parachain Registration form
- After receiving ROC’s to the ValidatorId Address initiate the Submitting the setKeys Transactionin Rococo Extrinsics
- Follow the registration process
- You are free to do runtime upgrades after the parachain is connected, so you can still iterate on features later on
Tips
If you would like to test your setup first on a local machine, you should be able to do so by following the instructions in the readme launch a local setup.