5

I deployed a relay chain node using the provided docker container:

docker run \
    --detach \
    --name=polkadot \
    --volume="$(pwd)/data:/data" \
    --network=host \
    --entrypoint=polkadot \
    "parity/polkadot:v0.9.12" \
    --pruning=archive \
    --name=polkadot-mainnet-123 \
    --database=rocksdb \
    --base-path=/data \
    --port=30333 \
    --rpc-port=8833 \
    --rpc-cors=all \
    --rpc-external \
    --ws-port=8844 \
    --ws-external \
    --in-peers=5 \
    --out-peers=5 \
    --max-parallel-downloads=5 \
    --prometheus-port=9688

I also deployed a parachain node with the provided docker container (Moonbeam in this case):

docker run \
    --detach \
    --name=moonbeam \
    --volume="$(pwd)/data:/data/volume" \
    --network=host \
    --entrypoint="/moonbeam/moonbeam" \
    "purestake/moonbeam:sha-7b9a2ceb" \
    --chain=moonbeam \
    --base-path=/data/volume \
    --name=moonbeam-mainnet-123 \
    --port=30340 \
    --rpc-port=9988 \
    --rpc-cors=all \
    --rpc-external \
    --ws-port=9999 \
    --ws-external \
    --in-peers=5 \
    --out-peers=5 \
    --prometheus-port=9636 \
    -- \
    --name=polkadot-mainnet-456 \
    --port=30341 \
    --rpc-port=19988 \
    --rpc-cors=all \
    --rpc-external \
    --ws-port=19999 \
    --ws-external \
    --in-peers=5 \
    --out-peers=5 \
    --prometheus-port=19636

As you can see the Moonbeam node has a relay chain node bundled in the same deployment.

This is also true of most other parachain nodes (e.g. Astar, Acala etc.).

This is quite surprising to me as I initially thought it should be relatively trivial to point the parachain node at an existing (fully synced) relay chain node, and have it establish a connection through a Unix socket or a TCP port.

Naturally having each parachain deploy and sync its own relay chain node is not ideal since the relay chain node is usually the most resource intensive aspect of the deployment and so having to replicate it with every parachain deployment is an unnecessary waste of compute resources.

I understand that the Cumulus framework is used to register a parachain and connect with the relay chain, but why is the parachain node tied to the relay chain node in the same binary of most parachain projects - is it just for convenience or is there a technical reason of why the nodes have to be deployed together?

1 Answer 1

3

The parachain node and the relay chain node were tightly coupled and could not be run individually. The parachain node directly calls into the relay chain client. Not all of the required relay chain functionality is exposed via RPC API, so separation of the nodes is not straightforward.

However, there is an ongoing effort to separate these two nodes and give users the option to run them separately: https://github.com/paritytech/cumulus/issues/545. Once this work is finished, you will be able to run the parachain and relay chain nodes as individual processes. In recent versions of cumulus, there is already experimental support for running parachain full nodes with the following command:

polkadot-collator --relay-chain-rpc-url ws://localhost:<relay_chain_rpc_ws_port> ...  

The relay-chain-rpc-url should point to the WebSocket API of your running relay chain full node.

Please note that collation is currently not supported, so you cannot supply the --validator or --collator flags in combination with --relay-chain-rpc-url.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.