Quick start

This guide will help you deploy your own parachain on the Paseo testnet.

Prerequisites

  • Begin by visiting our repository. You can fork it, or simply clone it to your local directory.

git clone [email protected]:OpenZeppelin/polkadot-runtime-templates.git
  • Receive some PSO from the Paseo faucet

  • Reserve a ParaId on Paseo:

    • Go to PolkadotJS. Check that it points to Paseo testnet.

    • Go to Network > Parachains

    • Go to Parathreads tab

    • Click the + ParaId button

    • Save the parachain id for the further usage.

    • Click Submit and Sign and Submit.

Creating the chain spec

The chain spec is the collection of information that describes a Substrate-based blockchain network.

  • Move to the directory of the template you want to use. We will use the generic runtime template for this tutorial,but the same applies to the EVM Runtime Template.

cd generic-template
  • Build a release version of the runtime and node:

cargo build --release
  • Generate and customize a chainspec:

We use the generic-template-node executable throughout all the commands since we are using the generic-template, but make sure to update the name of the executable if you are using any of the other runtime template.

  • Generate a plain chainspec with this command:

    ./target/release/generic-template-node build-spec --disable-default-bootnode > plain-parachain-chainspec.json
  • Edit the chainspec:

    • Update name, id and protocolId to unique values.

    • Change relay_chain from rococo-local to paseo.

    • Change para_id and parachainInfo.parachainId from 1000 to the parachain id you reserved.

  • Generate a raw chainspec with this command:

    ./target/release/generic-template-node build-spec --chain plain-parachain-chainspec.json --disable-default-bootnode --raw > raw-parachain-chainspec.json

Running the nodes

Now it’s time to run the collator nodes.

  • Run two nodes and wait until it syncs with the Paseo relay chain. This can take a fairly long time(up to 2 days), so we can use the fast-unsafe flag to make the process faster since we are on a testnet(~ 3 hours). fast downloads the blocks without executing the transactions, and unsafe skips downloading the state proofs(which we are ok with since it is a testnet).

    ./target/release/generic-template-node \
        --alice \
        --collator \
        --force-authoring \
        --chain raw-parachain-chainspec.json \
        --base-path ./data \
        --port 40333 \
        --rpc-port 8844 \
        -- \
        --execution wasm \
        --chain <path to the Paseo chainspec> \
        --port 30343 \
        --rpc-port 9977 \
        --sync fast-unsafe
    ./target/release/generic-template-node \
        --bob \
        --collator \
        --force-authoring \
        --chain raw-parachain-chainspec.json \
        --base-path ./data \
        --port 40333 \
        --rpc-port 8845 \
        -- \
        --execution wasm \
        --chain <path to the Paseo chainspec> \
        --port 30343 \
        --rpc-port 9977 \
        --sync fast-unsafe
  • Register a parathread:

    • Generate a genesis state:

      ./target/release/generic-template-node export-genesis-state --chain raw-parachain-chainspec.json para-<parachainId>-genesis-state
    • Generate a genesis wasm:

      ./target/release/generic-template-node export-genesis-wasm --chain raw-parachain-chainspec.json para-<parachainId>-wasm
    • Go to PolkadotJS. Check that it points to Paseo testnet.

    • Go to Network > Parachains.

    • Go to Parathreads tab.

    • Click the + ParaThread button.

    • Insert para-<parachainId>-wasm to code field.

    • Insert para-<parachainId>-genesis-state to initial state field.

    • Click Submit and Sign and Submit.

Testing your parachain

When a parachain gets synced with the relaychain, you may start producing blocks as a parathread:

  • Create some transaction with PolkadotJS pointing to your parachain setup.

  • With PolkadotJS pointing to Paseo go to Developer > Extrinsics.

  • Submit an extrinsic onDemandAssignmentProvider.placeOrderAllowDeath or onDemandAssignmentProvider.placeOrderKeepAlive:

    • maxAmount should be not less than 10_000_000.

    • paraId should be set to your parachain id.

    • Click Submit and Sign and Submit. After a short period, your parathread will produce a block. This block will then be included in one of the subsequent Paseo relay chain blocks.

What’s next?

  • Read our general guides to understand more about the concepts of runtime development.

  • Learn more about the runtime configuration. Currently, we have two runtime templates: Generic Runtime Template and EVM Runtime Template.

  • Explore the documentation for pallets. It may be useful if you are considering building a frontend for your parachain.