Bit-Wasp / bitcoin-php

Bitcoin implementation in PHP
The Unlicense
1.05k stars 419 forks source link

How to get adresses of ethereum, bitcoin cash wallet from mnemonic phrase? #844

Open Krendel338 opened 4 years ago

Krendel338 commented 4 years ago

I have a phrase of 12 words. I need adresses for different wallets such as ethereum, bitcoin cash. Did not find how to do this, please help. Thanks for your time!

afk11 commented 4 years ago

You should review BIP32, and BIP44. The bips are here: https://github.com/bitcoin/bips, and there's examples for bip39, bip32 here: https://github.com/Bit-Wasp/bitcoin-php/tree/1.0/examples

I suggest you generate a bip39 seed, import it to electrum (it's a hidden option when you recover from a seed) and try get your code to match the address it generates

Btw, ethereum & bitcoin cash aren't supported by this repo. There's a cash address converter in this library here: https://github.com/btccom/bitwasp-bitcoin-bch-addon/tree/master/src/Address, but for Ethereum you'll have to work it out yourself ;)

afk11 commented 4 years ago

Pretty sure this example matches electrum and a trezor wallet: https://github.com/Bit-Wasp/bitcoin-php/blob/1.0/examples/trezor.bip32.php