Nakamoto Consensus
Nakamoto Consensus¶
Because Bitcoin adopts a decentralized blockchain design, nodes are distributed and operate in parallel. Therefore, a system must be designed to maintain operational order and fairness, unify blockchain versions, reward users who provide resources to maintain the blockchain, and punish malicious actors. This is how consensus mechanisms came about. The fundamental problem that consensus mechanisms need to solve is: how can a node add a block to the blockchain with the agreement of the entire network.
A consensus mechanism must simultaneously satisfy two properties: Consistency - all honest nodes maintain an identical prefix of the blockchain; and Validity - information published by any honest node will eventually be recorded in the blockchain of all other honest nodes.
Is it feasible to use a voting mechanism to reach consensus? For example, a node packages a block and broadcasts it to the entire network, other nodes verify it upon receipt, voting in favor if correct and against if incorrect, with the block added to the blockchain if it receives a majority of favorable votes. However, this approach would create many problems, such as network latency, malicious node voting, or Sybil attacks (attacking by impersonating multiple identities).
Bitcoin adopted an ingenious solution: Proof of Work (PoW), which essentially means voting through computing power.
Proof of Work (PoW)¶

PoW Principles¶
The essence of Proof of Work is: attempting numerous random numbers in hash computations. Specifically, finding a nonce to include in the block header such that the computed hash of the block header is less than or equal to the target value in the block header. If the target condition is not met, a new nonce is found and the operation is repeated until the target condition is satisfied. The hash function used in Bitcoin is the SHA256 algorithm, a member of the cryptographic hash function family that produces a 256-bit output.
Formula: H(block header + nonce) <= target
According to one property of hashing - puzzle friendliness - the computed hash result is unpredictable. For a given input x, if we want the hash value H(x) to fall within a certain range, there is no shortcut - we can only try each value of x one by one (which is why a significant amount of work is required). The reason only the block header hash is calculated (not including the block body) is that the Merkle root hash in the block header ensures that the content of the block body has not been tampered with.
PoW Protection Against Malicious Nodes¶
- The PoW consensus mechanism competes for bookkeeping rights based on computing power, so malicious nodes creating numerous accounts is useless. (Addressing Sybil attacks)
- PoW requires finding the correct nonce before broadcasting to the network, and continuously packaging illegal transactions clearly offers no benefit, as it would consume significant economic costs, including hardware infrastructure, electricity, and maintenance.
PoW Reward Mechanism¶
The Bitcoin system stipulates that when Proof of Work reaches network-wide consensus and is added to the blockchain, a block reward can be earned. The origin of all bitcoins is through block rewards, which is the sole source of new bitcoin creation.
Reward Rules: The Bitcoin system maintains an average of one successful Proof of Work (successful mining) every 10 minutes. The initial mining reward in Bitcoin was 50 BTC, and the reward halves every 210,000 blocks - to 25 BTC, and so on.
- Calculating the BTC reward halving period
Based on 2 conditions:
-
On average, one block is produced every 10 minutes (successful mining)
-
The reward halves every 210,000 blocks
The time needed to mine 210,000 blocks:
210,000 * 10 / 60 / 24 / 365 = 3.995 years
The calculated time is 3.995 years, approximately 4 years. This means that Bitcoin rewards halve approximately every 4 years.
This also means that around the year 2140, Bitcoin will no longer increase in supply, reaching saturation. Miners will no longer receive block rewards from mining.
Reference: https://zhuanlan.zhihu.com/p/112477662