iancoleman / bip39

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

Deriving ETH addresses from BIP32 Extended Public Key #169

Closed slowdownitsfine closed 4 years ago

slowdownitsfine commented 6 years ago

Firstly I wanted to say how helpful your code and page have been for my understanding of BIP's 32, 39 and 44. Thank you!!

I come across an error when attempting the following:

1) Select ETH as a coin in the BIP44 tab and generate a mnemonic and seed 2) Copy the BIP32 Extended Public Key (I leave account and change derivation path members zeroed) 3) Select ETH as a coin in the BIP32 tab and copy the key into the BIP32 Root Key field

My expectation would be that with a derivation path of m/0 the addresses shown below shall match the one listed in tab BIP44. I might be wrong about this as I am rather new to h.d. wallets.

I saw you suggested this in #94. However I see a thrown exception in the console at keyPair.d.toBuffer

Hope you can reproduce and help. Thanks again!

iancoleman commented 6 years ago

Does the BIP32 Derivation Path m/44'/60'/0'/0 work (as found on the BIP44 tab)?

Re the console error, which version are you using? This was fixed in v0.3.3 by https://github.com/iancoleman/bip39/issues/155

slowdownitsfine commented 6 years ago

I've been using the version deployed to iancoleman.io, just playing with this and trying to learn.

With the derivation path you suggested I'll see the warning Hardened derivation path is invalid with xpub key.

This is the exception I see when using m/0. I can't use 0 as there seems to be a check in place for the derivation path to start with m:

screenshot

As a side note I've been able to derive the same addresses from the extended public key shown in BIP44 tab with the ethereumjs-wallet/hdkey package.

Anyways, thanks for getting back to me.

iancoleman commented 6 years ago

If you put the xpub key here I can look into this but unfortunately just now things are very busy for me so it'll be about 2 weeks until I have time to investigate further.

You may also try path m and see if that works but for now this is just generic advice, I'll have a closer look when I get time. Let me know if you find anything else in the meantime.

slowdownitsfine commented 6 years ago

I've been trying with this extended public key:

xpub6DbJyPndTHNa4ykQ1r1kGsASZfvDu5yc4vi43BbKEhVtdcovVQ3ggtCKxnKbkpBhdLnbizdCsWZRJYsbVgXtu9HFkNYFp7ZZX1DdckFRctF

It works for BTC, but when selecting ETH a JS error comes up in the console when in the BIP32 tab with both derivation paths m and m/0.

Sorry for the late reply, hope this helps. Thank you again for this super useful resource!

JeffreyLeonard commented 4 years ago

Im not sure what this means..

On Thu, Dec 19, 2019, 10:58 PM iancoleman notifications@github.com wrote:

Closed #169 https://github.com/iancoleman/bip39/issues/169 via #390 https://github.com/iancoleman/bip39/pull/390.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/iancoleman/bip39/issues/169?email_source=notifications&email_token=AI3LDGWXGX5RT6WUKBLE2HDQZRGHJA5CNFSM4ESO4XSKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOVTJ6X6Q#event-2899569658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3LDGXXFZJUBOA6D46ALE3QZRGHJANCNFSM4ESO4XSA .