Bitcoinjs-lib: Should I use a brainwallet to generate user addresses

Created on 9 Feb 2018  路  6Comments  路  Source: bitcoinjs/bitcoinjs-lib

As I understand, it is possible to generate a receive addresses from a base address. How can one do it with bitcoinjs?

Is it possible to generate receive addresses based on a string like so:

https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/addresses.js#L19

how to / question / docs

All 6 comments

Is it possible? Yes.

Should you do it? No.

@junderw , could you clarify why not? :)

@timothyylim humans suck at generating entropy. we pick things of significance to us, which other people are as well able to guess (and people do have bots taking random strings/poems, hashing them and attempting to find a balance on the private key), and just because a set of primitives _can_ be (ab)used in this way, it doesn't mean that they should.

Best practices exist often without specifying all the pain/misery/suffering that came before them - and using a CSPRNG to generate your seeds is number one on the list.

You should use BIP39 - which encodes strong entropy as a word list, and then derives a seed from that. You can then use BIP32 to derive multiple addresses from that seed.

Thanks for the explanation @afk11. My intention was to generate a random seed but append an additional string onto it just like this:

https://github.com/blocktrail/slack-tipbot/blob/master/lib/user.js#L34

This will allow me to generate a receive address for each new user of my service. The actual seed will be, of course, generated as you've specified.

Would you be able to point me to an example of receive address generation in bitocoinjs-lib?

@timothyylim I recommend you use BIP39 and support users providing a custom passphrase.

@junderw bit of an influx of this question... maybe we should put some warnings in the example and re-direct to an example of using BIP39?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Beardcoding picture Beardcoding  路  3Comments

panpan2 picture panpan2  路  3Comments

rbndg picture rbndg  路  3Comments

silence-may picture silence-may  路  3Comments

prahaladbelavadi picture prahaladbelavadi  路  3Comments