| Crypto Education

Crypto 101: What is a consensus mechanism?

A blockchain consensus mechanism is a type of automated system that aims to accomplish two objectives:

  1. Provide a distributed, leaderless way to unanimously agree on data stored on a blockchain ledger.
  2. Make sure all network validators follow the rules of the protocol and perform their roles honestly.

While it may be tempting to trust a single individual or entity with the role of making sure everyone behaves according to the rules, hierarchical systems have definite shortcomings. That’s why Bitcoin uses a consensus mechanism.

Bitcoin’s use of consensus mechanisms created a truly peer-to-peer electronic cash system. This system offset the need for centralized intermediaries, like banks and governments, and changed the concept of financial freedom for all.

What does this mean in practice? It means 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.

Learn more

What is the Byzantine Generals’ Problem?

One of the most important things Bitcoin did was solve the Byzantine Generals Problem. Imagine you are the commander of an army consisting of several platoons of soldiers, each located at a different spot on the battlefield. You plan to attack a single fortified area at a specific time. To do this, you must coordinate with each of your platoons to make sure they all know the correct time, location, and plan of action.

But, what if one or more platoons fail to receive the orders? What if they attack too early? What if they arrive at the wrong location? What if there are traitors in a platoon that try to sabotage the plan?

In other words, until Bitcoin there was no safe way to reach consensus among the various parties in an environment lacking 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 laid out in the bitcoin white paper, was 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 of the transactions to the network. Once a node validates a transaction, every other node adds a record to their copy of an append-only ledger. “Append-only” means that the ledger can only receive new records and no one can change previous records. This is called a blockchain.

In going back to the Byzantine Generals problem, each platoon would individually confirm and store the orders and check with other platoons. If one of them claims the attack is cancelled, for example, further checking with nearby platoons would prove that one leader was lying. This guarantees that all nodes in the network have the same version of the truth. It also means that malicious nodes cannot single-handedly manipulate the network data.

How do consensus mechanisms work?

There are many different methods employed by various blockchains and cryptocurrency protocols to achieve consensus. However, the two most popular are known as the proof-of-work (PoW) and the proof-of-stake (PoS) consensus mechanisms.

Proof-of-work (PoW)

Computer scientists Cynthia Dwork and Moni Naor first developed PoW in 1993 as a means of preventing email spam. Bitcoin’s creator later took the concept and adapted it for use in a decentralized monetary system.

Through the bitcoin mining process, network validators (called miners) use specialized computer equipment to win a cryptography-based competition that repeats every ten minutes.

You can learn more about this concept in our Learn Center article How do cryptocurrencies use cryptography?

PoW makes use of computational resources to make sure that “work” has gone into “proving” newly proposed transactions are valid and abide by the rules of the protocol.

The work involves electrical, maintenance, and initial outlay costs that each miner must cover themselves. This cost is important because it helps to deter bad 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 into 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 objectives of a consensus mechanism, but in a uniquely different way.

Rather than competing with other validators on the network to win a cryptography-based competition first, PoS requires network participants to “stake” or lock their assets to become validators.

PoS uses a system of reward and penalty incentives to make sure that transactions are validated and added to the blockchain in an honest way. Those willing to lock away a greater amount of cryptocurrency gain a greater chance of proposing new blocks and earning rewards. But, if validators break the rules of the protocol, their staked assets risk being automatically confiscated in a process known as “slashing.”

What is the best blockchain consensus mechanism?

The debate about which consensus mechanism is “best” will likely never be settled. There are too many factors regarding each blockchain’s specific use case to draw a definitive conclusion.

Many perceive PoW to offer greater security against 51% attacks, but the process consumes a significant amount of energy. We’ve already busted the myth that bitcoin is destroying the environment in a previous blog post, but the perception remains.

While many PoS blockchains consume significantly less energy than PoW chains, many feel these blockchains are compromised. For example, they believe PoS blockchains focus on decentralization in favor of security. You can learn more about this in our discussion of the Blockchain trilemma.

In short, experts generally perceive PoW to offer better security and decentralization guarantees, while sacrificing some degree of scalability in the process. PoS is seen to offer better scalability, while sacrificing some degree of security and decentralization.

The best choice ultimately depends on numerous factors, including a given blockchain’s primary use case.

Keep learning about crypto

Interested in learning more about the Byzantine Generals’ Problem and the various tradeoffs of different blockchain consensus mechanisms? The Kraken Learn Center is here to help!

Check out one of our latest articles, What is a blockchain consensus mechanism?, to continue learning about the important role consensus mechanisms play in crypto and blockchain technology.

Learn more

These materials are for general information purposes only and are not 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 compensation and/or regulatory protection schemes. The unpredictable nature of the cryptoasset markets can lead to loss of funds. Tax may be payable on any return and/or on any increase in the value of your crypto assets and you should seek independent advice on your taxation position.