2

A cross chain transfer generates several extrinsics depending on the number of hops. In this example: https://kusama.subscan.io/xcm_message/kusama-3c38ab02a51980022f63af373d4cad977cb9405b

we have a UMP transfer from Mangata to Kusama.

I'd like to be able to parse extrinsics just on the final destination (Kusama in this case) and pick up any KSM transfers happening cross chain (which are not happening with the regular transfer events).

The extrinsic on Kusama has a bunch of events but I'm not understanding how I should parse these to detect the transfer, transfer amount and generally any information.

When reading about XCM there's a lot of documentation explaining how to construct transactions which make up the first extrinsic but then the following extrinsics and events in the other chains seem more cryptic. If someone could point me in the right direction I would greatly appreciate

EDIT:

Adding to @Bruno's comment:

+1 for the subscan XCM dashboard links. 
 when searching for an XCM transfer hash on Subscan, it’s able to find a result and it links all the extrinsics across all the chains that were involved in the transfer. 

As far as I can see, it looks like Subscan is creating its own index after parsing all the blocks and somehow obtaining the XCM Transfer hash for each extrinsic involved. 
In the example above the XCM Transfer hash is part of the data on the destination chain block (the messageId: 0x3d3c511af2510f48be09d17bc3ff8897e79c95f850215931e8e42c2a50789ede) but it’s not present anywhere in the originator chain block. 

How is the XCM Transfer hash derived? 


To build something like the dashboard here: https://kusama.subscan.io/xcm_dashboard
 is there a way to query the chain for XCM transfers specifically or is Subscan parsing and indexing all blocks across all chains for XCM transfers and then linking together and making that information queryable?

1

1 Answer 1

2

Starting from the EDIT comments:

I do believe that Subscan's XCM dashboard tool works as you described. They run full nodes for every parachain and look for any XCM emitting extrinsic to track the XCM message in the ecosystem.

The hash that Subscan is showing is actually the hash of the encoded vec![XcmInstruction]. But this is not part of the XCM message itself nor part of the XCM specs currently. The good news is that XCM V3 will define a XCM message hash XcmHash to be returned when an XCM message is sent. This should work as a unique identifier for XCM messages in the ecosystem.

Regarding the events that the processing of an XCM message may emit in the receiving chain, I am afraid there is no concrete answer. It will depend on the config of each chain. However, I think you can have a good starting point by monitoring for:

  • ump(ExecutedUpward) if the receiving chain is the relay chain (Polkadot/Kusama).
  • xcmpqueue(Success) or dmpqueue(ExecutedDownward) if the receiving chain is a parachain.

Together with these, you should see other events giving more info on what was the result of processing the relevant XCM message at the receiving chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.