The main feature of distributed ledger technology is that it lacks a central authority. This means that at the core of the technology, the participants need to agree on the ledger’s state. This is the fundamental piece of any distributed system, and how it is implemented defines the rest of the architecture. This is called the consensus algorithm.
Due to its overwhelming nature, the consensus algorithm is the heart of a distributed system. It is the central part, and its design and implementation have to be carefully considered for those looking to create a protocol. A good consensus algorithm needs to give the following results:
1. Agreement: All nodes in the network must reach the result regarding the state of the network.
2. Fault-Tolerant: The algorithm should have the capacity to work properly, even with the presence of faulty or dishonest nodes.
3. Termination: The consensus process has to have a clear stop after which all nodes arrive at a decision.
4. Integrity: All nodes should achieve finality within one consensus cycle.
These are the basic characteristics of a working consensus mechanism. Specific algorithms may have more or different versions of the concepts presented, but in some ways, all of these are shared by any decentralized protocol. Additionally, consensus algorithms have an essential layer of properties they need to have in order to work.
1. Consistency: This property means that all honest nodes produce the same value that is considered the correct one.
2. Tolerance: The ability to endure some faulty or dishonest nodes and the network’s capacity to recover.
3. Liveness: As long as the number of compromised nodes is below the tolerance limit, these cannot stop or delay the network from reaching consensus.
4. Authentication: This property assures that there is a mechanism to verify the identity of the participant nodes.
5. Quorum Structure: In a distributed system, only the minimum number of votes is necessary to operate.
6. Non-repudiation: A way to verify the sender account’s identity so it may have the capacity to dispute the transaction.
7. Equal Authority: All nodes in the network must have the same capacity, with no central authority capable of overriding a decision.
Again, this is a basic set of properties for an ideal decentralized consensus algorithm. Not all of the real mechanisms out there conform to these set of rules. One example is IOTA, which has a central observer capable of modifying the decisions of the nodes. For a purist, such an inclusion means that IOTA is not truly a decentralized network even though it has some other properties.
Before reviewing the most common consensus algorithms in use, we need to note something. The ones we will discuss work, for the most part, with blockchains. That is to say, the data structure known as blockchain is where these are meant to work. Other data structures can be used in a decentralized network such as directed acyclic graph (DAG), Hashgraph, etc. These have their consensus algorithms.
That being said, blockchain remains the most popular data structure. It was first implemented with Bitcoin; Ethereum adopted it, and even now, new third-generation protocols such as Cardano use it. It seems that for the foreseeable future, blockchain will remain the dominant technology.
China is at the forefront of blockchain integration. Check out their entire blockchain strategy and why they are so quick to integrate blockchain technology in their economy.
Types of consensus algorithms
Here we will give a general overview of the most popular ones in the blockchain.
Proof of Work
Proof of work is the first viable consensus algorithm and still the most widely used. In it, individual nodes compete to find a hash function that represents the list of transactions inside the block and a nonce added on top of it. A nonce is a number that requires that the hash function is preceded by a number of zeros to be valid. The process of finding this hash function is known as mining.
All the network nodes compete in the very hardware demanding process of mining to gain Bitcoin as a reward. Many have criticized that the energy intensity of proof of work is wasteful and harmful to the environment. Additionally, the mining’s electricity and hardware costs have led to the centralization of the network in a handful of countries.
This has resulted in new consensus algorithms being designed.
Proof of Stake
The main alternative to proof of work (PoW), proof of stake (PoS), has gained traction quickly in the world of blockchain. In it, the nodes in the network deposit the protocol’s main currency and lock for some time. This allows them to enter a semi-random lottery to validate the next block of transactions.
The possibility of being selected depends on the quantity of the coins staked. A node with a deposit of 1,000 coins is more likely to be chosen than one with 500. This can lead to centralization since those nodes with bigger pools of money can dominate the network. Even with this possibility, proponents claim that PoS is cheaper to run than PoW since no expensive hardware is needed to validate transactions.
Delegated Proof of Stake
This is a variation of PoS. Here the stakeholders use their coins to select which node will validate the next block of transactions. The nodes allotted money by the participant become validators and are in charge of propagating the blocks to the network. They can be voted out by the stakeholders if they are slow or behave dishonestly. There is a greater level of centralization in this model since the nodes that can become validators are of limited number and are selected prior to the vote by some other means.
Proof of Elapsed Time
This is a preferred consensus algorithm of few blockchains. Here each node generates a random waiting period in which a node goes to sleep. The node that wakes up first becomes the next validator. The disadvantage is that the nodes’ identity has to be known by the system since the waiting period needs to be random. Otherwise, dishonest nodes can cheat the system.
The consensus algorithm is at the heart of a blockchain. It is the main design decision that determines what is possible and how fast the rest of the system will perform. For those looking to develop in a given protocol or for investors trying to determine which protocol will be the best one in the future, it is crucial to understand the basics.