2. Hierarchical Deterministic Wallet | HD Wallet
To address the flaws of random wallets, the Bitcoin developer community established three standard protocols in 2012, 2013, and 2014, namely BIP32, BIP39, and BIP44 (BIP, Bitcoin Improvement Proposal), which ultimately formed the architectural foundation of mainstream wallets today.


3. The underlying logic of HD Wallet
Initially, the HD wallet was established under these three protocols, and subsequently developed and evolved based on them. Below, we will briefly describe how these three protocols work together.
1. Generate seed [BIP39]
1) First, generate a binary random number, generally 128/160/192/224/256 bits, commonly used are 128 bits and 256 bits, which is essentially the "seed source" from which everything else is derived.

128-bit binary random number:
00001100000111100010010011100101100100010111011101111001110100101001011111100001010011010100010111110001010011100001101000011010
Use toolsGenerate corresponding 32-bit hexadecimal
0x0C1E24E5917779D297E14D45F14E1A1A
2) Use an online tool to calculate its SHA-256, and take the first 4 digits of the result as the checksum 0x7
3) Concatenate the random number with the checksum to obtain a 132-bit binary number
33-bit hexadecimal:
0x0C1E24E5917779D297E14D45F14E1A1A7
132-bit binary random number:
000011000001111000100100111001011001000101110111011110011101001010010111111000010100110101000101111100010100111000011010000110100111
4) Divide the 132 bits into groups of 11 bits, a total of 12 groups. Why 11 bits per group? Because the BIP39 word list has 2048 words (2^11 = 2048), then map these 12 groups to 12 mnemonic words.

5) Use the algorithm function PBKDF2-HMAC-SHA512 to convert "Mnemonic" into a 512-bit binary number as the seed
Seed = PBKDF2_HMAC_SHA512(password=Mnemonic, salt="mnemonic"+additional password, iterations=2048, outputLen=64 bytes)
Note:
A. Parameter "password" = 12 mnemonic words connected by "spaces"
B. The algorithm function will encode the 12 mnemonic words connected by spaces into corresponding binary numbers using UTF-8, instead of using the 132-bit binary numbers mapped from the mnemonic words
C. The value of salt = "mnemonic"+additional password, with no spaces in between
D. The number of iterations is 2048
E. The output result is 64 bytes, which is 128 hexadecimal characters
Mnemonic (connected by spaces):
army van defense carry jealous true garbage claim echo media make crunch
salt (without additional password):
mnemonic
Use online tools to calculate the seed:
5b56c417303faa3fcba7e57400e120a0ca83ec5a4fc9ffba757fbe63fbd77a89a1a3be4c67196f57c39a88b76373733891bfaba16ed27a813ceed498804c0570