# What's the raw logic for converting a seed phrase to private key

I'm interested in how an actual seed phrase is converted into a private key.

I think it's a long the lines of.

1. Generate 11 word seed phrase
2. Convert the numbers into binary
3. Add up the binary numbers modulo something to get the checksum.
4. Convert the 12 words into hex?

If someone could outline and show a simple example that would be awesome

The process of converting a seed phrase (also known as a mnemonic seed phrase) into a private key involves a few steps that are based on cryptographic functions. Below is a general overview of the steps typically used in the Bitcoin protocol (BIP39 and BIP32 standards):

• ``````  Mnemonic Seed Phrase Generation:
``````
• A mnemonic seed phrase is usually generated from a random number let’s call it (EN for entropy).
• The EN is often 128, 160, 192, 224, or 256 bits long.
• A checksum is added to the EN. The checksum length is equal to the EN length divided by 32.
• The combined EN and checksum bits are then divided into groups of 11 bits, each corresponding to a word from a predefined list of 2048 words.

(Example: My EN generated is a 128 bit length of randomly generated ones and zeros. Divide 128 into 32 you get 4. Add 4 to 128 is 132. Then 132 divided by 11 results in 12. These 12 bits are compared with the established 2048 words giving us the mnemonic 12 word phrase.)

• ``````  Seed Derivation from Mnemonic:
``````
• Once you have the mnemonic phrase, it is converted into a seed by using what’s called a key-stretching function. The standard used is PBKDF2.
• The mnemonic phrase is combined with a salt that is prefixed with the string "mnemonic" and optionally can be followed by a passphrase provided by the user (for added security).
• The PBKDF2 function uses HMAC-SHA512 as its cryptographic hash function. The typical iteration count is 2048, and this process outputs a 512-bit seed.

( An example applying such function can be viewed by using the calculator found at https://8gwifi.org/pbkdf.jsp)

• ``````  Generating the Master Private Key and Chain Code:
``````
• The seed derived from the mnemonic is then used to generate the master private key and a master chain code.
• This is done using the HMAC-SHA512 algorithm. The seed is used as the input, and the key is set as the string "Bitcoin seed".
• The left 256 bits of the HMAC output are used as the master private key, and the right 256 bits are used as the master chain code. (This can be generated using the compiler such as the one at https://tools.onecompiler.com/hmac-sha512)
• ``````  Deriving Further Keys:
``````
• The Extended Key uses the master private key and chain code, and through a process defined in BIP32 (Hierarchical Deterministic Wallets), it allows generating multiple child keys.
• Each child key can further derive its own child keys, creating a tree-like structure of keys. This allows for easy management and backup of multiple addresses and accounts from a single seed. ( you can apply the generator on http://bip32.org)
• ``````  Public Keys or Address Generation:
``````
• Private keys derived in the above manner can be further processed to generate public keys using elliptic curve multiplication (specifically on the secp256k1 curve in Bitcoin).
• Public keys are then hashed and encoded to form cryptocurrency addresses, which are used in transactions.

( This process is a bit more involved for an example. There is a calculator introduced by Mr Maxwell but I have not ventured to install: https://github.com/MrMaxweII/Secp256k1-Calculator/blob/master/README.md. For a discussion on applying the calculations I found this article useful: https://steemit.com/ellipticcurve/@sso/calculate-bitcoin-publickey )

• I see the information you've provided but I don't understand how that applied. And example like would help showing how the bits represent each word Apr 22 at 21:40