Bitcoin Forum

Bitcoin => Electrum => Topic started by: Sidney986 on June 24, 2020, 08:57:32 AM



Title: Electrum and Ian Coleman's BiP39
Post by: Sidney986 on June 24, 2020, 08:57:32 AM
Not able to get my Electrum addresses replicated in Ian Coleman's BiP39.  Any ideas?

I have setting as follows,

BIP39 Mnemonic                                Electrum 12 seed words entered
BIP39 Passphrase (optional)                Electrum extended seed words entered
Derivation Path                                   set to BIP141
BIP32 Derivation Path                         set to m/0'/0
Script Semantics                                 set to P2WPKH

 ???


Title: Re: Electrum and Ian Coleman's BiP39
Post by: NeuroticFish on June 24, 2020, 09:01:33 AM
It was discussed here too in the past multiple times. Electrum's seed system also uses a version number. https://electrum.readthedocs.io/en/latest/seedphrase.html
This means that Electrum's seed only works in Electrum.
If you want to make a seed that works anywhere (and also in Electrum!, just you'll have to perform one extra step at importing), then use Ian Coleman's.

Edit: topics on similar subject:
https://bitcointalk.org/index.php?topic=5111828
https://bitcointalk.org/index.php?topic=5203955 (yes, I had the same surprise in the past)
https://bitcointalk.org/index.php?topic=5253904


Title: Re: Electrum and Ian Coleman's BiP39
Post by: nc50lc on June 24, 2020, 09:43:59 AM
Any particular reason why you'd want to restore your addresses despite having Electrum?
That's for members to be able to answer straight to the point.

BTW, you can follow this post from the third link above: /index.php?topic=5253904 Post#19 (https://bitcointalk.org/index.php?topic=5253904.msg54582304#msg54582304)
But that requires you to restore the wallet to Electrum if you didn't have a backup of the master private key.


Title: Re: Electrum and Ian Coleman's BiP39
Post by: hosseinimr93 on June 24, 2020, 10:22:53 AM
If you want to have a seed phrase generating same addresses in Electrum and iancoleman, instead of generating the seed phrase using Electrum, you can generate the seed phrase in iancoleman and import it into Electrum. You only need to check "BIP39" when importing the seed phrase generated by iancoleman in Electrum.
The seed generated by Electrum doesn't work in iancoleman. But Electrum can generate same addresses as iancoleman.


Title: Re: Electrum and Ian Coleman's BiP39
Post by: bob123 on June 24, 2020, 04:40:29 PM
Electrum does not use BIP 39.
It has its own mnemonic code derivation. Once the root key (BIP 38) is obtained, the derivation of the keys is the same. But the step from the mnemonic to the root key is different.

You won't be able to recreate your private keys from an electrum mnemonic using a BIP 39 software.


Title: Re: Electrum and Ian Coleman's BiP39
Post by: igor72 on June 25, 2020, 10:00:12 AM
https://bitcointalk.org/index.php?topic=4595261.msg41815678#msg41815678


Title: Re: Electrum and Ian Coleman's BiP39
Post by: o_e_l_e_o on June 25, 2020, 01:12:00 PM
https://bitcointalk.org/index.php?topic=4595261.msg41815678#msg41815678
The iancoleman code has been updated since those changes were suggested by HCP, so although those are still the changes you need to make, you will no longer find that code at the same places.

Download the repository from here: https://github.com/iancoleman/bip39
Navigate to the folder BIP39/src/js
Open the file jsbip39.js
The string return h == nh; is at line 116, and the string passphrase = "mnemonic" + passphrase; is at line 144.

The other instructions OP has given are correct. Make these code changes and repeat those steps, and you will be able to replicate your Electrum addresses.


Title: Re: Electrum and Ian Coleman's BiP39
Post by: igor72 on June 25, 2020, 03:54:09 PM
https://bitcointalk.org/index.php?topic=4595261.msg41815678#msg41815678
The iancoleman code has been updated since those changes were suggested by HCP, so although those are still the changes you need to make, you will no longer find that code at the same places.
Right, I didn't think it was so important to specify the exact line. In the current version of the file (https://github.com/iancoleman/bip39/releases/download/0.4.3/bip39-standalone.html), you have to change the lines 35217 and 35245.


Title: Re: Electrum and Ian Coleman's BiP39
Post by: igor72 on June 27, 2020, 11:13:39 AM
Line 35217 is "return h == nh;" while 35245 is "passphrase = "mnemonic" + passphrase;" If I make the proposed changes,  the resulting file would be suitable solely  for Electrum or it can be used to generate data relevant to traditional BIP 39 scheme?
For Electrum only.