
Mastering Bitcoin

The general form of an output script setting a t-of-k multisignature condition is: t <Public Key 1> <Public Key 2> ... k OP_CHECKMULTISIG where k is the total number of listed public keys and t is the threshold of required signatures to spend the output. An output script setting a 2-of-3 multisignature condition looks like this: 2 3 OP_
... See moreDavid A. Harding • Mastering Bitcoin
Most modern noncustodial Bitcoin wallets will provide a recovery code for their user to back up. The recovery code usually consists of numbers, letters, or words selected randomly by the software, and is used as the basis for the keys that are generated by the wallet.
David A. Harding • Mastering Bitcoin
The Bitcoin transaction script language is stateless, in that there is no state prior to execution of the script or state saved after execution of the script. All the information needed to execute a script is contained within the script and the transaction executing the script. A script will predictably execute the same way on any system. If your s
... See moreDavid A. Harding • Mastering Bitcoin
Except for increasing the complexity of Bitcoin slightly, there are no significant downsides of MAST for Bitcoin and there were two solid proposals for it, BIP114 and BIP116, before an improved approach was discovered, which we’ll see in “Taproot”.
David A. Harding • Mastering Bitcoin
Tapscript Taproot enables MAST but only with a slightly different version of the Bitcoin Script language than previously used, the new version being called tapscript. The major differences include: Scripted multisignature changes The old OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY opcodes are removed. Those opcodes don’t combine well with one of th
... See moreDavid A. Harding • Mastering Bitcoin
Pay to Public Key Hash A pay to public key hash (P2PKH) script uses an output script that contains a hash that commits to a public key. P2PKH is best known as the basis for a legacy Bitcoin address. A P2PKH output can be spent by presenting a public key that matches the hash commitment and a digital signature created by the corresponding private ke
... See moreDavid A. Harding • Mastering Bitcoin
The need for full nodes to keep track of all UTXOs, as described in “Outpoint”, means that every UTXO makes it slightly harder to run a full node. For UTXOs containing significant value, there’s an incentive to eventually spend them, so they aren’t a problem. But there’s no incentive for the person controlling an uneconomical UTXO to ever spend it,
... See moreDavid A. Harding • Mastering Bitcoin
The scripting language executes the script by processing each item from left to right. Numbers (data constants) are pushed onto the stack. Operators push or pop one or more parameters from the stack, act on them, and might push a result onto the stack. For example, OP_ADD will pop two…
Some highlights have been hidden or truncated due to export limi
David A. Harding • Mastering Bitcoin
The way we typically transfer physical cash has little resemblance to the way we transfer bitcoins. Physical cash is a bearer token. Alice pays Bob by handing him some number of tokens, such as dollar bills. By comparison, bitcoins don’t exist either physically or as digital data—Alice can’t hand Bob some bitcoins or send them by email. Instead, c
... See more