spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.36k stars 3.07k forks source link

Restoring Trezor Segwit wallets #4014

Closed jackbox closed 6 years ago

jackbox commented 6 years ago

If you enter 24 seed words from a Trezor One to restore a wallet in electrum, select BIP39 and change derivation to "m/49'/0'/0'" the wrong addresses are generated. In order to get the correct addresss a blank space (" ") must be added after the last word. Then, and only then, will Electrum generate the correct Segwit address from Trezor seed words. Also, if you use the passphrase feature, you must add the space after both the list of word sand after the passphrase or Electrum will generate the wrong set of addresses. This should be corrected as most people won't realize they have to enter the blank space to get the correct set of addresses that match the Trezor. I only found it through a lot of trial and error and experimentation.

dabura667 commented 6 years ago

I was not able to reproduce the issue.

Could you be more specific?

jackbox commented 6 years ago

Restoring Trezor One Segwit wallet using 24 word seed. It creates a wallet with different Segwit address than the Trezor wallet has. The only way to get the same Segwit addresses as the Trezor One wallet is to add a blank space (i.e., hitting space bar) after the last word in the list. If you add the blank space after the 24th word then the Segwit addresses will match the Trezor One. This is selecting BIP39 and using derivation "m/49'/0'/0'" for Segwit. If a passphrase is used you must add a blank space after the word list and after the passphrase. To recreate this you need a Trezor One with segwit account and try to get same address doing a restore in Electrum. Don't add the space and the wallet addresses are completely different. People are not going to know they need to add a space to get the correct addresses. I discussed this with Slush and he said it is a bug and asked me file the issue on Electrum Git.

On Sun, Mar 4, 2018 at 5:30 PM, Dabura667 notifications@github.com wrote:

I was not able to reproduce the issue.

Could you be more specific?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spesmilo/electrum/issues/4014#issuecomment-370218276, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPK4YwDcpGhd_VeaFB56e0_bOOZ0ACks5ta8JMgaJpZM4SbR0y .

Ancapzin commented 6 years ago

I don't think it's a bug in Electrum, because Samourai Wallet works in the same way.

For recovery seed, you need to blank space the last word too.

SomberNight commented 6 years ago

What version of Electrum?

Let's forget about Trezor. Let's forget about passphrases (seed extensions), to simplify this. From your statement it follows that you are getting different addresses, in Electrum, if you add an extra space after the last seed word. I tested this, and it is not the case for me. I also looked at the code, and I don't see how it could be the case with all the normalization we are doing, but okay.

Here is a bip39 seed:

photo gaze net eight mixed salt bench dune inch arch federal cycle oxygen consider pole maid vast travel soap aim hip strategy melody black

With the bip49 derivation of m/49'/0'/0', what is your first receiving address,

In both cases for me it is 34x8k32DoUzfhc4P4ZWEmoEo2P3MFmNu5d.

ecdsa commented 6 years ago

I doubt this issue is real; let's not waste time on it

jackbox commented 6 years ago

It is real because with space or without I get different addresses. Only correct if space is used.

On Mar 5, 2018 4:57 AM, "ThomasV" notifications@github.com wrote:

Closed #4014 https://github.com/spesmilo/electrum/issues/4014.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spesmilo/electrum/issues/4014#event-1503107554, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPK6U98jDsdU3UbbGj5P4PPWDQAwpJks5tbGM3gaJpZM4SbR0y .

ecdsa commented 6 years ago

perhaps you are not using electrum?

jackbox commented 6 years ago

Electrum 3.0.6

On Mon, Mar 5, 2018 at 12:04 PM, ThomasV notifications@github.com wrote:

perhaps you are not using electrum?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spesmilo/electrum/issues/4014#issuecomment-370310823, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPKwmNMYb4mFRNtRQ3rY6izkQknS59ks5tbMdtgaJpZM4SbR0y .

jackbox commented 6 years ago

Electrum 3.0.6

With your seed words above I get the same result space and no space; but with my 24 word Trezor seeds with and without space I get a completely different set of addresses. That is the same result with four different Trezor One's tested. Try it with Trezor seed words from a Trezor One.

On Mon, Mar 5, 2018 at 2:20 PM, jack2551@gmail.com jack2551@gmail.com wrote:

Electrum 3.0.6

On Mon, Mar 5, 2018 at 12:04 PM, ThomasV notifications@github.com wrote:

perhaps you are not using electrum?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spesmilo/electrum/issues/4014#issuecomment-370310823, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPKwmNMYb4mFRNtRQ3rY6izkQknS59ks5tbMdtgaJpZM4SbR0y .

SomberNight commented 6 years ago

With your seed words above I get the same result space and no space; but with my 24 word Trezor seeds with and without space I get a completely different set of addresses

It would be nice if you could provide such an example seed. (not one you use with real coins please)

jackbox commented 6 years ago

Ok. I don't have time now as will be traveling overseas but when I have time I will reset a Trezor and try it with the new seed words. All my seeds right now are being used to claim forks. That is why I needed to put them in them in Electrum to get the private keys. I will update here in about one month.

On Mon, Mar 5, 2018 at 2:42 PM, ghost43 notifications@github.com wrote:

With your seed words above I get the same result space and no space; but with my 24 word Trezor seeds with and without space I get a completely different set of addresses

It would be nice if you could provide such an example seed. (not one you use with real coins please)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/spesmilo/electrum/issues/4014#issuecomment-370334327, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaPK5xF-thaXP_EMeej5QKe0KQhO8tfks5tbOxUgaJpZM4SbR0y .

HardCorePawn commented 6 years ago

I CANNOT replicate this issue: https://bitcointalk.org/index.php?topic=2354707.msg31613435#msg31613435

Example seed generated by Trezor One:

feature loan detect fix glance voice cargo kangaroo pilot apple genuine parade business jazz fortune sell dynamic indoor same absorb host slight educate toe

Was able to successfully create the SegWit wallet by selecting "Options" -> "BIP39 Seed" and typing in seed WITHOUT the space at the end... "BIP39 (Checksum OK)"... and wallet created generates the same addresses as shown in the Trezor wallet:

trezorsegwitseedtesting_01 trezorsegwitseedtesting_02 trezorsegwitseedtesting_03

Also tested with:

artwork join diesel pottery lumber donor rain inject luxury person cancel brand mesh floor fiction ecology luxury replace casino tenant motor scissors into multiply

First address: 329cSkBJPaqQXySU3vD8CCU3U1Nw6PHYnD