Skip to content

Add multi-account support for Avalanche X/P chains in QR code generation #2052

@MoonBoi9001

Description

@MoonBoi9001

Summary

The QR code generation for Avalanche currently only includes account 0 for X/P chains. This prevents users from using multiple accounts with air-gapped Keystone devices.

Current Behavior

In src/ui/gui_wallet/multi/web3/gui_wallet.c, the GuiGetCoreWalletData function hardcodes only account 0:

ChainPath_t chainPaths[] = {
    {.path = "m/44'/60'/0'", .chainType = XPUB_TYPE_ETH_BIP44_STANDARD},
    {.path = "m/44'/9000'/0'", .chainType = XPUB_TYPE_AVAX_X_P},
};

Expected Behavior

Support multiple accounts (e.g., 0-9) similar to how Ledger Live accounts are handled:

for (int i = XPUB_TYPE_ETH_LEDGER_LIVE_0; i <= XPUB_TYPE_ETH_LEDGER_LIVE_9; i++) {
    // includes accounts 0-9
}

Impact

  • Users can only use account 0 for X/P chain operations when connecting via QR code
  • Adding additional accounts results in those accounts not having X/P chain addresses
  • This affects cross-chain transfers and P-chain staking for accounts beyond the first one

Proposed Solution

  1. Add new XPUB types: XPUB_TYPE_AVAX_X_P_0 through XPUB_TYPE_AVAX_X_P_9
  2. Update the QR generation to include multiple Avalanche account xpubs
  3. The Rust code in rust/apps/wallets/src/core_wallet.rs already supports paths starting with 44'/9000'/ so it should work once the C code provides multiple keys

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions