2

Could you explain what is GeneralKey is for in MultiLocation ?

For example:

Asset Name: Karura Native Token 
Asset Symbol:  KAR
Decimals:  12
existentialDeposit: 0.1
Multiloaction: { parents: 1, interior: { X2: [ {Parachain: 2000}, {GeneralKey: 0x0080} ]}}

2 Answers 2

3

GeneralKey: Usage will vary widely owing to its generality.

So it may have different meanings on different chains. And here, @insipx is right.

Then, you could find the location from the chain state of assets related pallets on other chains.

For example:

In karura: enter image description here

In Khala: enter image description here

In Moonriver: enter image description here


For local tokens, it depends on its XCM config: you mentioned Kabocha config, but it seems not right. You could refer to the config of Darwinia, for Darwinia, its token could be {parents: 1, X2(Parachain(2105), PalletInstance(5))} relative to other parachains. If this config doesn't have an interior junction, then it would be {parents:1, X1(Parachain(2105))}.

11
  • thanks for this. So in Kabocha parachain which only has one token, do i instead do X1, and no need for general key? polkadot.js.org/apps/?rpc=wss%3A%2F%2Fkabocha.jelliedowl.net#/… Nov 26, 2022 at 19:28
  • @Decentration Too long for a comment, so I updated the answer.
    – Guantong
    Nov 27, 2022 at 5:21
  • 1
    Yeah you need fix it and make a runtime upgrade.
    – Guantong
    Nov 30, 2022 at 14:40
  • 1
    If you want to use X2(Parachain(2113), PalletInstance(10)), you should set T to {parents: 0, X1(PalletInstance(<Balances as PalletInfoAccess>::index() as u8)) (refer to darwinia-parachain or other parachains), then upgrade the runtime. It's not a bug of cumulus, just a config of your parachain runtime.
    – Guantong
    Dec 1, 2022 at 2:01
  • 1
    No, you shouldn't make PR, it's just an initial template, those who use it will need to adjust it to their needs. And I'm a developer of Darwinia, this is my experience, I don't known where there are good docs.
    – Guantong
    Dec 6, 2022 at 3:41
2

GeneralKey refers to a general index that will be interpreted by the receiving chain to correspond to something, generally a Token.

In the example you show, General Key 0x008 is the location of KAR on Karura. When Karura gets an XCM with that MultiLocation, it knows that you want to do something with KAR and not some other token. If you change the GeneralKey to something else, Karura will interpet that as corresponding to a different token.

Lets break down the MultiLocation:

parents: 1 means the chain has one parent, (which is Kusama)

X2 means there are two junctions from that parent to get to the KAR token

Parachain: 2000 means the Karura parachain, which is assigned id 2000

GeneralKey: 0x0080 is the index of the KAR token on Karura

4
  • thanks. If i want to find what the General Key for the balances on a different parachain, how do i find it? How do i find the location of other things? I'm assuming 0x008 is little endian bytes? Nov 24, 2022 at 23:20
  • 1
    Each Parachain has their own way of organizing assets. You may have to dig into the code for some of them to find exactly how they classify different types of assets. Generally, however, parachains have an assetRegistry pallet that enumerates the assets which are supported and has a storage item that holds metadata along with the location of that asset, and often the name and symbol of the asset too. @Guantong has some example screenshots of this. You should be able to query this data on all the live parachains that have integrated XCM.
    – insipx
    Nov 25, 2022 at 5:19
  • ok great so if the parachain doesnt have some kind of assetRegistry then i only need the one junction X1? Nov 26, 2022 at 20:48
  • 1
    if the chain only has the native token, it could be a few things. Generally, it's X2(Parachain(ParachainId), PalletInstance(pallet_balances Index)). Like for moonbeam it is X2(Parachain(2004), PalletInstance(10)).
    – insipx
    Nov 27, 2022 at 18:47

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.