ok I got a #bitcoin bounty, I'll zap directly 10.000 sats to the first best answer to this question:
When you create a wallet of, lets say 12 word seed, and ad a passphrase to it, what happens really in the background?
I'm not a programmer, but I'd like to see the real thing in the workings when this happens, if you know what I mean. I know that you create a whole new wallet by adding the passphrase, but what happens with the code? what does the Bitcoin software do when one generates a seed + passphrase.
the answer can also be a good explanatory video or article.
Thanks for your time ! Btw you can verify my history that I always pay when promised
Login to reply
Replies (19)
You can play with to see what happens.
In short: without a passphrase, the 12/24 words are entropy and get hashed into your private key. With a passphrase, this is added to the entropy, creating a completely separate wallet.
The difference between the two is that the bip39 encoding (the 12/24 words) have a checksum built in, so if you make a mistake, it most likely will catch that. You can try this by changing one of the seed words if you generate a random seed.
The passphrase does not have a checksum, so any typo will create a completely new wallet.
Not the best explanation, but mainly a shill for Ian's great tool.
BIP39 - Mnemonic Code
I think you explanation is what I needed. This tool goes further than a thousand words for me !
Thanks brother.
what you prefer, Zap or lightning address ?
YW, You can zap @calle as he's doing god's work. 👍
Here is what happens:
1. Generate the Seed Phrase:
• The wallet software generates a random 128-bit number (entropy).
• This entropy is passed through a hash function (SHA-256) to produce a checksum.
• The original entropy and a portion of the checksum are combined to create a 132-bit number.
• This 132-bit number is split into 12 groups of 11 bits each.
• Each group of 11 bits is mapped to a word from the BIP-39 word list, resulting in a 12-word seed phrase.
2. Convert Seed Phrase to Seed:
• The 12-word seed phrase is converted into a binary seed using a key stretching function called PBKDF2 (Password-Based Key Derivation Function 2).
• The 12-word seed phrase is used as the input password for PBKDF2, and “mnemonic” is used as the salt.
• The PBKDF2 function runs 2048 iterations of HMAC-SHA512, producing a 512-bit seed.
3. Add the Passphrase:
• The passphrase (if provided) is concatenated with the 12-word seed phrase to form a new “mnemonic + passphrase” string.
• This combined string is again fed into the PBKDF2 function, with the same salt (“mnemonic”).
• PBKDF2 runs another 2048 iterations of HMAC-SHA512, generating a new 512-bit seed.
4. Derive the Master Key:
• The 512-bit seed is used as the input to HMAC-SHA512, generating a master private key and a master chain code.
• These are used to create a hierarchical deterministic (HD) wallet structure, according to BIP-32.
5. Generate Child Keys:
• From the master private key and master chain code, child private keys and chain codes are derived for different account levels (e.g., account 0, account 1).
• Each private key corresponds to a Bitcoin address.
By adding a passphrase, you’re effectively creating an entirely different seed, which results in a completely different set of keys and addresses. This additional layer of security is sometimes referred to as a “13th word” or a “seed extension.”
In short;
1. Generate entropy (random 128-bit number).
2. Convert entropy to a mnemonic seed phrase using the BIP-39 standard.
3. Use PBKDF2 with the mnemonic seed phrase and passphrase to create a 512-bit seed.
4. Derive master private key and chain code using HMAC-SHA512.
5. Generate child keys and addresses using BIP-32. 🎯🙌🫡
You don’t need to reassure people here that you keep your word.
We assume you will.
You’re here.
But if you don’t? Better spin up a new Npub.
Bitcoin wallet with a 12-word seed and a passphrase:
1. Generate Entropy:
• A random 128-bit number is generated.
2. Create Seed Phrase:
• The entropy is converted into a 12-word mnemonic seed phrase using the BIP-39 standard.
3. Derive Seed with Passphrase:
• The seed phrase, combined with a passphrase, is processed using PBKDF2 with HMAC-SHA512 to generate a 512-bit seed.
4. Generate Master Key:
• The 512-bit seed is used with HMAC-SHA512 to derive a master private key and chain code.
5. Generate Keys and Addresses:
• The master private key and chain code are used to create a hierarchical deterministic (HD) wallet, from which individual private keys and Bitcoin addresses are derived using BIP-32.
Adding a passphrase effectively creates a different set of keys and addresses, providing an additional layer of security.
This might just be what you’re looking for (but the example is with a 24 word seed)
yeah, well said. Lets see if nostr becomes the new reputation platform. Interesting developments happening thats for sure
Done. And 5k for you for your altruism


nice explanation, thanks. I gave the price away a couple hours ago but I'll send you a mini 1k prize to you for the effort
seems like I can't send. Did you set up a wallet? you can also drop me a lnd address if you like
thanks to all
The winner was also the quickest answer:
bc through that tool he posted I immediately understood the mechanism behind it. It also showed me how any mnemonic words are a representation. Great simple tool:
Other great answers here thanks everyone & until next bounty !

mutatrum
You can play with to see what happens. In short: without a passphrase, the 12/24 words are entropy and get hashed into your private key. ...
BIP39 - Mnemonic Code
It sorta is like that already. Yea.
Can’t delete shit so
Thank you 🙏🫡 @⚡️ 👈 how ever you like 👇 

Sounds great 👍🫡
Done. Thx for your answer


🫡🙏 

