Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

README: Document usage of RPC node #2313

Merged
merged 5 commits into from
Mar 14, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,38 @@ and treat as best.
A Polkadot [collator](https://wiki.polkadot.network/docs/en/learn-collator) for the parachain is
implemented by the `polkadot-parachain` binary (previously called `polkadot-collator`).

### Relaychain Interaction
To operate a parachain, we need a connection to the corresponding relaychain.
Currently, there are two options available:
1. Use an in-process relaychain full-node
2. Connect to an external relaychain node via websocket RPC
skunert marked this conversation as resolved.
Show resolved Hide resolved

#### In-process Relaychain Node
This is the default. If a relaychain chain spec is passed to the node via command line arguments, the collator node spawns an in-process full node. This full node has all the typical components, including all polkadot subsystems, its own substrate networking stack, and the relaychain runtime.
skunert marked this conversation as resolved.
Show resolved Hide resolved

##### Example command
```shell=
# In-process node with this chainspec is spawned
# |
# |-----------------------|
polkadot-parachain --chain parachain-chainspec.json --tmp -- --chain relaychain-chainspec.json
```

#### External Relaychain Node
You can connect to an external relaychain node via websocket RPC by using the `--relay-chain-rpc-urls ws://<url>:<port>` command line argument. The specified remote node will be used to perform runtime calls and fetch information about new/best/finalized blocks from the relaychain.

Parachain nodes using this feature are generally more light-weight since it does not need to sync the relaychain. You can specify multiple websocket addresses to provide backup nodes. In case of connection loss, the parachain node will switch to the next node in the list.

**Note:** At this time parachain nodes will still spawn a minimal relaychain node in-process. The minimal relaychain node contains only a subset of the polkadot subsystems and a separate substrate networking stack.
skunert marked this conversation as resolved.
Show resolved Hide resolved
##### Example command
```shell=
# Perform runtime calls and fetch Still required since we connect
# data via RPC from here. Backup node to the relaychain network
# | | |
# |-------------------------------| |--------------------------------------| |-----------------------|
polkadot-parachain --chain parachain-chainspec.json --tmp --relay-chain-rpc-urls ws://relaychain-rpc-endpoint:9944 ws://relaychain-rpc-endpoint-backup:9944 -- --chain relaychain-chainspec.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.... will this actually work? Shouldn't the URLs be double-quoted? "?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually works, I copied this out of some scripts I have in use 👍 . But you are still right, I will quote it and agree that its best practice.

```

## Installation and Setup
Before building Cumulus SDK based nodes / runtimes prepare your environment by following Substrate [installation instructions](https://docs.substrate.io/main-docs/install/).

Expand Down