In order to start a relay chain network you need to do some steps before:
- Compile
zkv-relay
andparatest
nodes - Generate relay chain spec file
- Generate parachain chain spec, genesis and wasm code
- Create the docker images for relay chain and parachain nodes
- Start compose file
- Start Parachain
cargo build --release -p zkv-relay --features "fast-runtime"
cargo build --release -p paratest-node
./target/release/zkv-relay build-spec \
--chain local \
--disable-default-bootnode > staging/plain-chainspec.json && \
./target/release/zkv-relay build-spec \
--chain staging/plain-chainspec.json \
--disable-default-bootnode --raw > staging/raw-chainspec.json
./target/release/paratest-node build-spec \
--chain local \
--disable-default-bootnode > staging/plain-parachain-chainspec.json && \
./target/release/paratest-node build-spec \
--chain staging/plain-parachain-chainspec.json \
--disable-default-bootnode --raw > staging/raw-parachain-chainspec.json && \
./target/release/paratest-node export-genesis-state \
--chain staging/raw-parachain-chainspec.json \
staging/paratest-genesis && \
./target/release/paratest-node export-genesis-wasm \
--chain staging/raw-parachain-chainspec.json \
staging/paratest-wasm
docker/scripts/build-zkv-relay-image-injected.sh
docker/scripts/build-paratest-image-injected.sh
docker compose -f docker/dockerfiles/zkv-relay-docker-compose.yaml up -d --remove-orphans
This compose starts 3 relaychain nodes and 3 parachain nodes:
- 2 relaychain validators (alice and bob)
- 2 parachain collators (alice and bob)
- 1 rpc gateway node for relay chain network that expose
9944
port for rpc and30333
port for p2p - 1 rpc gateway node for parachain network that expose
8844
port for rpc and20333
port for p2p
Now the complete network is up, and we can initialize the parachain:
- Point polkadot.js to the local chain at
ws://127.0.0.1:9944
- Initialize parachain: Developer->Sudo->
parasSudoWrapper
pallet->sudoScheduleParaInitialize
and set following data:id
:1599
.genesisHead
: Click file upload and upload the genesis state file instaging/paratest-genesis
.validationCode
: Click file upload and upload the WebAssembly runtime file instaging/paratest-wasm
.paraKind
: SelectYes
.
Now just wait (up to 2 epochs/minutes) and the parchain should start to forge the blocks regularly every 12 seconds.
You can access the parachain interface through polkadot.js at ws://localhost:8844
.
- To stop the chain use
docker compose -f docker/dockerfiles/zkv-relay-docker-compose.yaml down
with-v
flag if you need also clear the chain - To inspect the logs of a service use
docker compose -f docker/dockerfiles/zkv-relay-docker-compose.yaml logs <service>
where the available services arenode_alice
relay chain alice validatornode_bob
relay chain bob validatorcollator_alice
relay chain alice collatorcollator_bob
relay chain bob collatorlocal_node
relay chain gateway nodelocal_paranode
parachain gateway node
- To define node configurations and change the nodes log levels look at the files in
docker/resources/envs/[relay|para]
folders