--ledgerLiveMode iterates the BIP-44 change index instead of the hardened account index
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- cli
Research direction
Start in packages/cli/src/base.ts and packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts, tracing how Ledger Live indexes become derivation paths. Add coverage for account index 1 or 2, then run the relevant CLI and wallet tests; done means --ledgerLiveMode --ledgerAddresses 3 derives account paths 0'/0/0, 1'/0/0, and 2'/0/0.
Written by the indexing model from the issue text.
Description
Package
@celo/celocli9.0.1@celo/wallet-ledger8.0.4
Both packages are up to date.
Environment
- macOS on Apple Silicon
- Ledger Nano X
Command
celocli account:list --useLedger --ledgerAddresses 3 --local --ledgerLiveMode
Describe the bug
--ledgerLiveMode does not discover Ledger Live accounts beyond the first account.
With the default Ethereum base path m/44'/60'/0', the command above derives:
m/44'/60'/0'/0/0
m/44'/60'/0'/1/0
m/44'/60'/0'/2/0
Ledger Live's standard BIP-44 account paths are instead:
m/44'/60'/0'/0/0
m/44'/60'/1'/0/0
m/44'/60'/2'/0/0
I confirmed this directly against a Ledger Nano X. The expected third Ledger Live account was returned for m/44'/60'/2'/0/0, but not by celocli --ledgerLiveMode --ledgerAddresses 3.
Expected behavior
--ledgerLiveMode --ledgerAddresses 3 should retrieve hardened account indexes 0, 1, and 2:
m/44'/60'/0'/0/0
m/44'/60'/1'/0/0
m/44'/60'/2'/0/0
Actual behavior
It fixes the account component at 0' and iterates the non-hardened change component. Only the first Ledger Live account is therefore discoverable. Transactions from later accounts fail because the --from address is not loaded into the Ledger wallet.
Likely cause
In packages/cli/src/base.ts, Ledger Live mode maps the requested indexes to changeIndexes:
derivationPathIndexes: isLedgerLiveMode ? [0] : indicesToIterateOver,
changeIndexes: isLedgerLiveMode ? indicesToIterateOver : [0],
In packages/sdk/wallets/wallet-ledger/src/ledger-wallet.ts, the account component is fixed by baseDerivationPath:
const [purpose, coinType, account] = this.baseDerivationPath.split('/')
for (const changeIndex of this.changeIndexes) {
for (const addressIndex of this.derivationPathIndexes) {
const derivationPath =
`${purpose}/${coinType}/${account}/${changeIndex}/${addressIndex}`
}
}
This prevents --ledgerLiveMode from iterating the hardened account component.
Ledger Live's default scheme is 44'/<coin_type>'/<account>'/<node>/<address>:
- Ledger Live derivation implementation
- BIP-44 path levels
--ledgerLiveModeintroduction: PR #488- Original issue #448
Suggested fix
Support iterating accountIndexes, producing:
`${purpose}/${coinType}/${accountIndex}'/${changeIndex}/${addressIndex}`
Ledger Live mode should effectively use:
accountIndexes: indicesToIterateOver
changeIndexes: [0]
derivationPathIndexes: [0]
Tests should include account index 1 or 2; index 0 cannot distinguish the incorrect path from the Ledger Live path.
Workaround
Set the desired account as the base path and do not use --ledgerLiveMode:
celocli config:set --derivationPath "m/44'/60'/2'"
celocli account:list --useLedger --ledgerAddresses 1 --local
This derives m/44'/60'/2'/0/0. Restore the default afterward with:
celocli config:set --derivationPath eth
- Dominant language
- TypeScript
- Stars
- 43
- Forks
- 36
- Avg merge
- 1h 35m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from celo-org/developer-tooling
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
celo-org/developer-tooling#793 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
celo-org/developer-tooling#786 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
celo-org/developer-tooling#800 · 1 comment ·
-
Bridge commands duplicate signer construction and miss new signer typesPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 68/100
celo-org/developer-tooling#794 ·
-
bug celocli
Difficulty 4/5 3-5 days Newbie friendliness 50/100
celo-org/developer-tooling#790 ·
All issues in celo-org/developer-tooling
Similar issues
-
ready-for-ai
Difficulty 1/5 Under an hour Newbie friendliness 88/100
umbraco/Umbraco-CMS-MCP-Dev#647 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
HelloAOLab/seed-bible#2173 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
hocinehacherouf/liberarr#77 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
LibreChat-AI/LibreChat#18225 ·
Maintainers usually reply within 1 day
-
b-ber/build/epub b-ber/themes
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
triplecanopy/b-ber#790 ·
Maintainers usually reply within 1 day