nikania
Posted on April 21, 2023
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
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
Start Relay Bob
node:
./target/release/polkadot \
--bob \
--validator \
--base-path /tmp/relay-bob \
--chain rococo_local_raw.json \
--port 30334 \
--ws-port 9945
In case of restart, purge previous chain state:
rm -rf /tmp/relay/alice
rm -rf /tmp/relay-bob
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
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
💖 💪 🙅 🚩
nikania
Posted on April 21, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.