Different Types of Blockchain Consensus Mechanisms
Table of Contents
There are a lot of different types of blockchains, but they do have some things in common if you’re looking right into their architecture.
TL;DR: Consensus mechanisms are the reasons different blockchains work! They are the rules by which blocks are generated in the blockchain. Depending on the algorithm used, some blockchains have a mining mechanism for mining new coins, while others use staking. Some networks work faster, but are subject to centralization, others are slower, but it is difficult for unscrupulous network participants to take control of them. That’s why it is important to learn about different consensus algorithms in order to correctly assess the prospects of the blockchain project.
Aptos is a layer 1 blockchain. That means that there are a group of nodes that store and share blocks of data, and also are responsible for synchronization and data relevance. These nodes allow creating a distributed network between them.
However, just like in any distributed computing systems, participants of a blockchain need to constantly agree on its current state. That's where consensus mechanisms become handy! They ensure compliance with the rules in the blockchain system. As soon as the participating parties establish the rules for the blockchain, the consensus algorithm will ensure their compliance.
There are quite a few types of these mechanisms. Let’s dig into the most popular ones and the one that is used by Aptos.
Proof-of-Work is a consensus mechanism that ensures that the distributed system will be secure and will not be affected by any abuse. In its core, there are two main ideas:
- Each miner has to respond to quite hard challenges in order to prove that they are being honest.
These PoW challenges represent arbitrary mathematical puzzles. You can think of them as the lottery. Miners have to generate millions of hashes per second in order to find the winning hash. Of course, this process cannot be done by hand, so these puzzles require high computing power. That’s why the process of mining is extremely energy consuming!
- The result of each computation might be checked quick and easily. This verification requires much less resources and time.
In Bitcoin, the PoW mechanism is used as a means to achieve consensus on the blockchain state.
To ensure that the difficulty of finding the right block is changed depending on how many miners are competing to discover blocks, the difficulty adjustment happens every 2,016 blocks in BTC. That way, each new block is produced every 10 seconds at any given time.
With that, Proof-of-Work allows nodes to ensure that miners have indeed done their hash computations. This means that nodes have to find the part of the blockchain that has a link to a previous block and the sum of the transactions included in it (block header) and make sure that this sum value matches the current blockchain difficulty level.
In order for the system to recognize a block as valid, it is necessary that its hash value be smaller than the current target. Thus, each block shows that some work has been done to find it.
Each block contains a hash from a previous block. No block can be changed, and it is only possible to find the block at the same height that will contain a previous block’s hash. This process requires finding all previous blocks, and since it is very hard, the blockchain is protected from unauthorized access and double spending! With that, PoW has proven to be one of the most secure and reliable implementations for blockchain networks!
This is an alternative consensus mechanism, whose idea is to use a stake as a resource that defines which node will be able to add the next block.
Just the same as in PoW, here nodes are trying to hash data in order to find the value smaller than the current target. But this time the difficulty is adjusted depending on the node’s balance. Thus, the node with the biggest amount of tokens is more likely to find the next block.
As you’ve probably heard of, this year Ethereum is changing its consensus mechanism to PoS. This means that expensive hardware and a huge amount of electrical energy will not be required to mine in Ethereum anymore! That’s a significant advantage of Proof-of-Stake.
Another advantage of PoS is that it is resistant to various types of cryptographic attacks. However, it doesn’t mean that there are no ways to abuse a system like this. An attacker may try to make a fork of the blockchain, i.e. create a longer alternative chain by spending "non-existent" resources. By means of a fork, an attacker can reject certain transactions and carry out a double spending attack. This is called Nothing-at-Stake, and it is one of the main reasons why many consider this mechanism to be unstable.
Another disadvantage of PoS is that a mechanism like this incentivizes accumulation of funds in one hands, which negatively affects the system’s decentralization.
Byzantine Fault Tolerance (BFT)
Byzantine Generals’ Problem is a thought experiment in computer technology designed to illustrate the problem of synchronizing the state of systems in the case when communications are considered reliable, but participants are not.
N "blue" generals are leading armies in the mountains and preparing to attack the "green" in the valley. For communication, attackers use reliable communication. However, out of n generals, m act maliciously and actively try to prevent the consent of loyal generals. The consensus is that all loyal generals should learn about the size of all loyal armies and come to the same conclusions (even if it's false) about the state of the treacherous armies. The generals then have to develop a strategy based on the data obtained, and it is necessary that all the generals develop the same strategy that can't be changed later.
In a few words, Byzantine Fault Tolerance (BFT) is the property of a system that is resistant to Byzantine Generals’ Problem and is able to continue operating even if some nodes fail or act maliciously.
There are multiple ways of building a BFT system. Therefore, there are multiple ways for implementing it in the consensus mechanisms. For example, Aptos uses a Byzantine Fault Tolerant, Proof-of-Stake consensus mechanism called AptosBFT. That way Aptos levels out some PoS disadvantages creating safe, fast and reliable blockchain.
Other Types of Consensus Mechanisms in a Nutshell
- Proof-of-Activity – a hybrid between PoW and PoS.
- Proof-of-Capacity – in order to start mining, a node has to delegate a significant amount of disk space into the network.
- Proof-of-Storage – is similar to Proof-of-Capacity, however in this model the disk space pledged to the network can be used by all participants just like a cloud storage.
- Proof of Burn – the participants have to send their tokens to the address from which it is guaranteed that these tokens cannot be spent in order to be able to mine.
Pontem is a product development studio working toward global financial inclusion powered by blockchains. It is partnered with Aptos to build foundational dApps and other infrastructure which enable adoption of their L1, such as development tooling, EVMs, AMMs, and more.