Consensus mechanisms are the heart of every blockchain. When you move away from a centralised validator (like a bank) as we described in Blockchain Basics, you need someone to take over the role of checking to make sure transactions are valid. This is particularly true when it comes to digital currency, because as with any digitally stored data, it’s very easy to copy. In the real world, I can hand you some cash and I’ll have no cash left to hand someone else. However, in the digital world, this currency could theoretically be faked, allowing you to spend the same money multiple times. This is known as the double-spend problem, and resolving this dilemma required the invention of consensus mechanisms, which use a large number of miners or nodes to validate transactions instead of relying on a central authority. There are quite a few different types of consensus mechanism, and new ones are being developed all the time. For now we’ll focus on what they all have in common.
A consensus mechanism has one main purpose, and a secondary purpose that isn’t technically necessary, but definitely helps keep things decentralised in a competitive system. First up, it should provide a way for everyone to agree on which transactions are valid. In essence, it means everyone using the blockchain agrees that the data on the shared ledger is the truth. This also means that powerful/wealthy individuals or groups should never be able to decide the truth for themselves, otherwise it would remain centralised. In order to agree on a single version of the truth without a small group of wealthy people dictating it, you need a huge number of people participating in the consensus process. The more people are contributing to the consensus process, the more decentralised it will be. This is where we find the secondary function that a consensus mechanism based on competition should have; a way to provide incentives that will encourage more people to get involved.
There are a few different approaches that are commonly used to reach consensus. A blockchain requires quite a few different features to be useful. These features are:
- Decentralisation – Most blockchains need to be both politically and architecturally decentralised to a significant degree
- Scalability – How many transactions per second can be consistently processed by the network
- Security – How difficult it is to disrupt/control consensus, or attack the network in some way
- Finality – A measure of how long it takes for a transaction to be considered unchangeable and therefore trusted (or final)
Some consensus mechanisms focus entirely on becoming decentralised (which aids security), but then they run into scalability or finality issues. Other approaches will sacrifice architectural decentralisation and aim to maximise the others. Different use cases for blockchain have different requirements, and the people using these networks will also have their own preferences. Since each trait can be measured on a scale, competing projects will attempt to balance those scales in their own way in an attempt to appeal to the largest possible number of users.
We’ll have to go into a bit more technical detail to explain the current approaches to consensus. Each has their own unique strengths and challenges to overcome, so we’ll pick up on this in the article section dedicated to consensus mechanisms. However, if you feel like you’ve understood the purpose of them and are ready to move on, you can get started learning about smart contracts.