Launching your parachain manually
This guide is for manually onboarding a parachain to the Polkadot "Paseo" Testnet Locally
Introduction
Paseo is the community-run Polkadot Relay chain Testnet.
A typical development workflow for launching your parachain on Polkadot:
Run your parachain locally using Pop CLI.
Under the hood, Pop CLI launches your parachain to Paseo Local Testnet automatically for development purposes:
When ready to test your parachain in a live environment with other parachains:
Use this guide to mimic the manual onboarding process for Paseo Testnet locally.
When comfortable with manually onboarding locally, then use the next guide to onboard to Paseo Live Testnet.
Finally, when thoroughly tested on Paseo, launch on Polkadot
The process here is similar to launching on Paseo.
Let's get started.
Spin up Paseo locally
network.toml
Interesting Fact: We have three validator nodes so that we can use Polkadot's Warp Sync to quickly sync with the network. The minimum requirement for Warp Sync are three validator nodes.
Run the network:
The
--verbose
flag will allow us to see extra information such as the location of the chain spec for the local Paseo network that we are running.
Paseo should now be running on your machine and producing blocks. We can now move towards setting up our parachain.
Setting up our parachain
For the sake of this exercise, let's create a new parachain:
It will take some time for the parachain to build. In the meantime, we can start setting up our accounts.
Setting Up Accounts
First, we will need to set up a stash account to do transactions on Paseo on behalf of our collator.
A collator is the parachain node that will be running your parachain.
There are multiple ways to generate keys (accounts) on Polkadot, such as:
PolkadotJs Signer or any other custodial
Account creation should be done securely, such as using an air-gapped computer.
Create a Stash Account Key
For the sake of this guide, we will use subkey:
Once downloaded,
subkey
does not need an internet connection to work.
Let's create the stash account key:
If you do not have docker installed, you can download the polkadot-sdk and run the following command instead:
You should get an output similar to:
This your key (Polkadot account). Save the secret phrase in a vault securely and never share it.
Now that we have a stash account, we need to fund this account with some tokens so that it has funds to perform transactions on behalf of the collator such as transactions related to onboarding your parachain.
Add the stash account to the Polkadot Signer extension so that you can see your account appear in the PolkadotJs Apps UI.
Make sure it appears in the PolkadotJs Apps UI:
Notice that the balance is zero. Let's transfer some tokens from Alice's account to the stash account so that the stash account has funds to do transactions:
Optionally, if you knew your account beforehand, you could have pre-funded it when you spun up the Paseo network. More info here.
Cool. Our stash account is now funded on the Paseo Relay chain.
Create a Session Account Key
We now need to create one more account. In order for collators to produce blocks, they need to sign the block with a (session) key. We call this key the session key. This account is specifically created for block production.
Let's go ahead and create the session account key.
We can use subkey
to generate the keys for us.
Reminder that this should be done securely, such as using an air-gapped computer.
Save the secret phrase in a secure manner.
Creating the chain spec for the parachain
Let's create a chain spec for our parachain:
Build your parachain for release:
Create the chain spec:
This will output the following:
Your parachain's chain specification file
The plain text and the raw version e.g.
chain-spec.json
andchain-spec-raw.json
Your parachain's initial genesis state e.g.
para-2000-genesis-state
Your parachain's Wasm runtime e.g.
para-2000.wasm
For more advanced customization
pop build spec --help
Open the chain-spec.json
file in your editor.
Make sure to edit your chain spec and:
add your account and session keys
specify the starting balance of specific accounts
add the account that will be the sudo account for your parachain
It should look similar to the below:
Since we have modified our chain spec, we will need to re-generate the raw chain spec:
And re-generate the genesis state and wasm:
We are now ready to run our parachain's collator node to sync with Paseo and start producing blocks.
Running the Collator
In order to run your parachain's collator node you will need the raw chain spec that our local Paseo network is using.
This can be found in the output of when you ran the pop up parachain -f network --verbose
command.:
Copy this chain spec into our my-parachain
directory:
Note: Your Paseo chain spec path will be different from the above.
We will also need to create a node-key for your collator:
Alternatively you can use Polkadot SDK binary instead of a Docker image:
Run the collator with the following command:
The second half of this command specifies the Relay chain node to connect to. In this case, Alice is the validator node that we want to connect to. Alice is the bootnode for the Paseo network that we are running locally. Alice's ports can be found in the output from the
pop up parachain -f network.toml --verbose
command that we previously ran.
We now need to insert the session key into our running collator:
It will take time for your collator to sync with the local Paseo Relay chain.
We now need to onboard the parachain to Paseo.
Go to the Parachains tab.
Select "+ ParaId" and make sure to use the stash account:
Next, select "+ ParaThread". Make sure to use the stash account, upload your wasm and genesis state:
It will take a moment for the ParaThread to onboard:
Once onboarded, we now need to use sudo privileges (Alice account) on the Paseo Relay chain to "force" a lease for our parachain so that it can begin to use produce blocks.
Go to the "sudo" tab:
Use sudo privileges on the Relay chain to force a lease for our parachain:
In production, leases are assigned via the result of an on-chain auction.
Wait for the lease to take effect:
You will then see the parathread upgraded to a parachain:
After a few moments, you should see the parachain producing blocks. The included / backed will update with the Relay chain's block number in which your parachain's block was included and backed. You can also check your collator logs to confirm.
Congrats! Your chain is now producing blocks!
Next Steps
For next steps, you can try the following:
Designate one collator as the bootnode for the parachain's network
Add a second collator
Resources
Learning Resources
🧑🏫 To learn about Polkadot in general, Polkadot.network website is a good starting point.
⭕ Learn more about parachains here.
🧑🔧 For technical introduction, here are the Polkadot SDK documentation resources.
Technical Support
Create a question and tag it with "
pop
"Share the StackExchange question in our Pop Support Telegram channel
Last updated