Skip to content

Commit

Permalink
Establish HRMP channel article added
Browse files Browse the repository at this point in the history
  • Loading branch information
bgodlin committed Aug 15, 2023
1 parent 70ff68d commit 112f70f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ export default defineConfig({
text: "Substrate",
link: "substrate-bridge",
items: [
// { text: "Become a relayer" },
{
text: "Establishing HRMP channel",
link: "establishing-hrmp-channel",
},
],
},

Expand Down
37 changes: 37 additions & 0 deletions src/establishing-hrmp-channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Establish HRMP channel

To establish communication between your parachain and SORA, you'll need to create HRMP channels that act as bridges for messages. This guide will walk you through the process, using information from the official [Substrate documentation](https://docs.substrate.io/reference/how-to-guides/parachains/add-hrmp-channels/) but applied for SORA.

Remember that HRMP channels usually go in one direction. For two-way communication, you'll need to set up another channel going the opposite way. Therefore, the following is split in to sub-sections:

## Your Parachain to SORA

1. Obtain the encoded call data of the `hrmp.hrmpInitOpenChannel` extrinsic on the relay chain.

This special code includes a `recipient` detail that tells relay chain which parachain you would like to connect to. This detail changes depending on what environment you are planning to establish the channel in. For Kusama, look at [this list](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fksm-rpc.stakeworld.io#/parachains), and for Rococo, go to [this list](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-rpc.polkadot.io#/parachains).

::: info

Combine this parachain id with the other info from the documentation, and you'll end up with something like this for Rococo: `0x3c00db070000e803000000900100`.

:::

2. Within your parachain, compose an XCM message that notifies the relay chain about the intent to open a channel with SORA. Refer to the official documentation for an illustrative example of the XCM message.

::: info

It's important to acknowledge that if your implementation of HRMP channel logic differs from the standard `polkadotXcm.send` pallet, you should modify this step accordingly.

:::

Once the extrinsic executes successfully, SORA needs to accept the channel establishment.

3. Subsequently, the SORA team will accept the channel by incorporating the encoded call data of `hrmp.hrmpAcceptOpenChannel`. This data will feature your parachain's ID as a parameter and will be executed via the `xcmApp.sudoSendXCM` call.

Upon successful execution, the HRMP establishment from your parachain to SORA is finalized.

## SORA to Your Parachain

The steps here mirror those from the preceding sub-section. For steps (1) and (2) outlined earlier, SORA initiates an XCM message to propose channel establishment. Subsequently, it's your responsibility to encode `hrmp.hrmpAcceptOpenChannel` with SORA's parachain ID. For instance, in the case of Rococo, the encoded call data would be: `0x3c01db070000`. Execute an XCM message from your parachain in alignment with the official guidelines, including the encoded call data containing SORA's parachain ID.

Upon successful execution of this process, your parachain will be fully equipped to receive messages from the SORA parachain.

0 comments on commit 112f70f

Please sign in to comment.