Try โ€‚โ€‰HackMD

Channel Opening (Common Good Paras)

Goal: Accept a channel request (for incoming messages) and make a return channel request (for outgoing messages).

The message must come from a parachain, meaning we need to send a message from the Relay Chain to Westmint telling it to send a message back to the Relay Chain with the transactions we want to make.

Only the last call should be submitted on chain, as it includes the prior calls.

Transaction on Relay Chain (from parachain) to Accept/Request Channels

Batch of calls, constructed on Westend. This is what we want the parachain to execute and should not be submitted by any account.

In this example, it accepts a one-way channel request from para 2000 and then requests another one-way channel back to 2000. These could be any instructions and not specific to one parachain. For example, it could be to request one-way channels to multiple ParaIds.

  • Accept a pending channel request from para 2000.
  • Request a return channel with para 2000, with given max capacity and max message size.

Note: Before 4470 makes it into a Kusama runtime, we may suggest one-way channels, i.e. no hrmpAcceptOpenChannel call.

Encoded Call (to use as arg encoded in the next step): 0x1002083301d00700003300d0070000e803000000900100
Call Hash: 0xa80cddfdbbc5f64052e3c26a706b7518f56909a196c91d1a65ceb97995627763

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’

Message from Westmint to Relay Chain

Now we need Westmint to send the above call to Westend. Construct this on the parachain, here Westmint, but do not execute it.

The parachain will need some funds in its Relay Chain account (derived as such). In the case of Statemine/Westmint, its ParaId is 1000, so its AccountId is 0x70617261e8030000000000000000000000000000000000000000000000000000. We will handle funding this account in the next step.

The parachain will need to buy some execution on the Relay Chain, so the array of XCM V2 instructions needs a few Instructions to make the above call.

  • Instruction 1: WithdrawAsset
    • This is in the context of its execution, which is on the Relay Chain, so parents should be 0 and the location is Here.
    • In the example we used 1 WND. In actuality, it used 0.025350448 WND.
  • Instruction 2: BuyExecution
    • Now the para will use its withdrawn assets to pay for some execution.
  • Instruction 3: Transact
    • The Native type will take on the origin of the parachain, in this case Westmint.
    • The encoded call should be the call constructed above. These are the instructions we want to execute on behalf of the parachain.

Encoded Call (to use as arg encoded in the next step): 0x1f00010100020c000400000000070010a5d4e81300000000070010a5d4e800060002286bee5c1002083301d00700003300d0070000e803000000900100
Call Hash: 0x11576ce2303ef55211e5c44bdc96c613bb162485682781e36c0bc08aae9210b2

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’

Message from Westend to Westmint

Although we have Sudo on Westmint, we do not have governance on Statemine. The message needs to come from the Relay Chain telling the parachain to send the above message back.

We also need some funds for the deposit. These should come from the treasury. For Westend, we'll use the faucet, 5HpLdCTNBQDjFomqpG2XWadgB4zHTuqQqNHhUyYbett7k1RR. Amounts come from configuration.activeConfig. At this time (Kusama v9130), the deposit is 5 KSM per one-way channel (i.e. a bi-directional channel would require 10 KSM). Make sure to force_transfer a little more for the WithdrawAsset instruction.

This is the transaction to submit as Root on the Relay Chain. On a live network, this call hash would be used for the proposal.

We will make a batch of two calls:

  • Call 1: balances.force_transfer
    • This will take some funds from the Treasury and place them in the parachain's account.
    • Kusama Treasury: F3opxRbN5ZbjJNU511Kj2TLuzFcDq9BGduA9TgiECafpg29
    • Statemine Account:F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah
  • Call 2: xcm_pallet.send
    • Actually send the above call to the parachain, as Root.

Encoded Call (NOT the call to use in the arg encoded): 0x100208040200fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf2660070617261e80300000000000000000000000000000000000000000000000000000f0090eaf27c2c07630001000100a10f0204060202286beef41f00010100020c000400000000070010a5d4e81300000000070010a5d4e800060002286bee5c1002083301d00700003300d0070000e803000000900100
Call Hash: 0x7f798ed0414359a2c339cbe62e9ce453f43b5244d5dbde9f7e6819009b9c0238

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More โ†’