Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update seed command to support electrum mnemonics #527

Merged
merged 4 commits into from
Feb 20, 2018

Conversation

thecodefactory
Copy link
Member

Update seed command to support electrum mnemonics with 132 bits of entropy (the default for electrum 2.x+) or more (resolves #499)

src/utility.cpp Outdated
@@ -80,6 +89,26 @@ data_chunk new_seed(size_t bit_length)
return seed;
}

data_chunk new_electrum_seed(size_t bit_length)
{
static const auto now = high_resolution_clock::now();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see moving most of this method into libbitcoin/src/utility/random.cpp similar to new_seed

@thecodefactory
Copy link
Member Author

thecodefactory commented Feb 10, 2018

UPDATE: This is no longer relevant, as seed changes have been reverted.

This generates valid electrum mnemonics verified against electrum 3.0x:

$ bx seed --electrum -b 132 | bx electrum-new
pioneer language elegant harvest talk empower face library talent urge leader fox

The default entropy size for electrum mnemonics is 132 bits. I didn't want to automatically override the default (of 192 to 132) if --electrum was used in the case that -b 192 was used specifically, so for now, the recommended usage is to specify -b 132 as in the example above. Thoughts?

@coveralls
Copy link

coveralls commented Feb 10, 2018

Coverage Status

Coverage remained the same at 40.365% when pulling 6300c1e on thecodefactory:electrum-seed into 54df66a on libbitcoin:master.

@thecodefactory
Copy link
Member Author

Ah, this needs a unit test as well, will add one.

@thecodefactory thecodefactory force-pushed the electrum-seed branch 5 times, most recently from d861c55 to f603a14 Compare February 13, 2018 01:39
use only what is required.  By default, 132 bits of entropy are used
to match the default for electrum 2.x+.  If more input entropy is
provided and more entropy for the electrum-mnemonic is desired, a
-b,bit-length option is provided to specify how much.
@evoskuil evoskuil merged commit 6847180 into libbitcoin:master Feb 20, 2018
@thecodefactory thecodefactory deleted the electrum-seed branch February 20, 2018 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add electrum mnemonic support
3 participants