Chapter 6 Quiz

Multiple Choice

1. In Bitcoin's UTXO model, what is the fundamental unit of value? a) An account balance associated with a public key b) An unspent transaction output locked to a spending condition c) A ledger entry recording the transfer from one address to another d) A token stored in the global state trie

2. Alice has a single UTXO worth 1.0 BTC and wants to send 0.3 BTC to Bob with a 0.001 BTC fee. How many outputs will her transaction have? a) 1 (0.3 BTC to Bob) b) 2 (0.3 BTC to Bob + 0.699 BTC change to Alice) c) 3 (0.3 BTC to Bob + 0.699 BTC to Alice + 0.001 BTC fee output) d) The number of outputs depends on the miner's preference

3. The transaction fee in Bitcoin is: a) An explicit field in the transaction data structure b) Specified by the sender in a dedicated fee field c) The difference between total input values and total output values d) Determined by the network and deducted automatically

4. What is the "dust threshold" in Bitcoin? a) The minimum transaction amount allowed by the protocol b) The amount below which a UTXO costs more to spend than it is worth c) The fee required to include a transaction in the next block d) The minimum block reward after all halvings are complete

5. A Bitcoin block header is exactly: a) 64 bytes b) 80 bytes c) 128 bytes d) Variable length, depending on the number of transactions

6. Which block header field links the current block to the previous block? a) The Merkle root b) The nonce c) The previous block hash (SHA-256d of the previous header) d) The timestamp

7. The Merkle root in a block header serves what purpose? a) It stores the hash of the coinbase transaction only b) It commits to every transaction in the block via a binary hash tree c) It records the difficulty target for the next block d) It contains the miner's reward address

8. What is the coinbase transaction? a) Any transaction that sends Bitcoin to an exchange b) The first transaction in every block, which creates new Bitcoin as a block reward c) A transaction type used only for multi-signature wallets d) The transaction that pays the network fee to all validating nodes

9. Why must coinbase transaction outputs wait 100 blocks before being spent? a) To prevent miners from spending rewards too quickly b) To protect against blockchain reorganizations that could invalidate the block c) To ensure the mining pool has time to distribute rewards d) This rule was removed by SegWit

10. The SegWit upgrade primarily solved which two problems? a) High fees and slow confirmation times b) Transaction malleability and block capacity limitations c) Double-spending and the 51% attack d) Privacy leaks and address reuse

11. In a SegWit transaction, the signature data is: a) Placed in the ScriptSig field, as in legacy transactions b) Removed entirely — SegWit transactions do not require signatures c) Moved to a separate "witness" section that is not part of the txid calculation d) Stored in the block header instead of the transaction body

12. SegWit's "weight" formula is: a) weight = non-witness bytes + witness bytes b) weight = (non-witness bytes * 4) + (witness bytes * 1) c) weight = (non-witness bytes * 1) + (witness bytes * 4) d) weight = total bytes * 4

13. The maximum block weight under SegWit rules is: a) 1,000,000 weight units (equivalent to 1 MB) b) 2,000,000 weight units c) 4,000,000 weight units d) 8,000,000 weight units

14. In a P2PKH locking script, what does OP_EQUALVERIFY check? a) That the transaction fee is above the minimum b) That the provided public key's HASH160 matches the hash in the script c) That the signature is valid for the given public key d) That the transaction version is correct

15. Bitcoin Script is intentionally NOT Turing-complete because: a) Satoshi Nakamoto did not know how to implement loops b) Scripts must terminate in bounded time and be deterministic for every validating node c) Turing-complete languages are too slow for blockchain use d) The Bitcoin community voted against Turing completeness in 2015

16. In a P2SH transaction, the actual spending conditions (the redeem script) are revealed: a) When the P2SH address is created b) When funds are first sent to the P2SH address c) Only when the funds are spent d) They are never revealed — that is the point of P2SH

17. A VarInt value of 0xfd followed by 0xe803 (little-endian) represents the integer: a) 253 b) 1000 c) 64,771 d) 1,003

18. What is the block reward at height 840,001? a) 50 BTC b) 6.25 BTC c) 3.125 BTC d) 1.5625 BTC

19. The sequence field in a transaction input was originally designed for: a) Ordering multiple inputs within a transaction b) Transaction replacement in the mempool c) Indicating the transaction's priority level d) Specifying which SegWit version to use

20. Which is NOT an advantage of the UTXO model over the account model? a) Better transaction parallelism b) Simpler smart contract development c) Enhanced privacy through natural address non-reuse d) Simpler double-spend detection

True or False

21. A Bitcoin transaction explicitly contains a "from" address field that identifies the sender.

22. Every UTXO must be spent in its entirety — there is no way to partially spend a UTXO.

23. The locktime field value of 0 means the transaction cannot be included in any block.

24. The genesis block's coinbase transaction contains the text of a newspaper headline from The Times of London.

25. In a SegWit transaction, old (non-upgraded) nodes cannot validate the transaction at all and will reject it.

Short Answer

26. Explain why the transaction fee in Bitcoin is implicit (the difference between inputs and outputs) rather than an explicit field. What would happen if a user accidentally created a transaction with a large gap between inputs and outputs?

27. A block explorer shows that address bc1q...xyz has a "balance" of 2.5 BTC. Explain how this balance is computed, given that Bitcoin does not store account balances. What data structure is the block explorer querying?

28. Describe the OP_CHECKMULTISIG bug and explain why it has never been fixed. What is the practical workaround?

29. Why does SegWit apply a "discount" (weight factor of 1 instead of 4) to witness data? What economic incentive does this create for transaction senders?

30. In the UTXO model, explain why a blockchain reorganization (reorg) does not affect the "balances" of users who did not transact during the reorg period. Contrast this with how a reorg might affect account-model balances.


Answer Key

1. b) An unspent transaction output locked to a spending condition. Bitcoin's fundamental unit is the UTXO — a discrete, indivisible piece of value with specific spending conditions.

2. b) 2 outputs. One output pays Bob 0.3 BTC, and one change output returns 0.699 BTC to Alice. The 0.001 BTC fee is implicit (total inputs minus total outputs).

3. c) The difference between total input values and total output values. There is no fee field in the transaction data structure. Any value in the inputs not accounted for in the outputs is claimed by the miner.

4. b) The amount below which a UTXO costs more to spend than it is worth. Dust UTXOs are economically unspendable because the transaction fee to include them as an input exceeds their value.

5. b) 80 bytes. The block header is always exactly 80 bytes: 4 (version) + 32 (prev hash) + 32 (Merkle root) + 4 (timestamp) + 4 (bits) + 4 (nonce).

6. c) The previous block hash. Each block header contains the SHA-256d hash of the previous block's 80-byte header, creating the chain.

7. b) It commits to every transaction in the block via a binary hash tree. Changing any transaction changes the Merkle root, which changes the block header hash.

8. b) The first transaction in every block, which creates new Bitcoin as a block reward. The coinbase transaction has no real inputs and creates the block subsidy plus fees.

9. b) To protect against blockchain reorganizations that could invalidate the block. If a block is orphaned in a reorg, its coinbase reward disappears. The 100-block maturity rule prevents spending coins that might not exist after a reorg.

10. b) Transaction malleability and block capacity limitations. SegWit fixed malleability by moving signatures out of the txid calculation, and increased effective block size through the weight discount.

11. c) Moved to a separate "witness" section that is not part of the txid calculation. This is the core of SegWit — segregating the witness data.

12. b) weight = (non-witness bytes * 4) + (witness bytes * 1). Witness data gets a 75% discount.

13. c) 4,000,000 weight units. This is equivalent to 1 MB of non-witness data (1,000,000 * 4 = 4,000,000) but allows larger blocks when witness data is present.

14. b) That the provided public key's HASH160 matches the hash in the script. OP_EQUALVERIFY compares the computed hash of the provided public key against the hash embedded in the locking script.

15. b) Scripts must terminate in bounded time and be deterministic for every validating node. A Turing-complete language could loop forever, creating a denial-of-service vector.

16. c) Only when the funds are spent. The redeem script is hidden behind its hash until spending time, which saves space and provides privacy about the spending conditions.

17. b) 1000. The 0xfd prefix indicates a 2-byte little-endian integer follows. 0xe803 in little-endian is 0x03e8 = 1000.

18. c) 3.125 BTC. Height 840,001 is in the range 840,000-1,049,999, which is the 5th era (50 / 2^4 = 3.125).

19. b) Transaction replacement in the mempool. Satoshi designed it for in-mempool transaction updates, but this was disabled early due to DoS concerns. BIP 68 later repurposed it for relative time locks.

20. b) Simpler smart contract development. The account model is simpler for smart contracts. The UTXO model's advantages include parallelism, privacy, and simpler double-spend detection.

21. False. Bitcoin transactions have inputs that reference UTXOs, not "from" addresses. The address is derived from the locking script, not stored as a sender field.

22. True. A UTXO must be consumed entirely. Any excess must be returned as a change output.

23. False. A locktime of 0 means there is no restriction — the transaction can be included in any block immediately.

24. True. The genesis block coinbase contains "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks."

25. False. SegWit was deployed as a soft fork. Old nodes can still validate SegWit transactions — they see the SegWit outputs as "anyone can spend" but accept them because upgraded nodes enforce the new rules.

26. The implicit fee design means there is no way to create a "zero fee" transaction with leftover value — any gap is automatically claimed by the miner. If a user accidentally creates a large gap (e.g., forgetting a change output), the entire difference becomes the miner's fee. This has happened in practice, with users accidentally paying fees of several BTC. The implicit design is simpler and eliminates a potential error vector (fee field conflicts), but it places the responsibility on wallet software to construct correct transactions.

27. The block explorer scans the entire UTXO set (or its indexed copy) for all unspent outputs whose locking scripts resolve to that address. It sums the values of all matching UTXOs. The data structure being queried is the UTXO set — the collection of all unspent transaction outputs. No "balance" is stored anywhere; it is always computed on demand.

28. OP_CHECKMULTISIG has an off-by-one error: it pops one more item from the stack than it should. The workaround is to push a dummy OP_0 onto the stack before the signatures. The bug has never been fixed because doing so would be a consensus-breaking change (a hard fork). Every node must agree on exactly how scripts execute, and changing the behavior of an opcode would cause old and new nodes to disagree on transaction validity.

29. The witness discount incentivizes users to adopt SegWit, which fixes transaction malleability and is required for the Lightning Network. It also recognizes that witness data has a lower long-term storage cost — full nodes can prune witness data from historical blocks while keeping the transaction data, since the witness is only needed during initial validation. The discount makes SegWit transactions cheaper, encouraging adoption.

30. In the UTXO model, a reorg only affects transactions that were in the reorganized blocks. UTXOs that were created and remained unspent before the reorg point are identical in both chain versions. Users who did not transact see no change because their UTXOs exist in both versions of the chain. In the account model, balances are cumulative — a reorg could in theory affect the ordering of nonces, which could invalidate subsequent transactions and change balances even for users who did not transact in the reorganized blocks (e.g., if a smart contract interaction in the reorged blocks affected their account).