DEV Community

nikania
nikania

Posted on • Updated on

Quick list - starting local parachain testnet

Quick CLI reference to start local testnet with 2 relay chain nodes and 1 parachain node. Based on detailed official tutorial

To start relay chain, firstly build chain spec:

./target/release/polkadot \ 
build-spec --chain rococo-local --raw > rococo_local_raw.json
Enter fullscreen mode Exit fullscreen mode

in the resulting file set "bootNodes": [] (and unique "id": "qwerty" - optional, only if there are other testnets in your local network)

Start Relay Alice node:

./target/release/polkadot \
--alice \
--validator \
--base-path /tmp/relay/alice \
--chain rococo_local_raw.json \
--port 30333 \
--ws-port 9944
Enter fullscreen mode Exit fullscreen mode

Start Relay Bob node:

./target/release/polkadot \
--bob \
--validator \
--base-path /tmp/relay-bob \
--chain  rococo_local_raw.json \
--port 30334 \
--ws-port 9945
Enter fullscreen mode Exit fullscreen mode

In case of restart, purge previous chain state:

rm -rf /tmp/relay/alice
rm -rf /tmp/relay-bob 
Enter fullscreen mode Exit fullscreen mode

To start parachain

build spec (again, set unique "id" if needed) and wasm and genesis:

./target/release/parachain-collator \ 
build-spec --disable-default-bootnode > rococo-local-parachain-plain.json
./target/release/parachain-collator \
build-spec --chain rococo-local-parachain-plain.json --raw \
--disable-default-bootnode > rococo-local-parachain-2000-raw.json

./target/release/parachain-collator \
export-genesis-wasm --chain rococo-local-parachain-2000-raw.json > para-2000-wasm
./target/release/parachain-collator \
export-genesis-state --chain rococo-local-parachain-2000-raw.json > para-2000-genesis
Enter fullscreen mode Exit fullscreen mode

register ParaId by Alice on relay chain

Start parachain

./target/release/parachain-collator \
--alice \
--collator \
--force-authoring \
--chain rococo-local-parachain-2000-raw.json \
--base-path /tmp/parachain/sora-parachain-alice \
--port 40333 \
--ws-port 8844 \
--log xcm=trace \
-- \
--execution wasm \
--chain .._path_to_relay_chain_spec_/rococo_local_raw.json \
--port 30344 \
--ws-port 9977
Enter fullscreen mode Exit fullscreen mode

Submit sudo on relay chain:
Image description

Top comments (0)