Giter Club home page Giter Club logo

Comments (11)

oed avatar oed commented on September 4, 2024

Thanks for pointing this out. Do you know why there is a breaking change in bip39?

from seedsplit.

coop555 avatar coop555 commented on September 4, 2024

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
throw err;
^

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:
I also just installed it on a clean Ubuntu 17.10. Same error there. 15 words work. But 24 words still fail with the Entropy error.

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.

from seedsplit.

oed avatar oed commented on September 4, 2024

@coop555 I suppose you get the same error when just using bip39 by itself?

from seedsplit.

coop555 avatar coop555 commented on September 4, 2024

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
bip39.mnemonicToEntropy("24 word seed")
or
bip39.mnemonicToSeedHex('24 word seed')

and see if it also fails, right?

from seedsplit.

oed avatar oed commented on September 4, 2024

@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")

from seedsplit.

coop555 avatar coop555 commented on September 4, 2024

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:
readline.js:1029
throw err;
^

TypeError: Invalid entropy
at Object.entropyToMnemonic (/usr/local/lib/node_modules/seedsplit/node_modules/bip39/index.js:99:34)
at shards.map.shard (/usr/local/lib/node_modules/seedsplit/lib/seedsplit.js:16:18)
at Array.map ()
at Object.split (/usr/local/lib/node_modules/seedsplit/lib/seedsplit.js:14:31)
at result (/usr/local/lib/node_modules/seedsplit/bin/cli.js:29:36)
at prompt.get (/usr/local/lib/node_modules/seedsplit/bin/cli.js:60:7)
at /usr/local/lib/node_modules/seedsplit/node_modules/prompt/lib/prompt.js:336:32
at /usr/local/lib/node_modules/seedsplit/node_modules/async/lib/async.js:154:25
at assembler (/usr/local/lib/node_modules/seedsplit/node_modules/prompt/lib/prompt.js:333:9)
at /usr/local/lib/node_modules/seedsplit/node_modules/prompt/lib/prompt.js:342:32

Anything you'd like me to try?

from seedsplit.

oed avatar oed commented on September 4, 2024

Oh, I see where the issue is. I'm padding the resulting split entopy with zeros to get the right length to do entropyToMnemonic. The resulting string might get the wrong length for some reason. I'd have to look more closely at this next week when I'm less busy :)

from seedsplit.

coop555 avatar coop555 commented on September 4, 2024

Awesome. I am glad you figured it. Let me know if there's anything else I can do to help.

from seedsplit.

mifunetoshiro avatar mifunetoshiro commented on September 4, 2024

It's not because of padding with zeroes, this is because secrets.js (unmaintained and has bugs anyway) returns shards with Buffer.from(shard, 'hex').length 34, and bip39 returns an "Invalid entropy" for length > 32: https://github.com/bitcoinjs/bip39/blob/master/index.js#L99

If you change line 99 and 83 of bip39 to > 36 it works, but this is just a dirty workaround, because according to BIP-39 the entropy should be between 128-256 bits (16-32 bytes). And this also raises this issue then: #6.

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.

from seedsplit.

oed avatar oed commented on September 4, 2024

@mifunetoshiro thanks! I think it worked in an older version though :/

from seedsplit.

mifunetoshiro avatar mifunetoshiro commented on September 4, 2024

Yes, until bitcoinjs enforced the entropy to 128-256 bits in bip39, 2.4.0 it seems.

from seedsplit.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.