Leggi questo articolo in Italiano Italiano

7 min read

What is a consensus algorithm?

By Gabriele Brambilla

The consensus algorithm is a fundamental mechanism for the proper functioning of a blockchain: let's find out what it is

What is a consensus algorithm?

Blockchain and consensus algorithm

The consensus algorithm is a basic element of each network.

The blockchain is a particular cryptographic database that is decentralized and distributed over several nodes. The name recalls the division into blocks that, joined together, create a real chain. The latter is bound to get longer because new pieces are being added all the time.

Each block contains information. Specifically, it is all the transactions that occurred on the network in a given time frame.

From what has just been said, a fundamental point can be made: every transaction must be correct and in accordance with what happened in the past. For example, it is not acceptable for a person to spend the same amount in cryptocurrency twice.

Moreover, being distributed, this special database “lives” on a variety of computers and computing devices.  Therefore, it becomes equally important that each part of the network possesses the same information. My copy will not be able to support something different than another person’s copy.

Therefore, we need a system that manages the addition of new blocks, verifying and ensuring harmony among the various distributed copies. Therefore, we welcome this mechanism: the consensus crypto algorithm.

What is a blockchain consensus algorithm?

As the name suggests, the consensus algorithm is precisely a set of instructions that aims to solve a problem.
In our case, the goal is to ensure an error-free environment (the blockchain) where all copies of the database agree on the information contained. Conflicts and discordant data are not tolerable and would render the chain nearly useless.

Several consensus algorithms exist. The progenitor is Proof-of-Work, proposed by Bitcoin creator Satoshi Nakamoto back in 2008. The idea was to be able to coordinate the parts of an innovative decentralized network.

To add new blocks to the chain, the PoW algorithm requires proof of work accomplished in this regard. Specifically, those performing this task are required to solve a complex probabilistic calculation, taking advantage of special machines called ASICs. This was not always the case: in the past, the difficulty of the problems was lower and home computers could safely close them.

The first person who can solve the calculation can produce the lock. As a reward, a certain amount of freshly created cryptocurrency is received. From here, the process is called mining, because you actually “mine” new coin specimens.

Of course, the data from the block is distributed to other participants, who are charged with making the appropriate comparisons.

By investing so much power, a miner has no interest in trying to manipulate transactions: unless he can have 51 percent of the computational power of the entire blockchain, his misdeed would not be approved by the network. We are talking about a huge number that is virtually impossible to reach, an aspect that puts Proof-of-Work realities on the safe side.

Other consensus algorithms instead involve blocking a certain amount of cryptocurrency. Or again, it is one’s reputation that is at stake.
The “putting at stake” is the central element of a consensus algorithm: regardless of the type, something is “bet” (stake). The stakeholder must then behave well, or else there will be a loss, whether economic, reputational, combined or otherwise.

So, to recap: the consensus algorithm provides a set of instructions to ensure that the blocks in a chain are all correct.
Those who actively contribute to the addition and creation of new blocks put themselves on the line and cannot make any missteps. The ultimate goal is to win as much work as possible and obtain the expected rewards.

What is an example of a consensus algorithm? We’ll provide some examples shortly.

Byzantine generals and blockchain: namely?

Let’s deviate from our usual talk and engage in some logic. Specifically, let’s talk about the dilemma of Byzantine generals.

First, let us imagine a battlefield. Let us assume that there are a number of generals on the same side. They must decide whether to attack the enemy or retreat. Each can reason about how to move. After that, the idea will not be changed.

To be successful, everyone should agree on the action to be taken, initiating it at the exact same time.

At this point, communication problems take over. In fact, the generals can interact with each other only through messengers. These may be killed, wounded, or captured. Or, there may simply be a delay in delivery.

In addition, one or more generals could double-cross and spread false information, confusing others.

In short, there are critical issues that seriously jeopardize success.

This dilemma is applied to so many areas, including blockchain. Since it is a decentralized environment, there could be malicious generals (nodes) trying to manipulate data and spread false information.

In this context, if the bad nodes manage to control 51 percent of the network, the blockchain is compromised.

These observations give rise to the definition of Byzantine Fault Tolerance, or the resilience of a chain in the presence of malicious nodes.

While there are a variety of consensus algorithms, they all aim to ensure that the network functions properly even under these conditions.

Main consensus algorithms

Let us quickly explore some of the most popular blockchain consensus algorithms. We refer to the dedicated insights to learn more.

What is the most popular consensus algorithm? Proof of Work

The consensus algorithm by definition, devised by Satoshi Nakamoto in 2008. It is based on solving very complex calculations that require purpose-built computers. The creation of new coins is called mining.

Blockchains: Bitcoin, Litecoin, Dogecoin.

Pros: security and reliability.

Cons: inefficient and penalizing in terms of scalability.

Proof-of-Stake

A widespread modern solution, Proof-of-Stake requires a certain amount of blocked coins to be a chain validator. After that, proportional to how much you deposit, you have a certain probability of validating a blockchain.

Blockchain: Ethereum, Solana and Avalanche.

Pros: scalability, efficiency and adaptability.

Cons: less safe than PoW, need for a coin to enable operation.

Delegated Proof-of-Stake.

A declination of PoS, this blockchain algorithm introduces some caveats that improve its efficiency and community participation. There is a voting mechanism that elects the producers of each block.

Blockchain: EOS, Cardano.

Pros: more efficient and democratic than Proof-of-Stake.

Cons: identical to classic PoS, with the addition that a 51% attack might be easier to organize.

Proof-of-Authority

This consensus algorithm leverages the reputation of validators. No sum in stake is involved: it is the identity of the insiders that is at stake.

Blockchain: POA (merged into Gnosis Chain).

Pros: energy efficiency, good security standards, speed.

Cons: centralization, not ideal for public blockchain.

"Different algorithms for different needs: each project adopts the solution best suited to its characteristics."

Final thoughts on the consensus algorithm

In this in-depth study, we got a better understanding of what a consensus algorithm is.

Although they are very different from each other, all members of this category have the same goal: to ensure the fairness of transactions.

In the crypto community, some users prefer the good old Proof-of-Work, despite some limitations.

Others prefer Proof-of-Stake-based projects, confident that it is the future of the entire industry.

Finally, several investors turn their attention to chains that adopt other solutions, perhaps taking a little more risk.

Whatever one’s point of view, when analyzing a network we must always consider the consensus algorithm as well. Only then can we invest in full knowledge.

See you soon!


X

Vuoi essere sempre sul pezzo?

Iscriviti alla newsletter per ricevere approfondimenti esclusivi e analisi ogni settimana.

Se ti iscrivi c’è un regalo per te!

bitcoin
Bitcoin (BTC) $ 68,028.23
ethereum
Ethereum (ETH) $ 2,632.62
tether
Tether (USDT) $ 1.00
bnb
BNB (BNB) $ 596.86
solana
Solana (SOL) $ 153.07
usd-coin
USDC (USDC) $ 1.00
xrp
XRP (XRP) $ 0.544732
staked-ether
Lido Staked Ether (STETH) $ 2,631.03
dogecoin
Dogecoin (DOGE) $ 0.135043
tron
TRON (TRX) $ 0.159289
the-open-network
Toncoin (TON) $ 5.20
cardano
Cardano (ADA) $ 0.349383
shiba-inu
Shiba Inu (SHIB) $ 0.000019
avalanche-2
Avalanche (AVAX) $ 27.70
wrapped-steth
Wrapped stETH (WSTETH) $ 3,114.15
wrapped-bitcoin
Wrapped Bitcoin (WBTC) $ 67,762.16
weth
WETH (WETH) $ 2,632.80
bitcoin-cash
Bitcoin Cash (BCH) $ 373.12
chainlink
Chainlink (LINK) $ 11.26
polkadot
Polkadot (DOT) $ 4.24
near
NEAR Protocol (NEAR) $ 4.85
dai
Dai (DAI) $ 1.00
sui
Sui (SUI) $ 2.06
uniswap
Uniswap (UNI) $ 7.45
leo-token
LEO Token (LEO) $ 6.07
litecoin
Litecoin (LTC) $ 73.18
aptos
Aptos (APT) $ 9.88
pepe
Pepe (PEPE) $ 0.000011
wrapped-eeth
Wrapped eETH (WEETH) $ 2,766.04
bittensor
Bittensor (TAO) $ 592.02
internet-computer
Internet Computer (ICP) $ 7.82
fetch-ai
Artificial Superintelligence Alliance (FET) $ 1.38
kaspa
Kaspa (KAS) $ 0.127256
monero
Monero (XMR) $ 158.75
ethereum-classic
Ethereum Classic (ETC) $ 19.23
blockstack
Stacks (STX) $ 1.90
stellar
Stellar (XLM) $ 0.095634
first-digital-usd
First Digital USD (FDUSD) $ 1.00
polygon-ecosystem-token
POL (ex-MATIC) (POL) $ 0.368583
dogwifcoin
dogwifhat (WIF) $ 2.69
immutable-x
Immutable (IMX) $ 1.53
whitebit
WhiteBIT Coin (WBT) $ 17.08
ethena-usde
Ethena USDe (USDE) $ 0.999860
okb
OKB (OKB) $ 40.38
aave
Aave (AAVE) $ 156.92
filecoin
Filecoin (FIL) $ 3.70
optimism
Optimism (OP) $ 1.70
crypto-com-chain
Cronos (CRO) $ 0.077980
injective-protocol
Injective (INJ) $ 21.33
mantle
Mantle (MNT) $ 0.618729