CS120 Study Guide
Unit 8: Reaching Consensus
8a. Understand the transaction validation process
- Which nodes on the Bitcoin network do the job of checking the validity of transactions broadcast to the network?
Every full node on the Bitcoin network validates every transaction. This is important to the peer-to-peer structure of the network. Every node will see incoming transactions and run the full checks to determine if the transaction is valid. These checks include the basics, such as confirming that the inputs being used have not yet been spent and that the amount of satoshis in the inputs is equal to or greater than the satoshis in the outputs, all the way to validating the signatures included.
If a transaction passes all the checks, the node has confirmed that it meets the consensus rules and is valid. Valid transactions are forwarded to the node's peers, while invalid transactions are not propagated through the network.
To review, see The Consensus Process.
8b. Explain how Bitcoin is updated while maintaining consensus
- If no one controls Bitcoin, who can implement updates to the software?
Bitcoin's balance of power means that it is difficult for one entity to control it, but it also means that implementing changes can be very difficult. For a change in the code/network to be implemented, there needs to be a near-complete consensus between the participants in the network and ecosystem. The developers working on the code changes need to cooperate, node operators need to be willing to update to the new software, merchants accepting Bitcoin need to accept the resulting version of Bitcoin, wallets need to build support for the changes, etc.
If some of the nodes on the network enact changes that are not backward compatible while others don't, the network may be split in two. This type of network partition is called a hard fork, as, after the fork, the chains evolve independently. Those attempting to implement changes on the Bitcoin network generally work hard to avoid this scenario. Many strategies are enacted to ensure that changes are either backward compatible(a soft fork) or have near-complete consensus.
To review, see Validating Blocks.
8c. Explain how "double spends" are prevented
- What prevents a miner from cheating and including a double spend or an invalid transaction in a block?
Miners are incentivized to do the work of mining by the possibility of receiving mining rewards. The Bitcoin software allows for a special transaction, called the coinbase transaction, to be included in each block, giving the miner their mining reward. However, those funds can not be spent until that new block has 100 confirmations. This means that the miner who found the block can not use their reward until the network has accepted that block for over half a day. If that miner were to include an invalid transaction in that block, it would quickly be recognized as an invalid block by other nodes on the network and rejected.
To sum it up, a miner will not include invalid transactions in their blocks as they would get no benefit from doing so. The network would reject the block, and the work they put into making it would go to waste.
To review, see The Consensus Process.
8d. Summarize the Bitcoin mining process and how consensus is achieved
- What is the most cumulative Proof-of-Work, and what role does it play in consensus?
It sometimes occurs on the Bitcoin network that two new blocks are found at roughly the same time. From the perspective of a mining node, this looks like a fork in the blockchain, and they need to decide which of these different chains to build on top of. A node will choose the chain or fork with the most cumulative proof-of-work. This is generally the chain with the most blocks. Where there are two equal-length chains, a mining node will choose to build on the one which has the most Proof-of-Work.
Remember that proof-of-work is proof that computing power was put into finding hashes to data that meet certain criteria. Specifically, a block hash with more zeros is proof of more work than one with fewer zeros. A node will follow the chain with the blocks with hashes that were essentially the hardest to find, as that is good proof that more work went into "mining" those blocks.
To review, see The Consensus Process and Validating Blocks.
Unit 8 Vocabulary
This vocabulary list includes terms you will need to know to successfully complete the final exam.
- hard fork
- soft fork