A blockchain consensus mechanism is a type of automated system that aims to achieve two goals:
- Provide a distributed, leaderless way to unanimously agree on data stored on a blockchain ledger.
- Make sure all network validators follow protocol rules and perform their role honestly.
While it may be tempting to assign a single person or entity the role of ensuring that everyone behaves according to the rules, hierarchical systems have certain shortcomings. This is why Bitcoin uses a consensus mechanism.
Bitcoins the use of consensus mechanisms has created a true peer-to-peer electronic payment system. This system compensated for the need for centralized intermediaries, like banks and governments, and changed the concept of financial freedom for everyone.
What does this mean in practice? This means that bitcoin is the first currency not controlled by a central bank. The resulting freedom, in theory, allows us to explore some very interesting questions about the nature of trust and consensus.
What is the problem of the Byzantine generals?
One of the biggest things Bitcoin did was solve the Byzantine Generals problem. Imagine that you are the commander of an army made up of several platoons of soldiers, each located in a different place on the battlefield. You plan to attack a single fortified area at a specific time. To do this, you need to coordinate with each of your platoons to make sure they all know the correct time, location, and course of action.
But what happens if one or more platoons do not receive the orders? What if they attack too soon? What if they arrive at the wrong place? What if there are traitors in a platoon trying to sabotage the plan?
In other words, until Bitcoin, there was no sure way to achieve consensus among different parties in an environment that lacked implicit trust.
This problem first appeared in a 1982 academic paper that explored how a distributed network could reach agreement in a decentralized way. The answer, as Satoshi Nakamoto explained in the bitcoin white paperwas a consensus mechanism.
This algorithm allows all nodes in the network to agree on a single version of the truth, even if some of the nodes act maliciously or simply fail. The consensus mechanism works by having each node in the network broadcast and validate all transactions on the network. After a node commits a transaction, all other nodes add a record to their copy of an append-only register. “Append-only” means that the registry can only receive new records and no one can modify previous records. This is called a blockchain.
Returning to the problem of Byzantine generals, each platoon individually confirmed and stored orders and checked with the other platoons. If one of them claims the attack is called off, for example, further checking with nearby platoons would prove a leader was lying. This ensures that all nodes in the network have the same version of the truth. It also means that malicious nodes cannot manipulate network data on their own.
How do consensus mechanisms work?
There are many different methods employed by various block chains And cryptocurrency protocols to reach a consensus. However, the two most popular are known as proof-of-work (PoW) and proof-of-stake (PoS) consensus mechanisms.
Proof of Work (PoW)
Computer scientists Cynthia Dwork and Moni Naor first developed PoW in 1993 as a way to prevent email spam. The creator of Bitcoin then took the concept and adapted it for use in a decentralized monetary system.
Through the bitcoin mining processnetwork validators (known as miners) use specialized computer equipment to win a crypto-based contest that repeats every ten minutes.
You can read more about this concept in our Learning Center article How do cryptocurrencies use cryptography?
PoW uses computational resources to ensure that “work” has been put into “proving” that newly proposed transactions are valid and adhere to protocol rules.
The work involves costs for electricity, maintenance and initial capital that each miner must cover himself. This cost is significant because it helps deter malicious actors from joining the network and attempting to corrupt it with spam or fraudulent transactions. After all, you’re less likely to want to corrupt something when you’ve invested your own money in it.
Proof of Stake (PoS)
PoS is a relatively new type of consensus mechanism pioneered by Sunny King and Scott Nadal in 2012.
Like proof of work, PoS fulfills the same key purposes of a consensus mechanism, but in a unique and different way.
Rather than competing with other validators on the network to win a crypto-based competition first, PoS requires network participants to “stake” or lock their assets to become validators.
PoS uses a system of rewards and penalties to ensure that transactions are validated and added to the blockchain honestly. Those who want to lock more cryptocurrency have a higher chance of offering new blocks and earning rewards. But, if validators break protocol rules, their staked assets risk being automatically confiscated in a process known as slashing.
What is the best blockchain consensus mechanism?
The debate over the “best” consensus mechanism will probably never be settled. There are too many factors regarding each blockchain’s specific use case to draw a definitive conclusion.
Many perceive PoW to provide greater security against 51% of attacks, but the process consumes a significant amount of energy. We already busted the myth that bitcoin is destroying the environment in a previous blog post, but the perception remains.
While many PoS blockchains consume much less power than PoW chains, many believe these blockchains are compromised. For example, they believe that PoS blockchains focus on decentralization in favor of security. You can read more about this in our Blockchain Trilemma discussion.
In short, experts generally perceive PoW as offering better guarantees of security and decentralization, while sacrificing some degree of scalability in the process. PoS is considered to offer better scalability, while sacrificing some degree of security and decentralization.
The best choice ultimately depends on many factors, including the primary use case for a given blockchain.
Keep learning about crypto
Interested in learning more about the Byzantine Generals problem and the different trade-offs of different blockchain consensus mechanisms? THE Kraken Learning Center is here to help!
Check out one of our latest articles, What is a blockchain consensus mechanism?to continue learning more about the important role consensus mechanisms play in crypto and blockchain technology.
These materials are for general informational purposes only and do not constitute investment advice or a recommendation or solicitation to buy, sell or hold any digital asset or to engage in any specific trading strategy. Some crypto products and markets are unregulated and you may not be protected by government indemnities and/or regulatory protection schemes. The unpredictable nature of crypto-asset markets can lead to loss of funds. Tax may be due on any return and/or increase in value of your Crypto Assets and you should seek independent advice on your tax position.