libbitcoin/libbitcoin-explorer

How to convert BIP39 seed (numeric) back to BIP39 mnemonic (aka seed-to-mnemonic)?

Closed this issue · 3 comments

I'm looking for the command which does opposite to bx mnemonic-to-seed, so to take BIP39 seed as an input and convert it back to BIP39 mnemonic (words). I've looked through GitHub issues, wiki and help, but I couldn't find it.

I've tried bx mnemonic-new, but it didn't work as expected.

So as per bx mnemonic-to-seed example, I've converted to BIP39 seed:

$ bx mnemonic-to-seed --language en rival hurdle address inspire tenant almost turkey safe asset step lab boy
020b67fd929e0eb9f963443138057ceec0d62601d69b4b2327c00d74f0fd1862d164c53d49227d9dadedbbec305236bc2149d9a5267aa7c5aa004235c3c66c29

but then I've tried which I think it does opposite (using bx mnemonic new), but I have different results (different words):

$ bx mnemonic-new 020b67fd929e0eb9f963443138057ceec0d62601d69b4b2327c00d74f0fd1862d164c53d49227d9dadedbbec305236bc2149d9a5267aa7c5aa004235c3c66c29
acoustic forest youth cement thought friend tortoise hammer couple scan game talk aspect basic also square enroll bomb useless brain excuse leader ghost focus gospel clarify false eager supply street report laugh core museum pyramid dream outside spoon okay female shield exotic awesome high detect current pink slim

What I'm looking is to go back to the same list of words by giving the hex string.

I've checked and what I look for, is more mnemonic-to-entropy command (as from seed to entropy it won't be possible).

So by giving 'rival hurdle address inspire tenant almost turkey safe asset step lab boy', I expect: baadf00dbaadf00dbaadf00dbaadf00d.

I've tested by going to Mnemonic Code Converter site and typing mnemonic words into 'BIP39 Mnemonic', and by clicking 'Show entropy details'.

BIP39 seeds are one-way hashes of the entropy derived from the words. There is no way to round trip them to the words. The same is true of Electrum v2 seeds. Electrum v1 used a simpler model where there was no seed, just words and the numeric encoding of the words (entropy). There is no "opposite" of a seed.

I have recently reimplemented each of the three mnemonic implementations in libbitcoin-system and have redesigned the bx commands accordingly. This will expose the entropy in both BIP39 and Electrum v2 such that it can be round-tripped, as well as exposing the seed conversions.