Consensus in a blockchain context is referred to an algorithm that a cryptocurrency uses in order to ensure the integrity of the blockchain. The main objectives of the consensus algorithm are to prevent double spending and to prevent unwanted forks.
There are different methods of finding consensus in a blockchain:
- Proof-of-work: is the oldest consensus mechanism and was invented by Satoshi Nakamoto. It is currently used in Bitcoin, Litecoin and Ethereum among other cryptocurrencies. It is criticized for its high amount of energy consumption.
- Proof-of-stake: Ethereum plans to switch to this algorithm in the near future
- Delegated Proof-of-stake
Proof-of-work consensus rules for Bitcoin
The consensus rules are the specific set of rules that all Bitcoin full nodes will unfailingly enforce when considering the validity of a block and its transactions. For example, the Bitcoin consensus rules require that blocks only create a certain number of bitcoins. If a block creates more bitcoins than is allowed, all full nodes will reject this block, even if every other node and miner in the world accepts it. Adding new consensus rules can generally be done as a softfork, while removing any consensus rule requires a hardfork. Rules regarding the behavior of the mere network protocol are not consensus rules, even if a change to the network protocol behavior breaks backward-compatibility. The consensus rules are only concerned with the validity of blocks and transactions.
These rules are called consensus rules because Bitcoin requires that all participants in the Bitcoin economy have consensus (with the meaning of the next definition) as to the consensus rules. If the economy disagrees about the consensus rules, then the currency and economy splits into two or more totally-independent pieces.