top of page
  • Writer's pictureGlobal MoonXBT

Understanding Blockchain Consensus Algorithms

What is blockchain consensus algorithms

We can define a consensus algorithm as the mechanism through which a blockchain network reach consensus. The most common implementations are Proof of Work (PoW) and Proof of Stake (PoS). But let’s take the Bitcoin case as an example.

While the Bitcoin protocol prescribes the primary rules of the system, the PoW consensus algorithm is what defines how these rules will be followed in order to reach consensus (for instance, during the verification and validation of transactions).

Although the concept of Proof of Work is older than cryptocurrencies, Satoshi Nakamoto developed a modified version of it as an algorithm that enabled the creation of Bitcoin as a BFT system.

Note that the PoW algorithm is not 100% tolerant to the Byzantine faults, but due to the cost-intensive mining process and the underlying cryptographic techniques, PoW has proven to be one of the most secure and reliable implementations for blockchain networks. In that sense, the Proof of Work consensus algorithm, designed by Satoshi Nakamoto, is considered by many as one of the most genius solutions to the Byzantine faults.

What is Proof of Work (PoW)?

Proof of Work (commonly abbreviated to PoW) is a mechanism for preventing double-spends. Most major cryptocurrencies use this as their consensus algorithm. That’s just what we call a method for securing the cryptocurrency’s ledger.

Proof of Work was the first consensus algorithm to surface, and, to date, remains the dominant one. It was introduced by Satoshi Nakamoto in the 2008 Bitcoin white paper, but the technology itself was conceived long before then.

Adam Back’s HashCash is an early example of a Proof of Work algorithm in the pre-cryptocurrency days. By requiring senders to perform a small amount of computing before sending an email, receivers could mitigate spam. This computation would cost virtually nothing to a legitimate sender, but quickly add up for someone sending emails en masse.

What is a double-spend?

A double-spend occurs when the same funds are spent more than once. The term is used almost exclusively in the context of digital money – after all, you’d have a hard time spending the same physical cash twice. When you pay for a coffee today, you hand cash over to a cashier who probably locks it in a register. You can’t go to the coffee shop across the road and pay for another coffee with the same bill.

In digital cash schemes, there’s the possibility that you could. You’ve surely duplicated a computer file before – you just copy and paste it. You can email the same file to ten, twenty, fifty people.

Since digital money is just data, you need to prevent people from copying and spending the same units in different places. Otherwise, your currency will collapse in no time.

Why is Proof of Work necessary?

Users broadcast transactions to the network. Those transactions aren’t immediately considered valid, though. That only happens when they get added to the blockchain.

The blockchain is a big database that every user can see, so they can check if funds have been spent before. Picture it like this: you and three friends have a notepad. Anytime one of you wants to make a transfer of whatever units you’re using, you write it down – Alice pays Bob five units, Bob pays Carol two units, etc.

There’s another intricacy here – each time you make a transaction, you refer to the transaction where the funds came from. So, if Bob was paying Carol with two units, the entry would actually look like the following: Bob pays Carol two units from this earlier transaction with Alice.

Now, we have a way to track the units. If Bob tries to make another transaction using the same units he just sent to Carol, everyone will know immediately. The group won’t allow the transaction to be added to the notepad.

Now, this might work well in a small group. Everyone knows each other, so they’ll probably agree on which of the friends should add transactions to the notepad. What if we want a group of 10,000 participants? The notepad idea doesn’t scale well, because nobody wants to trust a stranger to manage it.

This is where Proof of Work comes in. It ensures that users aren’t spending money that they don’t have the right to spend. By using a combination of game theory and cryptography, a PoW algorithm enables anyone to update the blockchain according to the rules of the system.

What is Ethereum Proof of Stake (PoS)?

Proof of Stake (PoS) is an alternative method to Proof of Work for validating blocks. In a Proof of Stake system, blocks aren’t mined, as such, but minted (sometimes referred to as forged). Instead of miners competing with hash power, a node (or validator) is periodically chosen at random to validate a candidate block. If done correctly, they will receive all of that block’s transaction fees and, depending on the protocol, possibly a block reward.

Since there’s no mining involved, Proof of Stake is regarded as less harmful to the environment. Validators don’t consume nearly as much energy as miners, and can instead mint blocks on consumer-grade hardware.

Ethereum is scheduled to transition from PoW to PoS as a part of Ethereum 2.0, with an upgrade known as Casper. Though an exact date has yet to be formalized, the first iteration will likely be launched in 2020.

Proof of Work vs. Proof of Stake

There are many consensus algorithms, but one of the most highly-anticipated ones is Proof of Stake (PoS). The concept dates back to 2011, and has been implemented in some smaller protocols. But it has yet to see adoption in any of the big blockchains.

In Proof of Stake systems, miners are replaced with validators. There’s no mining involved and no race to guess hashes. Instead, users are randomly selected – if they’re picked, they must propose (or “forge”) a block. If the block is valid, they’ll receive a reward made up of the fees from the block’s transactions.

Not just any user can be selected, though – the protocol chooses them based on a number of factors. To be eligible, participants must lock up a stake, which is a predetermined amount of the blockchain’s native currency. The stake works like bail: just as defendants put up a large sum of money to disincentivize them from skipping trial, validators lock up a stake to disincentivize cheating. If they act dishonestly, their stake (or a portion of it) will be taken.

Proof of Stake does have some benefits over Proof of Work. The most notable one is the smaller carbon footprint – since there’s no need for high-powered mining farms in PoS, the electricity consumed is only a fraction of that consumed in PoW.

That said, it has nowhere near the track record of PoW. Although it could be perceived as wasteful, mining is the only consensus algorithm that’s proven itself at scale. In just over a decade, it has secured trillions of dollars worth of transactions. To say with certainty whether PoS can rival its security, staking needs to be properly tested in the wild.

*What is the Byzantine Generals’ Problem?

In a few words, the Byzantine Generals’ Problem was conceived in 1982 as a logical dilemma that illustrates how a group of Byzantine generals may have communication problems when trying to agree on their next move.

The dilemma assumes that each general has its own army and that each group is situated in different locations around the city they intend to attack. The generals need to agree on either attacking or retreating. It does not matter whether they attack or retreat, as long as all generals reach consensus, i.e., agree on a common decision in order to execute it in coordination.

Therefore, we may consider the following requirements:

  • Each general has to decide: attack or retreat (yes or no);

  • After the decision is made, it cannot be changed;

  • All generals have to agree on the same decision and execute it in a synchronized manner.

The aforementioned communication problems are related to the fact that one general is only able to communicate with another through messages, which are forwarded by a courier. Consequently, the central challenge of the Byzantine Generals’ Problem is that the messages can get somehow delayed, destroyed or lost.

In addition, even if a message is successfully delivered, one or more generals may choose (for whatever reason) to act maliciously and send a fraudulent message to confuse the other generals, leading to a total failure.

If we apply the dilemma to the context of blockchains, each general represents a network node, and the nodes need to reach consensus on the current state of the system. Putting in another way, the majority of participants within a distributed network have to agree and execute the same action in order to avoid complete failure.

Therefore, the only way to achieve consensus in these types of distributed system is by having at least ⅔ or more reliable and honest network nodes. This means that if the majority of the network decides to act maliciously, the system is susceptible to failures and attacks (such as the 51% attack).

*Byzantine Fault Tolerance (BFT)

In a few words, Byzantine fault tolerance (BFT) is the property of a system that is able to resist the class of failures derived from the Byzantine Generals’ Problem. This means that a BFT system is able to continue operating even if some of the nodes fail or act maliciously.

There is more than one possible solution to the Byzantine Generals’ Problem and, therefore, multiple ways of building a BFT system. Likewise, there are different approaches for a blockchain to achieve Byzantine fault tolerance and this leads us to the so-called consensus algorithms.

6 views0 comments

Recent Posts

See All
bottom of page