Are there any customized call examples in parachain XCM transact?

More specificily, i want to know the differnece of transact call construction in different pallet and the same pallet bwtween two parachain.

I know that cumulus have a pallet called ping,that is used to take the case of the same pallet transact call between different parachain,that is so cool. In ping pallet, the transact call which will pass to the destination parachan can be constructed by the dispatchable call in origin parachain,Since the transact call is same as the pallet call in destination parachain.

But when i want to construct a XCM transact call in origin parachain to dispatch the destination parachain pallet where the method is not in the origin parachain pallet.how can i do it ?

so, my question is:
if i want dispatch a call in destination parachain's pallet and the call is not in my origin parachain pallet.in this case, how can i construct my call in XCM transact which is different from the ping

  • If you want a more specific answer, you should include what you are trying to do specifically.
    – Shawn Tabrizi
    Mar 27, 2022 at 15:53

2 Answers 2


the simple example is in polkadot xcm-simulator example.

in theory, the call inside Transact can be any dispatch call, as long as it's encoded. because it's need to transfer to remote chain to do real dispatch call.

a practical case such as parachain want to send xcm to relaychain, and let relaychain do some dispatch call, i.e. Acala use this xcm message format. for example to batch call, or staking bond etc.


If you look at the Tranasct instruction, you will see it expects a DoubleEncoded<Call> with a generic Call parameter:

pub enum Instruction<Call> {
    /// Apply the encoded transaction `call`, whose dispatch-origin should be `origin` as expressed
    /// by the kind of origin `origin_type`.
    /// - `origin_type`: The means of expressing the message origin as a dispatch origin.
    /// - `max_weight`: The weight of `call`; this should be at least the chain's calculated weight
    ///   and will be used in the weight determination arithmetic.
    /// - `call`: The encoded transaction to be applied.
    /// Safety: No concerns.
    /// Kind: *Instruction*.
    /// Errors:
    Transact {
        origin_type: OriginKind,
        require_weight_at_most: u64,
        call: DoubleEncoded<Call>,
    // ...

This Call should be the Call type of the chain you want to access, and can change depending on which chain you are calling. So you must coordinate with the chain you are calling, and hard code the Call type for that chain into your runtime.

As you can imagine, this is the only way that two different chains can generically call transact.

This is actually why XCM exists at all, to make common calls that different parachains would need to interact with each other generic, and independent of an underlying changing Call type that would be unique to each chain.

  • thanks, that is to say, i need to integrate the destination parachain's pallet in my origin parachain, so that i can dispatch the call. in this sense, XCM only can dispatch call in this way that is same as the ping pallet
    – bun
    Mar 30, 2022 at 3:07
  • You do not need to integrate the whole pallet, just the Call enum.
    – Shawn Tabrizi
    Mar 30, 2022 at 12:38
  • i have some confuse about how to set the Call enum, can you show me some example code ? thanks a lot
    – bun
    Mar 31, 2022 at 5:58

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.