Understanding this part of the knowledge is crucial, as it directly determines whether you can comprehend the subsequent articles. If you have any questions, feel free to leave a message or send a private message.
I. Overview The choice and use of wallets are closely related to us retail investors. I found that many newcomers are not very familiar with wallets and do not know how to use them. Essentially, a wallet is a container that generates and saves private and public keys and addresses, responsible for signing with the private key, encrypting with the public key, receiving payments with the generated address, or receiving change with the generated address during a transaction. At the same time, it continuously accesses the Bitcoin network to calculate your wallet balance and display it to you. When you give someone your Bitcoin address and they send money to that address, the Bitcoin balance displayed in your wallet will change. After you send money to someone, in addition to the Bitcoin you paid them, they also need to give you change, so you need to provide a change address, similar to receiving change in everyday life.
Each transaction order must be verified by nodes after being broadcast, and the main content of the verification is to execute the unlock script + lock script to see if the result is true.
Currently, it only involves on-chain operations, and transactions are the main activity of the Bitcoin system, as well as the unit of activity for Bitcoin.
Wallet (5) - BIP44 Standard and Future Enterprises
Future enterprises will definitely move towards intelligence, and financial management will also undergo significant changes. We can see clues from BIP44; it's really hard to say what society will develop into in the next thirty years.
(3) Example demonstration We start with the seed generated from BIP39 and gradually demonstrate how BIP32 is executed. (1) Seed: 0x5b56c417303faa3fcba7e57400e120a0ca83ec5a4fc9ffba757fbe63fbd77a89a1a3be4c67196f57c39a88b76373733891bfaba16ed27a813ceed498804c0570 (2) Derive master key Find an online tool to generate a 512-bit result (if not found, please message me privately) 0xb2a0d576b828b537688b561f2cfa8dac3602d54c62bde619ad5331e6c235ee26b70d675323c40ec461e0a6af603b1f135fb2af9ae753eeff18922732a73b0f05 Obtain master private key: 0xb2a0d576b828b537688b561f2cfa8dac3602d54c62bde619ad5331e6c235ee26
2. Derivation rules [BIP32]. We generated a seed through BIP39, which we call the 'master seed'. According to the derivation rules of BIP32, we can derive the 'master private key', 'master public key', and 'master chain code' from the 'master seed', all three of which are referred to as 'keys'. We can continue to derive 'child keys' (child private key, child public key, child chain code) from the 'keys' as 'child seeds', and so on, allowing for an infinite generation of descendants, all derived from the 'master seed'; hence, the 'master seed' is also referred to as the 'root'. The 'master private key', 'master public key', and 'master chain code' are also referred to as the 'master keys'. As long as we back up the 'mnemonic phrase', we can export the 'root' -> 'master root' -> 'child root', etc.
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.
Figure 1, BIP32, 39, 44 Figure 2, Advantages of HD Wallet 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.
I. Overview. In the (public key) section, we discussed the mechanism of public key generation, and based on the format of the private key, different forms of public keys can be generated: 'uncompressed public key' and 'compressed public key'. The public key is inherently public; can't it be used directly as an address? Why go through the trouble of converting it into an address? There are three main reasons. First: The public key has two forms, compressed and uncompressed, with different lengths—one is 65 bytes (1-byte prefix + 32-byte x value + 32-byte y value) and the other is 33 bytes (1-byte prefix + 32-byte x value). There may be a third or fourth format in the future, making the number of public key formats presented to the user too many, which could be confusing.
Uncompressed Public and Private Keys | Compressed Public and Private Keys
1. Uncompressed Public Key vs. Compressed Public Key Since the inception of Bitcoin in 2009, the public key generated by the wallet is a 512-bit (64-byte) binary number. We will find that this public key connects the x and y coordinates together. However, once x is determined, the value of y will also be fixed, so as long as the value of x is collected, it also contains the information of y. This can significantly reduce the size of the data and lighten the storage burden (it will be mentioned later that every Bitcoin transaction must be encrypted using the public key, which will be stored on the blockchain), hence it is also referred to as 'compressed public key'. The earliest public key is called 'uncompressed public key'. To distinguish these two formats of public keys, the wallet adds a prefix '0x04' in front of the 'uncompressed public key', resulting in a 520-bit (65-byte) public key. Therefore, in 2012, after the Bitcoin wallet upgrade, support for compressed public keys began.
I. Overview After obtaining a 256-bit private key, the public key is calculated from the private key using the elliptic curve cryptography algorithm in a finite field. The basic mathematical knowledge involved belongs to the field of number theory, including modular arithmetic, prime number concepts, Euler's function, Euler's theorem, Euclidean extended theorem, RSA encryption theory, elliptic curve point operations, in other words, it can be understood as an upgraded version of RSA cryptography. II. Elliptic Curve Cryptography (ECC) Elliptic curve encryption is unidirectional, also known as asymmetric encryption. Its core idea is that the operation is irreversible, or that as long as an operation method has irreversible characteristics, it can be used as asymmetric encryption. 'Modular arithmetic' and 'point operations' are currently popular irreversible operations or unidirectional functions, or unidirectional operations.