Here are the instructions:
In order to try out on demand parachains on Rococo, first make sure you’ve grabbed some ROC from the testnet faucet https://paritytech.github.io/polkadot-testnet-faucet.
If you have a runtime on hand you can register it on a new ParaId
and onboard it as a Parathread
just like usual but do not request a parachain slot. After onboarding, starting a collator and syncing you can go straight on to the placing an order section.
If you don’t have a runtime ready but would like to try it anyway, you can read up on the setup for the adder collator section at the end of this post to get started with a ready to go runtime.
Placing an order
In Polkadot.js:
- Navigate to Developer → Extrinsics.
- Select
onDemandAssignmentProvider
from the “submit the following extrinsic” field. - Choose either
placeOrderAllowDeath
orplaceOrderKeepAlive
extrinsic. - The
maxAmount
field must be somewhere between10_000_000
and the maximum you would be willing to pay for a single on demand block. TheparaId
field should be set to theParaId
you registered and onboarded.
If the extrinsic was accepted and the collator is working, a new parachain block should be included within a few relay chain blocks depending on congestion.
In the case of an adder-collator
runtime, the block head will increase by 1 for each block added.
Looking up on demand price and other data
-
The price of an on demand block is calculated by multiplying
configuration.on_demand_base_fee
withSpotTraffic
, which is the output of a price controller. -
The base fee and parameters to the price controller are all exposed to governance. Most of these parameters can be located in the
configuration
pallet underon_demand_*
. -
The actual fee charged for an order is found in the
SpotOrderPlaced
event which is emitted on every placed order. -
The number of on demand parachains that can be processed in the same relay chain block is determined by the
configuration.on_demand_cores
value. -
A parachain cannot have parallel blocks on 2 or more different cores on the same relay chain block. Multiple orders for the same parachain will be processed sequentially.
-
The
onDemandAssignmentProvider
pallet stores the order queue underonDemandQueue
and the spot traffic multiplier can be found underspotTraffic
. -
The lowest amount that
maxAmount
can be set as is determined byconfiguration.on_demand.base_fee
, which by default is10_000_000
.
Setup for the adder collator
The following instructions will go through the steps needed to get an instance of adder-collator
up and running on Rococo as an on-demand parachain.
Compile the adder-collator
:
# In the polkadot-sdk repository
cargo build -r -p test-parachain-adder-collator
Export the genesis state for the adder-collator
:
# Still in the polkadot-sdk repository
./target/release/adder-collator export-genesis-state \
--chain=rococo \
$SOME_PATH/rococo-adder-genesis-state
In Polkadot.js:
- Register a new
ParaId
: Network → Parachains → Parathreads → ParaId. Note down theParaId
. - On the same page, register a
ParaThread
. TheParaId
should be the one used in step 1. Thecode
is obtained from./target/release/wbuild/test-parachain-adder/test_parachain_adder.compact.compressed.wasm
and theinitial_state
is obtained from$SOME_PATH/rococo-adder-genesis-state
that was generated earlier.
While waiting for onboarding to finish, launch the collator to start syncing with Rococo.
# You guessed it, polkadot-sdk repository
./target/release/adder-collator \
--parachain-id=$YOUR_PARA_ID \
--chain=rococo
If you don’t have a backup available on hand, this might take a while (a couple of days in my experience).