Files
pezkuwi-runtime-templates/docs/modules/ROOT/pages/index.adoc
T
Gustavo Gonzalez 02b6611ec2 Add the option to sync faster with Rococo to the docs (#249)
* add sync fast-unsafe for Rococo

* fix spelling

* add descriptions for datadir path and rococo chainspec
2024-07-19 06:27:43 -04:00

129 lines
5.1 KiB
Plaintext

:source-highlighter: highlight.js
:highlightjs-languages: bash
= Polkadot Parachain Runtimes
A collection of runtimes that describe parachains with different purposes.
== Quick start
* Begin by visiting our link:https://github.com/OpenZeppelin/polkadot-runtime-template[repository]. You can fork it, use it as a template, or simply clone it to your local directory.
```bash
git clone git@github.com:OpenZeppelin/polkadot-runtime-template.git
```
* Move to the directory of the template you want to use. We will use the `generic runtime template` for this tutorial.
```bash
cd generic-template
```
* Build a release version of the runtime and node:
```bash
cargo build --release
```
* Receive some `ROC` from the link:https://paritytech.github.io/polkadot-testnet-faucet/[Rococo faucet]
* Reserve a ParaId on Rococo:
** Go to link:https://polkadot.js.org/apps[PolkadotJS]. Check that it points to Rococo testnet.
** Go to `Network` > `Parachains`
** Go to `Parathreads` tab
** Click the `+ ParaId` button
** Save a `parachain id` for the further usage.
** Click `Submit` and `Sign and Submit`.
* Generate and customize a chainspec:
** Generate a plain chainspec with this command:
+
```bash
./target/release/parachain-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 `rococo`.
*** Change `para_id` and `parachainInfo.parachainId` from `1000` to the previously saved parachain id.
** Generate a raw chainspec with this command:
+
```bash
./target/release/parachain-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 Rococo 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 Rococo).
+
```bash
./target/release/parachain-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 Rococo chainspec> \
--port 30343 \
--rpc-port 9977 \
--sync fast-unsafe
```
+
```bash
./target/release/parachain-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 Rococo 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 Rococo chainspec>` is where your Rococo chainspec is stored. You can download this file from the link:https://github.com/paritytech/polkadot-sdk/blob/release-polkadot-v1.10.0/polkadot/node/service/chain-specs/rococo.jsonofficial[official Polkadot sdk repository].
* Register a parathread:
** Generate a genesis state:
+
```bash
./target/release/parachain-template-node export-genesis-state --chain raw-parachain-chainspec.json para-<paraId>-genesis-state
```
** Generate a genesis wasm:
+
```bash
./target/release/parachain-template-node export-genesis-wasm --chain raw-parachain-chainspec.json para-<paraId>-wasm
```
** Go to link:https://polkadot.js.org/apps[PolkadotJS]. Check that it points to Rococo testnet.
** Go to `Network` > `Parachains`.
** Go to `Parathreads` tab.
** Click the `+ ParaThread` button.
** Insert `para-<paraId>-wasm` to `code` field.
** Insert `para-<paraId>-genesis-state` to `initial state` field.
** Click `Submit` and `Sign 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 Rococo go to `Developer` > `Extrinsics`.
** Submit an extrinsic `onDemandAssignmentProvider.placeOrderAllowDeath` or `onDemandAssignmentProvider.placeOrderKeepAlive`:
*** `maxAmount` should be not less than 10_000_000 and it is amount of 0.00001 ROC. It is an amount of ROC paid for the block.
*** `paraId` should be set to your parachain id.
*** Click `Submit` and `Sign and Submit`.
** In some time your parathread will produce a block and in one of the next blocks of Rococo there will be an inclusion of this block
== What's next?
- Read our general guides to understand more about the concepts of runtime development.
// TODO: change if we have more runtimes, add a link to the runtime doc
- Learn more about the runtime configuration. Currently, we have a single runtime template (generic one), and you can find documentation for it here.
- Explore the documentation for pallets. It may be useful if you are considering building a frontend for your parachain.