Currently to process an XCM message in my own pallet call, I inherit the config of my pallet from frame_system + pallet_xcm to have a representable origin:

pub trait Config: frame_system::Config + pallet_xcm::Config {
    // We need a specified origin to be used with the functions of the pallet_xcm that take an origin
    type Origin: From<<Self as frame_system::Config>::Origin>
    + Into<Result<XcmOrigin, <Self as Config>::Origin>> + Debug;

After this I can call a function like ensure_xcm from the pallet_xcm like this:

ensure_xcm(<T as Config>::Origin::from(origin))

My problem is that ensure_xcm gets the origin as the parachain id, but I want the account that created the xcm message in the first place, not just the parachain. It this possible?

2 Answers 2


You seem to be looking for a xcm instruction: DescendOrigin

Mutate the origin to some interior location.

It will append an account to the origin location (which include paraId you mentioned above).

For example, you create a XCM with account [0u8;32]:

            BuyExecution {..},
            DescendOrigin(X1(AccountId32 { network: .., id: [0u8;32] })),
            Transact(<your pallet call>)

Before your pallet is called by transact, the origin of xcm will be converted by OriginConverter, you can find this configuration in XcmCExecutorConfig. And you can customize your converter as needed, such as use the account who created the xcm [0u8;32] to sign the origin.

After that, your ensure_origin in your call will get the account who created the xcm.


If you use polkadot's pallet-xcm.send, it will add the DescendOrigin instruction for you when you need.


It sounds like you'll have to construct a custom XCM that encodes, as a message parameter, the creator of the message. As you've remarked, the message origin is always the parachain ID.

This can be described throughout this XCM format spec: https://github.com/paritytech/xcm-format. Here the origin as always a MultiLocation, since messages come from specific locations and thus can't be externally-owned accounts as far as I know.

You could implement and send a Tranasct XCM in combination with a specific extrinsic that allows you to dispatch and process such XCMs across 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.