Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add example with genesis patch for parachain, i.e. adding assets to asset hub #1954

Open
brenzi opened this issue Feb 9, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@brenzi
Copy link

brenzi commented Feb 9, 2025

Is your feature request related to a problem? Please describe.

I had to reverse-engineer quite a bit to find out how to patch genesis as there are no docs about it.

Describe the solution you'd like

How about this example for asset hub?

[[parachains]]
id = 1000
addToGenesis = true
cumulus_based = true
chain = "asset-hub-rococo-local"

[parachains.genesis.runtimeGenesis.patch.balances]
balances = [
    ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", 3000000000000]
]

[parachains.genesis.runtimeGenesis.patch.assets]
accounts = [
    [1984, "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", 30000000000000]
]
assets = [
    [
        1984,
        "1jMhfSJv5MkSQmEq97UmXCmMV63SHoQ3ednwkRSKETrCREU",
        true,
        1
    ]
]
metadata = [
    [
        1984,
        [84, 101, 116, 104, 101, 114, 32, 85, 83, 68], # "Tether USD" as ASCII array
        [85, 83, 68, 84], # "USDT" as ASCII array
        6
    ]
]

[parachains.genesis.runtimeGenesis.patch.foreignAssets]
accounts = [
    [
        { parents = 2, interior = { X2 = [{ GlobalConsensus = { Ethereum = { chain_id = 1 } } }, { AccountKey20 = { key = [160, 184, 105, 145, 198, 33, 139, 54, 193, 209, 157, 74, 46, 158, 176, 206, 54, 6, 235, 72] } }] } },
        "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
        30000000000000
    ]
]
assets = [
    [# USDC on ethereum: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
        { parents = 2, interior = { X2 = [{ GlobalConsensus = { Ethereum = { chain_id = 1 } } }, { AccountKey20 = { key = [160, 184, 105, 145, 198, 33, 139, 54, 193, 209, 157, 74, 46, 158, 176, 206, 54, 6, 235, 72] } }] } },
        "1jMhfSJv5MkSQmEq97UmXCmMV63SHoQ3ednwkRSKETrCREU",
        true,
        1
    ]
]

Describe alternatives you've considered

No response

Additional context

No response

@pepoviola
Copy link
Collaborator

Hi @brenzi, sorry about the lack of documentation related to this feature. I will add docs for patching the genesis in both relay and parachain. Also, we can include that example in the repo and linking from the documentation.
Again, sorry about the lack of docks and thanks for your feedback and contribution!

Thx!

@pepoviola pepoviola added documentation Improvements or additions to documentation good first issue Good for newcomers labels Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants