githubEdit

Launch a Chain to Paseo

This guide shows how launch a chain on Paseo (Local or Live)

Paseoarrow-up-right is the community-run Polkadot Relay chain Testnet. You can test onboarding a chain locally on Paseo Local before deploying it to the live Paseo Testnet.

Paseo Local

If you want to test onboarding a chain on your local machine you need to launch Paseo.

Paseo Live

Otherwise you will onboard to Paseoarrow-up-right.

Note: if not specified, all the following steps are the same for launching on Paseo Local / Live.

Generate Operational Keys

See here how to generate keys.

Collator Keys

When running a parachain collator, you typically need two distinct key pairs:

  1. Stash Account – A “long-term savings” or bonded account used for staking or holding tokens on behalf of the collator. This account holds the majority of your funds but is kept protected from routine usage.

  2. Session Key – The account the collator uses to sign and produce blocks in the network. If compromised, an attacker only gains the ability to author blocks, not access the stash account’s large reserve of funds.

Collator: A collator is the parachain node responsible for producing blocks and maintaining the parachain’s state.

Chain Manager Key

This account pays for actions like para ID reservation, parachain registration, and acquiring coretime.

Fund Chain Manager

Now that we have a Chain Manager account we need to fund this account with tokens to perform transactions on behalf of the collator.

Paseo Local

Note: the --url ws://localhost:57731 parameter should point to a Paseo Local node.

Paseo Live

Request PAS tokens on Paseo Faucetarrow-up-right.

Setting up the Chain

For the sake of this exercise, let's create a new chain project:

The folder includes a network.toml file which can be ignored. This is to launch a network with the chain already onboarded.

Generate the chain spec

The chain specification holds all the information the node requires to start or sync with the chain's network.

Let's generate a chain spec:

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 chain

It should look similar to the below:

Since we have modified our chain spec, we will need to re-generate the raw chain spec, genesis state and wasm:

Pop CLI allows you to provide the path to an existing chain spec file to edit or regenerate the artifacts.

We are now ready to sync with Paseo and start producing blocks!

Launch the Chain

In order to run your parachain's collator, you will need the raw chain spec of Paseo.

Paseo Local

The chain spec file can be found in the output of pop up network -f network --verbose. Copy the chain spec file into the my-chain directory:

Note: Your Paseo chain spec path may differ from the example above.

Paseo Live

Copy the Paseo chain spec filearrow-up-right into the my-chain directory:

Generate Node Key

We need to generate a node-key for the collator:

Using Docker

On your Machine

Run Collator

Run the collator with the following command:

The second half of this command specifies the Relay chain node to connect to.

The --base-path ./data is specified because the node key was placed into my-chain/data. You could use the --unsafe-force-node-key-generation flag to delegate the key generation to the node itself (IMPORTANT: not advised for a live testnet).

Last, we need to insert the session key into our running collator so that it can sign operational transactions:

Well done! Now look at the logs of your chain and you should see it being synced with Paseo!!!

Last step is to onboard the chain to Paseo.

Onboard Chain to Paseo

pop up simplifies the process of onboarding a chain to Paseo by automating both the reservation of an ID and its registration. Take the generated genesis state (para-2000-genesis-state) and genesis code (para-2000.wasm) and run:

Manual registration

If you prefer, you can still execute the steps separately using pop call chain.

We can reserve a para ID for the chain using pop cli:

In the events we can see the para_id that is assigned to the chain. Make sure this is the para ID specified in the chain spec file (and thus the chain artifacts).

Now we register the para ID with the generated genesis state (para-2000-genesis-state) and genesis code (para-2000.wasm).

Your chain is now registered on Paseo and should produce a block!

In order to validate and get your block finalised by the Relay chain, see here how to acquire core time.

Note: In the examples above, you are prompted to provide a <private-key> to interact with the chain. However, this implies a potentially insecure way of handling private keys and should only be used for development accounts. For production accounts and enhanced security, Pop CLI offers the --use-wallet option to securely sign transactions. Refer to the Securely sign transactions from CLI guide for detailed instructions.

Resources

Learning Resources

Need help?

Ask on Polkadot Stack Exchangearrow-up-right (tag it poparrow-up-right) or drop by our Telegramarrow-up-right. We're here to help!

Last updated

Was this helpful?