
Mastering Bitcoin

The OP_TRUE opcode, also known as OP_1, will put the number 1 on the stack.
David A. Harding • Mastering Bitcoin
Satoshi Nakamoto’s invention is also a practical and novel solution to a problem in distributed computing, known as the “Byzantine Generals’ Problem.” Briefly, the problem consists of trying to get multiple participants without a leader to agree on a course of action by exchanging information over an unreliable and potentially compromised network.
... See moreDavid A. Harding • Mastering Bitcoin
Because transactions may contain multiple outputs, Alice also needs to identify which particular output from that transaction to use, called its output index. Output indexes are 4-byte unsigned integers starting from zero.
David A. Harding • Mastering Bitcoin
There is also a reference implementation of the Bitcoin protocol that includes a wallet, known as “Bitcoin Core,” which is derived from the original implementation written by Satoshi Nakamoto.
David A. Harding • Mastering Bitcoin
The original version of Bitcoin introduced a new programming language called Script, a Forth-like stack-based language. Both the script placed in an output and the legacy input script used in a spending transaction are written in this scripting language. Script is a very simple language. It requires minimal processing and cannot easily do many of t
... See moreDavid A. Harding • Mastering Bitcoin
In “Scripted Multisignatures”, we looked at scripts that require signatures from multiple keys. However, there’s another way to require cooperation from multiple keys, which is also confusingly called multisignature. To distinguish between the two types in this section, we’ll call the version involving OP_CHECKSIG-style opcodes script multisignatur
... See moreDavid A. Harding • Mastering Bitcoin
The BIP39 standard allows the use of an optional passphrase in the derivation of the seed. If no passphrase is used, the recovery code is stretched with a salt consisting of the constant string "mnemonic", producing a specific 512-bit seed from any given recovery code. If a passphrase is used, the stretching function produces a different
... See moreDavid A. Harding • Mastering Bitcoin
Multisignature scripts set a condition where k public keys are recorded in the script and at least t of those must provide signatures to spend the funds, called t-of-k. For example, a 2-of-3 multisignature is one where three public keys are listed as potential signers and at least two of those…
Some highlights have been hidden or truncated due to ex
David A. Harding • Mastering Bitcoin
The developers working on an address format for segwit found solutions for each of these problems in a new address format called bech32 (pronounced with a soft “ch”, as in “besh thirty-two”).