Quick start
-
Begin by visiting our repository. You can fork it, or simply clone it to your local directory.
git clone git@github.com:OpenZeppelin/polkadot-runtime-templates.git
-
Move to the directory of the template you want to use. We will use the
generic runtime templatefor this tutorial, but it is the same for the same applies to the EVM Runtime Template.
cd generic-template
-
Build a release version of the runtime and node:
cargo build --release
-
Receive some
PSOfrom the Paseo faucet -
Reserve a ParaId on Paseo:
-
Go to PolkadotJS. Check that it points to Paseo testnet.
-
Go to
Network>Parachains -
Go to
Parathreadstab -
Click the
+ ParaIdbutton -
Save the
parachain idfor the further usage. -
Click
SubmitandSign and Submit.
-
-
Generate and customize a chainspec:
|
We use the |
-
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,idandprotocolIdto unique values. -
Change
relay_chainfrompaseo-localtopaseo. -
Change
para_idandparachainInfo.parachainIdfrom1000to the previously saved parachain id.
-
-
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-
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-unsafeflag to make the process faster since we are on a testnet(~ 3 hours).fastdownloads the blocks without executing the transactions, andunsafeskips 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 <path to datadir> \ --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 <path to datadir> \ --port 40333 \ --rpc-port 8845 \ -- \ --execution wasm \ --chain <path to the Paseo chainspec> \ --port 30343 \ --rpc-port 9977 \ --sync fast-unsafe
-
-
<path to datadir>is where the downloaded chain state will be stored. It can be any folder on your computer. -
<path to the Paseo chainspec>is where your Paseo chainspec is stored. You can download this file from the official Polkadot sdk repository.-
Register a parathread:
-
-
Generate a genesis state:
./target/release/generic-template-node export-genesis-state --chain raw-parachain-chainspec.json para-<paraId>-genesis-state -
Generate a genesis wasm:
./target/release/generic-template-node export-genesis-wasm --chain raw-parachain-chainspec.json para-<paraId>-wasm -
Go to PolkadotJS. Check that it points to Paseo testnet.
-
Go to
Network>Parachains. -
Go to
Parathreadstab. -
Click the
+ ParaThreadbutton. -
Insert
para-<paraId>-wasmtocodefield. -
Insert
para-<paraId>-genesis-statetoinitial statefield. -
Click
SubmitandSign and Submit.-
When a parachain gets synced with a relaychain, you may start producing blocks as a parathread:
-
-
Create some transaction with a PolkadotJS pointing to your parachain setup.
-
With a PolkadotJS pointing to Paseo go to
Developer>Extrinsics. -
Submit an extrinsic
onDemandAssignmentProvider.placeOrderAllowDeathoronDemandAssignmentProvider.placeOrderKeepAlive:-
maxAmountshould be not less than 10_000_000 and it is amount of 0.00001 PAS. It is an amount of PAS paid for the block. -
paraIdshould be set to your parachain id. -
Click
SubmitandSign and Submit.
-
-
In some time your parathread will produce a block and in one of the next blocks of Paseo there will be an inclusion of this block
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.