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.
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 ParaId
s.
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
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 Instruction
s to make the above call.
WithdrawAsset
parents
should be 0
and the location is Here
.BuyExecution
Transact
Native
type will take on the origin of the parachain, in this case Westmint.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
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:
balances.force_transfer
F3opxRbN5ZbjJNU511Kj2TLuzFcDq9BGduA9TgiECafpg29
F7fq1jSNVTPfJmaHaXCMtatT1EZefCUsa7rRiQVNR5efcah
xcm_pallet.send
Root
.Encoded Call (NOT the call to use in the arg encoded
): 0x100208040200fe747dadf0f62c7d1bac6988a156fdd41cf2d14ccfdc15e289512a7073bbf2660070617261e80300000000000000000000000000000000000000000000000000000f0090eaf27c2c07630001000100a10f0204060202286beef41f00010100020c000400000000070010a5d4e81300000000070010a5d4e800060002286bee5c1002083301d00700003300d0070000e803000000900100
Call Hash: 0x7f798ed0414359a2c339cbe62e9ce453f43b5244d5dbde9f7e6819009b9c0238