Consensus Algorithms in Blockchain

If you are reading this, you most likely already know what Blockchain is. If not, stop here, and go through that other post first.

Blockchain decentralization requires a mechanism whereby all network participants agree on the content stored on the Blockchain.

Well, that, neither more nor less, is what consensus mechanisms are.

Its main objective is to verify that the information entered in the Blockchain is correct. Complying with it ensures that the last added block actually contains all the network transactions, and prevents the insertion of duplicate or malicious blocks.

consensus mechanisms

Byzantine Fault Tolerance (BFT)

How can a distributed network of nodes agree on a decision, when it is quite likely that some of them will fail or act maliciously?

This is the basis of the so-called Byzantine generals problem, which gave rise to the concept of Byzantine fault tolerance.

The Byzantine Generals Problem was conceived way back in 1982, and is a dilemma that illustrates how a group of Byzantine Generals have communication problems when trying to agree on the next tactical move.

The dilemma assumes that each general has his own army and that each group is located in different places around the city they intend to attack.

The generals must agree to attack or retreat. It does not matter if they attack or withdraw, as long as all the generals reach a consensus, that is, they agree on a common decision to execute it in a coordinated manner.

These would be the requirements:

  • Each general has to decide: attack or retreat.
  • Once the decision is made, it cannot be changed.
  • All the generals have to agree on the same decision and execute it in a synchronized way.

Communication problems arise from the fact that a general can only communicate with another through messages that are sent by a messenger.

Consequently, the main challenge of the Byzantine Generals problem is that messages can be delayed, destroyed, or lost in some way.

On top of that, one or more generals may choose to act maliciously and send a fraudulent message to confuse the other generals, leading to total failure.

Applying the Byzantine Generals Dilemma to Blockchain

Each general represents a network node, and the nodes must reach a consensus on the current state of the system.

Most participants within a distributed network must agree and take the same action to avoid total failure.

The only way to achieve consensus in these kinds of distributed systems is to have at least ⅔ or more network nodes that are trustworthy and honest.

This means that if the majority of the network decides to act maliciously, the system is susceptible to attacks (such as the 51% attack).

Main characteristics of a BFT system

  • Byzantine Fault Tolerance (BFT) is the property of a system that is capable of withstanding the class of faults derived from the Byzantine Generals problem.
  • A BFT system can continue to function even if some of the nodes fail or act maliciously.
  • There is more than one possible solution to the Byzantine Generals problem, and thus multiple ways to build a BFT system.
  • There are different approaches for a Blockchain to achieve Byzantine fault tolerance and this leads us to so-called consensus algorithms.

List of popular consensus mechanisms

There are quite a few consensus mechanisms, and in fact new ones emerge every day that try to improve the current ones.

What makes them different fundamentally is the way they delegate and reward transaction verification.

Among all of them, the Proof-of-Work mechanism used by Bitcoin is still the dominant one among Blockchain platforms today.

Proof of Work (PoW)

It is the first-born consensus algorithm used in Blockchain. It is what the consensus in the Bitcoin network is based on.

Like any other consensus mechanism, it is used to confirm new transactions and create new blocks on the Blockchain.

Proof-of-Work (PoW) Consensus Mechanism Steps

  • Network users exchange digital tokens among themselves (transactions), which will be grouped into blocks that will ultimately be stored on the Blockchain.
  • There are certain nodes called miners, which try to add new blocks (mine) to the block chain to receive the rewards that are given for it.
  • Miners compete with each other to validate a block, with the transactions that said block contains, and be able to add it to the Blockchain.
  • Once the miner validates a block, the distributed nodes of the network must reach a consensus to accept its resolution.
  • If there is consensus, the block will be added to the network and the miner will receive the reward.

The way to validate the blocks with their transactions is to solve a mathematical problem for which a high computational level is needed.

There are many types of problems of this style that can be used for this purpose. Perhaps one of the best known is that of solving a hash function, in such a way that it is possible to get to know the input, knowing the output and the algorithm used.

In the following example you can see how the usual operation of any Hash algorithm is. There is an input and once it is entered into the algorithm, it generates an output called Hash.

The interesting thing about these algorithms is that the same result is always obtained if the input remains unchanged, and given the hash it is terribly difficult to know the input.

It would take 10 * 3.92 * 10 ^ 56minutes to crack a SHA256 hash using the full mining power of the entire Bitcoin network. I mean… a long time.

As the network grows, the problem grows and the algorithm needs more and more power to solve.

Proof of Stake (PoS)

It is the consensus mechanism that is used in the Ethereum network.

Change the way blocks are validated.

Owners offer their coins as collateral for the ability to validate blocks.

Validators are randomly selected to mine the block. Thus the nodes do not compete with each other as in the proof-of-work mechanism.

Security in the proof of stake mechanism

The famous 51% attack is one of the most present concerns when using this consensus mechanism.

But it is as famous as it is unlikely.

Only if it were the case that someone controlled 51% of a cryptocurrency, could they use that majority to alter the chain of blocks.

Also, miners who try to reverse the blocks would lose 100% of their stake. This is an incentive for miners to act in good faith for the benefit of the cryptocurrency.

There are many security features that are not advertised to avoid creating opportunities to circumvent them.

PoS vs PoW

  • The proof of stake mechanism is more efficient. It doesn’t take much energy to mine a block.
  • Using proof of stake is more immune to centralization, as it invites more nodes to become part of the network.
  • The proof-of-stake consensus algorithm has lower barriers to entry, as no special hardware is required to mine.
proof of work vs proof of stake

Formulation test (PoF)

It is the consensus mechanism used by FLETA, a Blockchain service platform.

This mechanism includes so-called observers, formulators and a synchronization group.

Formulators

They are the backbone of the algorithm. Each formulator has an assigned ranking that is calculated using a specific formula.

In each phase or round of mining, each formulator will have at least one opportunity to mine a block. Here lies the essence of this algorithm.

observers

Its main objective is to prevent DDoS attacks and maintain the security of the Blockchain.

sync group

It is in charge of, once the block has been validated, making the broadcast to the network.

Main features of PoF

This consensus mechanism does not require a high computational resource, nor does it depend on how large a node’s stake is. That is why it reduces competition when creating new blocks, because each user will have their turn.

It also makes it impossible to create any type of fork.

Byzantine Delegated Fault Tolerance (dBFT)

At first glance, the dBFT consensus mechanism is similar to proof of stake.

Through a voting process, NEO token holders are entitled (regardless of the amount of currency held) to vote for delegates.

Anyone can become a delegate, as long as they have a reliable Internet connection, the right equipment, a validated identity and 1,000 GAS, which is the reward users receive for their activity on the network.

Among all the delegates, a ‘speaker’ is randomly chosen, who is the one who will build the new block with the transactions to be validated.

Once validated, you will send your proposal to the elected delegates. Among them they can share the proposals, to check the accuracy of the data and validate if the ‘speaker’ was not malicious.

If more than 2/3 of the delegates reach a consensus and validate it, the block will be added to the network.

Main characteristics of the dBFT

  • The strength of the dBFT consensus mechanism is that it allows consensus to be reached even when there are one or more corrupt delegates.
  • Because delegates must operate under real identities, anonymity is lost.
  • It requires a certain degree of centralization.

Test of Elapsed Time (PoET)

Another consensus algorithm focused on minimizing the high consumption of resources to mine and that tries to make the process more efficient in that regard.

It uses a randomly generated elapsed time to decide who should mine the block. External participants can verify the results of this ‘lottery’, further improving transparency.

Main features of PoET

  • PoET follows a lottery system that distributes the chances of winning equally among network participants, giving each node an equal chance.
  • Generates a random timeout for each node in the Blockchain network; each node must sleep during that time.
  • The node with the shortest waiting time will wake up first and will be able to send a new block to the Blockchain.
  • Consumes less power than the proof-of-work consensus mechanism, because it allows a node to go to sleep and switch to other tasks for a specified time, increasing network energy efficiency

Delegated Proof of Stake (DPOS)

It is a consensus system designed for highly scalable Blockchains. This does not mean that it pays less attention to the security and robustness of the system.

The network participants elect by vote a series of delegates.

The voting process makes use of reputation algorithms and also takes into account the number of tokens that each user has. The more tokens a user has, the more votes they can receive, and therefore the more chances of being part of the final pool of delegates.

The number of delegates is previously defined and limited and due to their election by vote, partial trust in them is assumed.

Once the group of delegates has been created, among them they define a rotation so that each time one of them has the turn to produce a block.

If when a delegate’s turn comes, he is not available, he will lose his turn and the next one in queue will be the one to mine.

To favor decentralization, it is common for decisions related to the operation of the network to always be put to the vote.

Main features of the DPOS

  • Offers Byzantine Fault Tolerance (BFT)
  • It focuses on a voting system that takes into account the reputation of users.
  • Optimizes the use of network resources.
  • It promotes a certain centralization since the voting system takes into account the tokens that each user has.

Federated Byzantine Agreement (FBA)

To understand this consensus mechanism one needs to understand the problem of the Byzantine generals .

In the FBA each Byzantine General is responsible for his own Blockchain.

A node does not have to be known and verified in advance, membership is open, and control is decentralized.

Nodes can choose who they trust. System-wide consensus arises from decisions made by individual nodes.

It is often used for its high performance and scalability and its low transaction cost.

Proof of Authorization (PoA)

It is based on the proof-of-stake (PoS) consensus mechanism, but changes what is staked, which instead of coins, will be reputation.

Transactions and blocks are validated by these approved accounts, known as validators, who act as moderators for the system.

Validators run software which allows transactions to be included in blocks. The process is automated and does not require validators to constantly monitor.

Main features of the PoA

  • Valid and reliable identities.
    • Validators need to confirm their real identities.
  • Difficulty becoming a validator.
    • You must be willing to invest money and put your reputation on the line.
  • Standard for the approval of validators.
    • The method for selecting validators must be the same for all candidates.

Obelisk consensus algorithm

It incorporates the concept of a network of trust .

This concept spreads influence across multiple nodes in the network and makes decisions by consensus based on each node’s influence score.

Each node subscribes to a set number of other network nodes, and a node’s network density of subscribers determines its influence on the network.

There are two types of nodes that participate in the obelisk consensus algorithm:

  • Block generator nodes .
    • They collect new transactions, authenticate them, and package the verified ones into a new block, which they then broadcast to the network.
  • Consensus nodes .
    • They collect the blocks generated by the block generator nodes and put them in a separate container (apart from the Blockchain).
    • They identify the block that was created by the largest number of block generators. This block is called a local winner and qualifies to be added to the Blockchain. Each of those consensus nodes maintains the necessary statistics on local winners (as reported by other nodes).
    • When the majority of consensus nodes have reported local winners, it qualifies as a global winner and continues to be part of the Blockchain. However, if the nodes decide otherwise, it will take one of the following actions based on available data and local logs:
      • Resynchronize with the network.
      • Stop participating in consensus or block creation.
      • Maintain your Blockchain and request an emergency stop.

The roles are interchangeable and the nodes can take any one.

Proof of Burn (PoB)

PoB is often called a PoW system without energy waste.

It operates on the principle of allowing miners to “burn” virtual currency tokens to earn the right to write blocks in proportion to the tokens burned.

Instead of investing money in expensive computing equipment, this consensus protocol “burns” tokens by sending them to an address where they cannot be retrieved.

By sending the coins to neverland, you get a lifetime privilege to mine in the system based on a random selection process.

Proof of Capability (PoC)

The proficiency testing protocol involves a two-step process; plotting and mining.

brought

Miners pre-generate data snippets (graphs), which contain all the necessary calculations for block creation.

Mining

The mining software automatically reads the graphs and tries to create each block.

Main features of the PoC

  • They use the free space on a device’s hard drive to store solutions to a hashing problem.
  • The main benefit of a PoC system is its efficiency compared to proof-of-work (PoW) and proof-of-stake (PoS) systems.
  • Mining data can be easily erased and the drive can be reused for any other data storage purpose.
  • There is no need for dedicated hardware or constant updating of hard drives.