
Mastering Bitcoin

Although Bitcoin Core serves as a reference implementation for many major parts of the system, the Bitcoin whitepaper describes several early parts of the system. Most major parts of the system since 2011 have been documented in a set of Bitcoin Improvement Proposals (BIPs).
David A. Harding • Mastering Bitcoin
They identified several problems with base58check: Its mixed-case presentation made it inconvenient to read aloud or transcribe. Try reading one of the legacy addresses in this chapter to a friend who you have transcribe it. Notice how you have to prefix every letter with the words “uppercase” and “lowercase.” Also, note when you review their writi
... See moreDavid A. Harding • Mastering Bitcoin
In legacy serialization, the marker byte would have been interpreted as the number of inputs (zero). A transaction can’t have zero inputs, so the marker signals to modern programs that extended serialization is being used. The flag field provides a similar signal and also simplifies the process of updating the serialization format in the future.
David A. Harding • Mastering Bitcoin
Coinbase transactions are created by the miner of the block that includes them and gives the miner the option to claim any fees paid by transactions in that block. Additionally, up until block 6,720,000, miners are allowed to claim a subsidy consisting of bitcoins that have never previously been circulated, called the block subsidy. The total amoun
... See moreDavid A. Harding • Mastering Bitcoin
Although this process of paying to a public key hash (P2PKH) may seem convoluted, it allows Alice’s payment to Bob to contain only a 20 byte commitment to his public key instead of the key itself, which would’ve been 65 bytes in the original version of Bitcoin. That’s a lot less data for Bob to have to communicate to Alice.
David A. Harding • Mastering Bitcoin
The index number used in the derivation function is a 32-bit integer. To easily distinguish between keys created through the normal derivation function versus keys derived through hardened derivation, this index number is split into two ranges. Index numbers between 0 and 231 – 1 (0x0 to 0x7FFFFFFF) are used only for normal derivation. Index number
... See moreDavid A. Harding • Mastering Bitcoin
Each input in a transaction must contain three fields: an outpoint field, a length-prefixed input script field, and a sequence
David A. Harding • Mastering Bitcoin
Modern wallet applications don’t independently generate keys but instead derive them from a single random seed using a repeatable (deterministic) algorithm.
David A. Harding • Mastering Bitcoin
It’s important to note that the use of a passphrase also introduces the risk of loss: If the wallet owner is incapacitated or dead and no one else knows the passphrase, the seed is useless and all the funds stored in the wallet are lost forever. Conversely, if the owner backs up the passphrase in the same place as the seed, it defeats the purpose o
... See more