iancoleman / bip39

A web tool for converting BIP39 mnemonic codes
https://iancoleman.io/bip39/
MIT License
3.54k stars 1.45k forks source link

generate new addresses from xpub? #91

Closed dooglus closed 7 years ago

dooglus commented 7 years ago

I generated some addresses on an offline machine, and made a note of the first 20 addresses and the xpub for use online.

I just ran out of addresses and want to generate the next 20, but don't currently have access to the offline machine.

Is there some way to generate the next 20 addresses using just the xpub? The field isn't editable on your web page. I used to use bitcore to do that, but it has stopped working since I switched to the newest Bitcoin Core version which updated my utxo database format.

I'm guessing it's quite a small change to allow the user to enter their xpub directly, but don't know if it's something you want to allow.

iancoleman commented 7 years ago

An xpub can be used in the BIP32 Root Key field.

It may be necessary to select the BIP32 tab and use a derivation path of m to get the addresses, depending where in the hierarchy the xpub comes from.

See also https://github.com/iancoleman/bip39/issues/40

dooglus commented 7 years ago

Thanks. I was trying to edit the "BIP32 Extended Key" field on the BIP44 tab and didn't even notice that the "BIP32 Root Key" field was editable up top.

I'll close this, since I can now do exactly what I wanted to do. :)

sowbug commented 7 years ago

Same question but for BIP49 addresses. I'd like to be able to paste in an xpub from an m/49'/0'/0' path and see Segwit addresses. Since the BIP49 tab doesn't let us specify the prefix, it fails because it can use a hardened path. The BIP32 path does let us enter m/0 for the path, but it generates standard addresses, not the P2WSH-style addresses.

Is that possible today, or does it require adding an extra option to the BIP32 tab?

sowbug commented 7 years ago

s/can/can't/

iancoleman commented 7 years ago

BIP49 uses "P2WPKH-nested-in-P2SH" addresses. So there needs to be an extra checkbox added to the BIP32 tab so users can select to use this sort of address.

It should be simple to add this feature, the logic is already worked out from the BIP49 tab, it's just a matter of adding the UI element to the BIP32 tab and hooking it all up.

Good suggestion thanks.

iancoleman commented 7 years ago

See https://github.com/iancoleman/bip39/commit/88311463c74f022177a21c5d88f8928dc8007d8b - Allow P2WPKH nested in P2SH addresses on BIP32 tab

sowbug commented 7 years ago

Confirmed with a test xpub -- works perfectly! Thank you.