Open HRMP Channels
Overview
Before two parachains can communicate directly with one another, they must open channels with one another. Since each channel is uni-directional, two of them must be opened; one in each direction.
Technical Instructions
Understanding the Parameters
Opening a channel requires that the parachain sovereign account on the Relay Chain have a balance in the native token (KSM or DOT). This is mandatory, otherwise, the channel opening will fail, as the transactions won't be executed.
The easiest way to check the required parameters is by opening the Relay Chain in Polkadot.js Apps, under Developer -> Chain State -> configuration
-> activeConfig
. What you're interested in will look like this (taken from Polkadot):
hrmpMaxParachainOutboundChannels: 30
hrmpMaxParathreadOutboundChannels: 0
hrmpSenderDeposit: 100,000,000,000
hrmpRecipientDeposit: 100,000,000,000
hrmpChannelMaxCapacity: 1,000
hrmpChannelMaxTotalSize: 102,400
hrmpMaxParachainInboundChannels: 30
hrmpMaxParathreadInboundChannels: 0
hrmpChannelMaxMessageSize: 102,400
Based on the information above, we can see that 10 DOT is required to open a channel or to confirm it. We can also see that there are a maximum number of inbound and outbound channels per parachain - 30 in the case of Polkadot, at the time of this writing.
The two parameters that need to be specified when opening a channel are:
max_capacity
- max number of messages that can be queued in the channel.max_message_size
- max size of the message being sent.
We can choose the max values when opening the channel accordingly.
Relay Chain Encoded Call
The first step is to prepare the encoded call data for either requesting channel opening, or accepting an existing open channel request.
- Visit polkadot.js app in your browser and select either Polkadot or Kusama.
- Click on
Developer -> Extrinsic
. - Find hrmp under all the available pallets and select it.
- Select the
hrmpInitOpenChannel
call and fill out the parameters.- recipient: the parachain with which you want to open the channel.
- proposedMaxCapacity: pick the value from activeConfig.
- proposedMaxMessageSize: pick the value from activeConfig.
- Copy and store the encoded call data for later:
- e.g.
0x3c00d6070000e803000000900100
- e.g.
You can repeat the exact same steps to get the encoded call data for hrmpAcceptOpenChannel.