What is Nostr?
BTC / Codex
npub14s6…pq47
2024-06-07 13:39:20
in reply to nevent1q…w794

BTC on Nostr: Here is what happens: 1. Generate the Seed Phrase: • The wallet software generates ...

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. 🎯🙌🫡
Author Public Key
npub14s6q5rl6fpvfax90s4mh23ffarze7l73zrcmeqedp6x5cnfarpfss0pq47