Author

Topic: 24 word seed no longer works in Electrum 2.0 (Read 2176 times)

legendary
Activity: 3612
Merit: 1564
March 15, 2015, 03:59:13 PM
#8
I looked through the electrum source code and experimented a little, and this can actually be fixed very easily in the code:
https://github.com/spesmilo/electrum/blob/bc3013caf0d3d6a35290e9cc9e51125b7d03d14c/lib/bitcoin.py#L166

Line 166 :
        is_hex = (len(seed) == 32)

Change to:
        is_hex = ((len(seed) == 32) or (len(seed) == 64))


Line 170:
    return is_hex or (uses_electrum_words and len(words) == 12)

Change to:
    return is_hex or (uses_electrum_words and (len(words) == 12 or len(words) == 24))

Making these two changes allows 256bit hex code w/ to be used again in the style of https://bitcointalksearch.org/topic/why-you-cannot-enter-an-arbitrary-seed-in-electrum-153990

Would this be reasonable?

If it works for you then go for it but the developer is not going to make that change for everyone. You can see his views on the matter in the thread you linked above.
KF
newbie
Activity: 6
Merit: 0
I looked through the electrum source code and experimented a little, and this can actually be fixed very easily in the code:
https://github.com/spesmilo/electrum/blob/bc3013caf0d3d6a35290e9cc9e51125b7d03d14c/lib/bitcoin.py#L166

Line 166 :
        is_hex = (len(seed) == 32)

Change to:
        is_hex = ((len(seed) == 32) or (len(seed) == 64))


Line 170:
    return is_hex or (uses_electrum_words and len(words) == 12)

Change to:
    return is_hex or (uses_electrum_words and (len(words) == 12 or len(words) == 24))

Making these two changes allows 256bit hex code w/ to be used again in the style of https://bitcointalksearch.org/topic/why-you-cannot-enter-an-arbitrary-seed-in-electrum-153990

Would this be reasonable?
legendary
Activity: 3612
Merit: 1564
If you know python you may be able to do it. Take a look at mnemonic.py:

https://github.com/spesmilo/electrum/blob/master/lib/mnemonic.py

encode_mnemonic looks like what you want. But the words will change or the hex will change. You can't have both.
KF
newbie
Activity: 6
Merit: 0
I used your method, restoring in 1.9.x (worked) then opened in 2.0.2, but upon opening in v2 there were no addresses listed. All this was done offline on an airgapped machine. However upgrading through the master public key from 1.9.x -> 2.0.2 works on the online watch-only wallet.

I don't mind having to do a migration to using different addresses, but I would like to keep the same seed as little changed as possible. Having to add some words to it to clear the checksum is fine.

My problem is that I used 1.9.x by providing it a hex string. This string is then turned into the 24 word seed. In v2 I can also no longer provide hex strings to recover the wallet.

What is the algorithm in v2 for generating the seed from a set of master hex bits? If there is some method to go from that string to a new seed that would also work.

f(hex string) -> seed

I'll look into the make_seed method you mention.
legendary
Activity: 3612
Merit: 1564
Thanks. Yes I've read a warning about using non-12 character seeds, but this was unfortunately the only path I could use at that time.

Is there a way to modify this seed (like how v2 uses an extra word) so that it will contain the version/checksum and can still be directly entered into v2?

First of all can you please confirm that my method above worked? I'd like to know in case others face this problem in future.

To answer your question if you modify the seed you modify all the private keys and all the address. So it isn't possible because it results in an entirely new wallet.

You can create a new wallet if that's what you want. Try this command in your shell/OS command line:

Code:
electrum --nbits=256 make_seed

The above command will make a 25 word seed with 256 bits of entropy. You can then do a wallet restore specifying this new seed to create a wallet with it.

Code:
electrum -w /path/to/new_wallet restore

You can then send your bitcoins from your old wallet to this new wallet.
KF
newbie
Activity: 6
Merit: 0
Thanks. Yes I've read a warning about using non-12 character seeds, but this was unfortunately the only path I could use at that time.

Is there a way to modify this seed (like how v2 uses an extra word) so that it will contain the version/checksum and can still be directly entered into v2?
legendary
Activity: 3612
Merit: 1564
Whoever taught you how to do this must have warned you this would happen.

The solution is simple. Restore using 1.9.8 and then install 2.0.2 and the wallet should open. The bare seed doesn't contain the version number but the wallet file does so you need to recreate the wallet file using 1.9.8.
KF
newbie
Activity: 6
Merit: 0
I use a 24 word seed that can no longer be recovered using Electrum 2. This was originally generated from a hashed random sequence and the hex was fed into Electrum 1.9.x to create it.

Unfortunately with the release of 2.0 this wallet is no longer recoverable. Will this be fixed in a future release? This is rather important as I cannot recover the wallet with 2.x at the moment.
Jump to: