BTC
$31,387.01
-8.95%
ETH
$1,266.70
-10.65%
USDT
$1.00
0.03%
XRP
$0.26
-5.19%
ADA
$0.33
-7.54%
LINK
$21.97
-10.09%
LTC
$132.08
-9.29%
BCH
$419.54
-9.11%
BNB
$40.42
-6.28%
XLM
$0.25
-7.71%
BSV
$173.85
-2.14%
EOS
$2.58
-5.59%
XMR
$135.98
-4.70%
XTZ
$2.81
-9.18%
TRX
$0.03
-7.53%
NEO
$22.63
-8.45%
ATOM
$7.51
-9.54%
CRO
$0.07
-9.78%
MKR
$1,320.47
-9.03%
MIOTA
$0.42
-10.51%
HT
$5.49
-5.38%
DOGE
$0.01
-7.34%
DASH
$101.85
-9.28%
ZEC
$86.12
-9.39%
ETC
$7.17
-7.99%
BAT
$0.28
-10.28%
TUSD
$1.00
-0.00%
ZRX
$0.50
-8.94%
MCO
$2.72
-20.91%
BeginnerIntermediateAdvanced
  • Home
  • >News
  • >Ask CryptoVantage: What Are Bitcoin’s “Consensus Rules”?

Ask CryptoVantage: What Are Bitcoin’s “Consensus Rules”?

Have you ever wondered how it’s possible for bitcoin to process billions of dollars of transactions every day, without the need for a central authority such as a bank or government? Thousands of computers, known as bitcoin nodes, run bitcoin software to ensure that every single transaction is valid and that nobody tries to create new bitcoin out of thin air. In order to come to an agreement on what the valid state of the bitcoin blockchain is, the bitcoin nodes all follow the same set of rules for processing and validating transactions.

Bitcoin utilizes consensus rules to protect the network

These rules, known as “consensus rules”, are the reason bitcoin can operate without trusting a central authority. This article explains what consensus rules are in a general sense and provides examples of some consensus rules used within the bitcoin protocol.

What Are Consensus Rules?

Distributed systems such as bitcoin rely on consensus rules in order to function properly. Distributed systems consist of networks of computers that are separate from each other that must all come to an agreement on the state of the system. These computers cannot always communicate directly, but by using consensus rules they can all come to a consensus on what is or is not a valid state.

The bitcoin network consists of thousands of computers, or nodes, distributed around the world. These bitcoin nodes each independently validate every bitcoin transaction by following bitcoin’s consensus rules. As a result, each bitcoin node ends up with their own identical copy of the bitcoin ledger, allowing bitcoin to operate without the need for a central authority.

Examples of Bitcoin’s Consensus Rules

When people think of consensus within bitcoin, perhaps the most common thing that comes to mind is the 21,000,000 BTC limit. Pretty much every bitcoin owner knows there will only ever be 21 million, but what is less commonly known is that the limit comes from a simple consensus rule that all bitcoin nodes follow.

The 21 million limit is achieved by limiting the amount of new bitcoins that get created. The only way new bitcoins get created is through bitcoin mining. Every block of bitcoin transactions pays the miner a “block subsidy”, which acts as a way to incentivize miners to process transactions (more on that here). Originally, a miner could earn a block subsidy of 50 BTC from each block, and roughly every four years the block subsidy gets cut in half. It was 25 BTC from 2012-2016, 12.5 BTC from 2016-2020, and it will be 6.25 for the next four years. These block subsidy halvings are set to occur until the subsidy is reduced to zero around the year 2140. To ensure that no extra bitcoins get created, every bitcoin node looks at the block subsidy from each block and makes sure they are never higher than the predetermined amount.

Some other bitcoin features that are controlled by the consensus rules include:

  • Difficulty adjustment: Every 2,016 blocks, nodes re-calculate how hard it should be for miners to mine blocks. This way, nodes can agree on whether mining needs to be made easier or harder based on the amount of computing power that leaves or joins the network. By adjusting the difficulty based on computer power we can keep block times relatively consistent at approximately 10 minutes per block.
  • Coinbase maturity: When a new block is mined, the block reward is locked for 100 blocks and cannot be spent until it reaches maturity.
  • The total value of a transaction’s “outputs” cannot be greater than the total value of its “inputs”. In other words, nodes check each and every bitcoin transaction to ensure that it doesn’t create new bitcoin out of thin air.

Unwritten Rules

Not all of bitcoin’s consensus rules are recorded in writing. Instead, some of the rules are recorded in code. Bitcoin Core is the software that most people use to participate in the bitcoin network. That implementation, known as the “reference implementation”, sets the consensus rules for bitcoin. Any other bitcoin implementations must ensure their software follows the same rules as Bitcoin Core.

Some consensus rules are easy to record in writing, such as “there can only be 21,000,000 BTC”, but others are not so easy. For example, in 2013 there was a consensus failure when an upgrade in Bitcoin Core caused a subtle change to the way database locks were handled. At the time, it wasn’t even known that database locks affected consensus. But when the new version of Bitcoin Core started allowing more locks than the nodes running the newer version, the different versions no longer agreed on the valid state of the blockchain, causing the chain to split temporarily. The chain split was quickly fixed when miners decided to switch back to using the older version of Bitcoin Core, but it highlighted the importance of bitcoin’s consensus rules, nonetheless.

Conclusion

Bitcoin’s consensus rules are at the core of what allows the bitcoin network to operate without the need for a central authority. Whether they are limiting the amount of bitcoin that gets created every day, or ensuring only valid transactions are accepted, bitcoin’s consensus rules are the reason bitcoin works the way it does. Even though distributed systems have used consensus rules for a long time, bitcoin is the first system designed with the consensus rules necessary to allow a peer-to-peer electronic cash system that does not rely on a trusted central authority.

Article Tags
CryptoVantage Author Billy Garrison

About the Author

Billy Garrison

Billy Garrison focuses his research and writing on Bitcoin and the Lightning Network. He is interested in the technical details that allow these technologies to survive and grow without the need for a central authority. Billy also loves helping people learn about Bitcoin which led him to start the Halifax Bitcoin Meetup.