-
Notifications
You must be signed in to change notification settings - Fork 30
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
Invalid Entropy with 24 words - BIP39 #5
Comments
Thanks for pointing this out. Do you know why there is a breaking change in bip39? |
I can confirm the same error with clean install latest MacOS + Homebrew even though I changed package.json to require v2.3.0 bip39 but does not help. readline.js:1029 TypeError: Invalid entropy Note: All 4 tests pass when running 'npm test' I can test more if someone wants me to try something, otherwise i am at a loss. EDIT: In Ubuntu, can't get it to pass the 4 npm tests. On MacOS, I was able to resolve the errors, but in Ubuntu, I can't. Not sure what logs might be helpful. |
@coop555 I suppose you get the same error when just using bip39 by itself? |
Hi. Thanks for getting back. I need help running BIP39 as a standalone node app. Not sure how to do it. I made some half hearted attempts at it today but failed. I assume you want me to directly run and see if it also fails, right? |
@coop555 yepp, that's right. In the seedsplit directory (if you cloned the git repo) just run this in your terminal: $ node
> let bip39 = require('bip39')
> bip39.mnemonicToEntropy("20 word seed") |
OK thanks. It works. Both the 21 word seed and longer 24 word seed returned appropriate entropy hex strings. Then I used both resultant entropy strings in the reverse bip39.entropyToMnemonic function, and they each returned the appropriate seed. The 24 word seed worked. Then I reran seedsplit -t 2 -s 3 with the same 24 word seed to confirm I got the same error: Enter seed mnemonic: TypeError: Invalid entropy Anything you'd like me to try? |
Oh, I see where the issue is. I'm padding the resulting split entopy with zeros to get the right length to do |
Awesome. I am glad you figured it. Let me know if there's anything else I can do to help. |
It's not because of padding with zeroes, this is because secrets.js (unmaintained and has bugs anyway) returns shards with If you change line 99 and 83 of bip39 to All in all, this is not an issue with seedsplit, but in the way secrets.js creates shares not compatible with bip39, and therefore making seedsplit not compatible with 24 seed words. Should change the readme to say it doesn't work with 24 word seeds. |
@mifunetoshiro thanks! I think it worked in an older version though :/ |
Yes, until bitcoinjs enforced the entropy to 128-256 bits in bip39, 2.4.0 it seems. |
I've found out that bip39 new version 2.4.0 breaks this module when working with 24 words.
You can change your package.json to download the 2.3.0 version and it should work fine.
[Related #3 ]
The text was updated successfully, but these errors were encountered: