You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 15, 2021. It is now read-only.
In this demonstration we will launch a relay chain with three validators. We will launch two parachains, each with a single collator, and register the parachains with the relay chain. We will transfer tokens from the relay chain to each parachain and back.
Setup
You'll need several files to complete this exercise:
Cumulus test collator binary
Polkadot binary
Polkadot chainspec file
Parachain runtime wasm
Download the cumulus assets here. (These binaries are for linux 64 bit.)
You'll need five terminals for the five total nodes. I'll refer to the nodes and the terminal's in which they run as Alice, Bob, Charlie, Collator100, and Collator99.
Launch the relay chain
You need a polkadot chainspec that calls for at least three validators. You need three because you need one assigned to each of the two parachains, and one for local relay chain duty.
# In alice's terminal (Alice is using the default websocket and libp2p ports)
polkadot --base-path /tmp/alice --chain polkadot_chainspec.json --alice --port 30333 --ws-port 9944
# In bob's terminal
polkadot --base-path /tmp/bob --chain polkadot_chainspec.json --bob --port 40444 --ws-port 9955
# In charlie's terminal
polkadot --base-path /tmp/bob --chain polkadot_chainspec.json --port 50555 --ws-port 9966
After a short time the nodes will discover each other and peer. If you are running on seperate physical machines, you will need to supply the subsequent nodes with a --bootnodes flag and point it to the network location of another node.
Launch the parachain
Before we launch the chain, we'll export it's state. This creates a file called genesis-state-100 that contains the parachain's starting state. We'll need this information later when registering the parachain with the relaychain.
These instructions are for launching the first parachain, you may repeat to launch the second parachain. And you could repeat to launch even more parachains, but you would need more validators in the relay chain to support that many parachains.
Open the accounts tab and watch Alice's balance to see when the incoming transfer arrives. Back in the UI that's connected to Alice on the relay chain, navigate to extrinsics and submit parachains::TransferToParachain extrinsic.
to: 100
amount: whatever you like
remark: Recipient's address on the parachain
Transfer tokens back to the relay chain
In The UI connected to collator100, submit the tokenDealer::transferTokensToRelayChain. Enter the destination account on the relay chain and the number of tokens to transfer as you desire. Confirm you balance has increased on the relay chain.
The text was updated successfully, but these errors were encountered:
When paritytech/cumulus#118 is merged into cumulus, it will be possible to demonstrate cross-chain taken transfers. The test collator has also improved significantly since this workshop was first written and it is now ready to shine. Here is a draft for the flow of the workshop. These instructions reproduce the results demonstrated in https://twitter.com/bkchr/status/1263608038923083779?s=20 and https://twitter.com/bkchr/status/1270479898696695808?s=20
Overview
In this demonstration we will launch a relay chain with three validators. We will launch two parachains, each with a single collator, and register the parachains with the relay chain. We will transfer tokens from the relay chain to each parachain and back.
Setup
You'll need several files to complete this exercise:
Download the cumulus assets here. (These binaries are for linux 64 bit.)
You'll need five terminals for the five total nodes. I'll refer to the nodes and the terminal's in which they run as Alice, Bob, Charlie, Collator100, and Collator99.
Launch the relay chain
You need a polkadot chainspec that calls for at least three validators. You need three because you need one assigned to each of the two parachains, and one for local relay chain duty.
After a short time the nodes will discover each other and peer. If you are running on seperate physical machines, you will need to supply the subsequent nodes with a
--bootnodes
flag and point it to the network location of another node.Launch the parachain
Before we launch the chain, we'll export it's state. This creates a file called
genesis-state-100
that contains the parachain's starting state. We'll need this information later when registering the parachain with the relaychain.These instructions are for launching the first parachain, you may repeat to launch the second parachain. And you could repeat to launch even more parachains, but you would need more validators in the relay chain to support that many parachains.
Notice we didn't give the collator a polkadot chainspec. It is currently hard-coded.
Register the parachain
Connect the polkadot js Apps user interface to Alice's node. https://polkadot.js.org/apps/ To connect to Alice, use
ws://127.0.0.1:9944/
Use the sudo tab to submit the registrar registerPara extrinsic. Params are
Parachain ID: 100
Scheduling: Always
code: upload the parachain runtime code
initial_head_data: upload the genesis-state-100 file.
You should notice that the collator begins authoring blocks.
Transfer tokens to Parachain 100
Open a second instance of Apps and connect it to Collator100 (
ws://127.0.0.1:9977
). You'll need to enter these custom types:Open the accounts tab and watch Alice's balance to see when the incoming transfer arrives. Back in the UI that's connected to Alice on the relay chain, navigate to extrinsics and submit
parachains::TransferToParachain
extrinsic.to: 100
amount: whatever you like
remark: Recipient's address on the parachain
Transfer tokens back to the relay chain
In The UI connected to collator100, submit the
tokenDealer::transferTokensToRelayChain
. Enter the destination account on the relay chain and the number of tokens to transfer as you desire. Confirm you balance has increased on the relay chain.The text was updated successfully, but these errors were encountered: