bip39: (CRITICAL) Incorrect derivation for certain BIP39 keys, fund loss >:(
Test case (by luck this is the first one I generated, thankfully I cross-referenced with other tools. Not all mnemonics / root keys trigger this bug)
mnemonic: fruit wave dwarf banana earth journey tattoo true farm silk olive fence
passphrase: banana
https://iancoleman.github.io/bip39/ derived first address: 17rxURoF96VhmkcEGCj5LNQkmN9HVhWb7F
(also shared by Electrum)
Other clients derive a different address (Copay, BIP32JP, etc): 13EuKhffWkBE2KUwcbkbELZb1MpzbimJ3Y
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (10 by maintainers)
Links to this issue
- Looking for ideas: Trying to regain access to funds last accessed via Ledger + MEW 2 years ago
- Digging deeper: why 24-words phase does not work - fuds lost with Ledger Nano S upgrade
- Looking for ideas: Trying to regain access to funds last accessed via MEW 2 years ago
- After a year of not using my ledger nano s, I can't access my ether anymore (posted this before, nobody was able to help / resolve yet)
- 636 days went by since my last transaction, still not able to access my ether, and I still don't see my mistake
- This is still on my mind and it bothers me, and to this day I can't find my error: After two years of not using my ledger nano s, I can't access my ether anymore (posted this before, nobody was able to help / resolve yet)
Commits related to this issue
- BIP 32: Test vectors for leading zeros These additional test vectors will ensure all future implementations are interoperable. See https://github.com/iancoleman/bip39/issues/58 and https://github.com... — committed to iancoleman/bips by deleted user 7 years ago
- add BIP39 test vectors (hardened derivation with leading zeros) see https://github.com/iancoleman/bip39/issues/58 — committed to ACINQ/bitcoin-lib by sstone 7 years ago
- BIP 32: Test vectors for leading zeros These additional test vectors will ensure all future implementations are interoperable. See https://github.com/iancoleman/bip39/issues/58 and https://github.com... — committed to hypo-test/BitcoinBips-713993353 by hypo-test 7 years ago
- BIP 32: Test vectors for leading zeros These additional test vectors will ensure all future implementations are interoperable. See https://github.com/iancoleman/bip39/issues/58 and https://github.com... — committed to gitsucker/better-Bitcoin-improvement-proposals by gitsucker 7 years ago
- Issue 58 test - bitcore bip32 derivation bug Closes #58 — committed to jsarenik/bip39 by deleted user 7 years ago
I’ve extensively compared results across several libraries, and
bcoin
(https://github.com/bcoin-org/bcoin),bitcoinjs-lib
(https://github.com/bitcoinjs/bitcoinjs-lib),libbtc
(https://github.com/libbtc/libbtc),hdkeys
(https://github.com/cryptocoinjs/hdkey), and many others, are all using correct BIP32 derivation.The derivation in Copay (and anything using bitcore-lib) is incorrect. The bug is when there is a leading zero of the private key and the hash during derivation does not include the zero. The BIP32 specification states that the size of the private key is always 32 bytes before it’s hashed.
FWIW: Funds will still be recoverable, however it may be cumbersome to derive both sets of private keys for recovery for those derivations affected.
NBitcoin: 17rxURoF96VhmkcEGCj5LNQkmN9HVhWb7F @dangershony I used @Thashiznets implementation, but kind of changed lots of stuff, so you might need to check also.
Output
BIP32JP now has more permanent fix in place.
So in theory, any wallet that makes 256 accounts in Copay will likely have one account that is wrong compared to other implementations.
@Thashiznets we should thank you for deving bip39, you are welcome to join the Blockchain C# community on stratisplatform.slack.com
@thashiznets @nicolasdorier This is the implementation we are using in C# https://github.com/Thashiznets/BIP39.NET I will try to run this mnemonic on our framework.
https://medium.com/@alexberegszaszi/why-do-my-bip32-wallets-disagree-6f3254cc5846#.86inuifuq
According to that post, the
17rxU...
address would be correct (ie this tool, electrum, bip32.org are correct)Bcoin seems to agree with iancoleman/bip39:
Output: