MetaMask / MetaMask/metamask-extension
[Bug]: Unable to Import accounts from multiple different Ledger HW wallets with the same HD path index
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
Describe the bug
Unable to import account from multiple different Ledger HW Wallets with the same HD path index (obviously each Ledger HW Wallet is initialised using its own unique passphrase).
Note: I used several Ledger Nano S Plus and Ledger Nano X wallets to test this.
When Importing account from 2nd Ledger HW Wallet using the same HD path index as the account already imported from the 1st Ledger HW Wallet, Metamask does NOT import the new account, but instead it just *switches* to the already imported account from the 1st Ledger HW Wallet.
This feels like that Metamask is using just the HD path (potentially perhaps just its 2nd half
account' / change / index) as the unique identifier of the account imported from Ledger HW wallet.
If this feeling is correct, then the unique identifier of HW wallet account shall include an additional component - something like public key, so the whole unique identifier would bepublic key+HD path, and *not* just HD path.
Expected behavior
When Importing account with the same HD path index from multiple different Ledger HW Wallets (each initialised with *different* passphrase), then each import shall create its own unique account in Metamask.
Screenshots/Recordings
No response
Steps to reproduce
For the purposes of this reproduction guide, the simple "Ledger" will mean "Ledger HW Wallet".
-
Connect the Ledger A (= NO other HW wallets are connected to the computer)
-
Import let say first 5 accounts from the connected Ledger A. Lets name them in the order:
- Acc-1 (HD path index 0),
- Acc-2 (HD path index 1),
- Acc-3 (HD path index 2),
- Acc-4 (HD path index 3),
- Acc-5 (HD path index 4)
-
Disconnect Ledger A from the computer
-
In Metamask select account Acc-5
-
Connect the Ledger B (= NO other HW wallets are connected to the computer)
-
Import the 2nd account in order from Ledger B (with the HD path index 1)
-
RESULT: Instead of importing a new account, Metamask just switches to the 2nd account already imported from Ledger A (with HD path index 1).
- There is NO error or message reported to the user on Metamask UI = all happens silently without any indication that something is wrong.
- Steps 6-7 can be repeated by selecting any account index, say the 3rd account in step 6, then in step 7 Metamask will switch to the 3rd already imported account Acc-3 instead of importing a new account.
This is 100% reproducible.
Error messages or log output
Where was this bug found?
Live version (from official store)
Version
13.41.0
Build type
None
Browser
Chrome
Operating system
MacOS
Hardware wallet
Ledger
Additional context
No response
Severity
- Severity is medium, since it disrupts the workflow for users which use multiple HW Wallets.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Ledger account import flow and the account identity handling described in the reproduction steps. Reproduce importing the same HD path index from Ledger A and Ledger B, then trace why the existing account is selected instead of a new one. Done means distinct accounts from different wallets can be imported and selected without silent switching.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100