# Ramifications of creating Electrum 2.x seeds which are not BIP39

Electrum 2.0 seeds (mnemonic phrases) are created with a checksum based algorithm (such that the `hmac_sha512` starts with `01`. It's usually a 13 word seed, but can be 12 in some circumstances.

If all 12 word Electrum 2.x seeds were filtered such that they are not BIP39 compatible, what is the decrease in entropy going to be?

=> The question pertains to this Python code

I guess the problem can be summed up as:

1. What is the percentage of 12 words Electrum 2.x seeds (relative to 13 word seeds)?
2. What is the percentage of Electrum 2.x (12 word) seeds which do not meet the BIP39 standard? (The last word decides the checksum)

For the purposes of this answer, I'll assume we're only talking about mnemonics which can be generated by Electrum 2.x, and not ones that are simply accepted by Electrum 2.x for restore (the latter number is infinite).

1. What is the percentage of 12 words Electrum 2.x seeds (relative to 13 word seeds)?

Electrum 2.x seeds by default encode 136 bits of data. Any leading zero bits are ignored during encoding, so the resulting mnemonic length varies.

Each word encodes log2(word_list_length) bits of data, so for most* Electrum 2.x word lists, that's log2(2048) = 11 bits per word.

Therefore 13 and 12-word long mnemonics can encode up to 143 and 132 bits of data respectively. In order for a 136-bit seed to be encoded into 132 bits (12 words), at least the first 4 bits must be zero, which happens with probability 1 in 24, so 1 in 16 random mnemonics will be of length 12 or fewer.

Likewise, for an 11-word mnemonic, encoding 136 bits into 121 bits requires that 15 leading bits must be zero, so 1 in 215 or 1 in 32768 will be of length 11 or fewer.

Finally, if you need an exact answer, it would be 1/16 - 1/32768 = 2048/32768 - 1/32768 = 2047 in 32768 will be of length 12 exactly.

* For the Portuguese word list, it's log2(1626) ≈ 10.67 bits per word

1. What is the percentage of Electrum 2.x (12 word) seeds which do not meet the BIP39 standard?

12-word long BIP-39 mnemonics have 4 bits of checksum, so 1 in 24 generated 12-word Electrum 2.x mnemonics will happen to be valid BIP-39 ones, and 15 in 16 Electrum ones will be invalid for BIP-39.

If all 12 word Electrum 2.x seeds were filtered such that they are not BIP39 compatible, what is the decrease in entropy going to be?

I'm interpreting this as asking: If valid Electrum 2.x mnemonics were required to be invalid BIP-39 ones, by how much would this decrease their entropy?

Wolfram|Alpha says very small: about 0.0056 bits based on this input:

``````solve  (2^n - 1) / 2^n = 2047/32768 × 1/16  for n
``````
• Wow! Fantastic work! I'll see what @ThomasV thinks of this for differentiating BIP39 and Electrum 2.x: seems a good consideration. Also, I did notice Portuguese strays back to Electrum 1.x word list size myself and wondered, what on earth is going on? Jun 16 '15 at 23:46
• @WizardOfOzzie Thanks! IIUC, Monero Core borrowed Electrum 1.x's seed generation method and original English word list, and then added new word lists all of the same size as Electrum 1.x's list, and later Electrum 2.x borrowed (back) one of the new word lists which had no BIP-39 equivalent. Since Electrum 2.x can work with word lists of any positive size, I assume ThomasV saw no reason to create a Portuguese word list of BIP-39 size. Jun 17 '15 at 0:11
• I checked the Electrum 2.x word lists yesterday and they match BIP39 exactly for Japanese, English and Spanish. When you say Electrum 2.x "borrowed back" a non-BIP39 wordlist, are you referring to Portuguese? Jun 17 '15 at 0:24
• @WizardOfOzzie Right, I meant that they used Monero's word lists for Portuguese which had no corresponding BIP-39 list. I've no idea what the plans are, if any, for Chinese, and I've no idea if the BIP-39 French word list will be used, or the partially completed Electrum 2.x one. Jun 17 '15 at 0:55
• @WizardOfOzzie We're getting a bit off-topic here ;) ... but I actually disagreed with you in the GitHub PR here, FWIW. Jun 17 '15 at 3:14