Consensus Protocols in Distributed Systems

Consensus Protocols in Distributed Systems
Consensus Protocols in Distributed Systems

With introducing different types of cryptocurrencies and the public’s welcoming them in recent years, distributed ledger technology (DLT) drew the attention of experts as the main foundation of digital tokens such as Bitcoin. It has led to the development and implementation of different ideas with various advantages and disadvantage in this field. One of the most important challenges in DLT is the public consensus in the atmosphere of distrust among users. Public consensus determines true information and protects the network against malicious acts. The methods developed to provide this consensus in DLT are called “consensus protocol.” In DLTs which have been designed based on Blockchain, two algorithms of Proof of Work (PoW) and Proof of Stake (PoS) make one of the most basic methods of reaching consensus.
On the contrary to Blockchain structure, a structure named Tangle has been offered to create DLT. Unlike Blockchain, Tangle doesn’t have a chain of blocks and provides consensus in another way. Compared to Blockchain, Tangle has some advantages and disadvantages which will be described in the following parts.

Consensus in Blockchain


In the Blockchain structure, each block includes some transactions. Blocks are generated by the miners and added to the blocks chain. The blocks’ connections (namely, the chain between the blocks) are provided through the result of the previous block in generating the new block. Two famous protocols for agreement and consensus in these structures include PoS and PoW. Presently, Bitcoin and Litecoin use PoW and so do Ethereum and Dash from PoS as the agreement protocols in Blockchain structures. In figure (1) a part of the chain of blocks has been shown in the Blockchain structure. In this figure, each transaction is depicted by a circle, and the transactions’ integrity of a block is calculated via Merkle root.

Chain of blocks in blockchain structures
 

 

 

 

 

 

 

 

 

Pow Protocol


In this protocol, the miners enter the contest to find the answer to a math problem. The miner, which succeeds in solving the problem broadcasts its answer along with the new block. Finding the answer of a math problem in this protocol is costly and time-consuming, but investigating the trueness of the answer is comfortable. The difficulty level of this problem is adjustable in order for the rate of generating new blocks to remain stable. This rate is ten minutes for Bitcoin and two-and-a-half minutes for Litecoin. In addition to difficulty, the odds also play a role in finding the answer, and the miner, which will generate a new block, cannot be specified beforehand. In this competition, the miners should find the amount which result of applying PoW protocol function on it obtains defined conditions as the target. The functions used in PoW are different versions of the hash algorithm. Currently, diverse samples of this protocol have been developed and applied; the most well-known version whereof is Hashcash. Bitcoin and Litecoin both use Hashcash; however, the SHA-256 hash algorithm is used in Bitcoin, and so is scrypt hash algorithm in Litecoin. According to what has been explained, it is clear that in PoW protocols, many calculation resources are spent on confirming transactions, creating new cryptocurrencies and adding a block to the Blockchain.
On the one hand, the difficulty level of problems increases in time that entails more calculation power per se. In the experts’ opinion, when there are more economic protocols, PoW is somehow wasting resources. On the other hand, such a high calculation power makes tampering with Blockchain almost impossible for the attacker. Different branches of Blockchain might be made in PoW; in this case, the branch which is longer will be more reliable.

PoS Protocol


It is among other common protocols in Blockchain which offers a distinct method from PoW to make the agreement on generating a new block. The amount of miners’ assets (the amount of digital tokens owned) is the agreement criteria for generating new block. Hence, miners should enter the contest in buying digital tokens in the process of confirming transactions and generating new blocks via investment. As the miner’s asset increases, its chance for generating a new block and receiving reward and fee will raise.
All in all, there is no guarantee for a miner with the highest asset to be selected. The most important difference between PoW and PoS is being free of calculation resources in the mining process. So, PoS is idiomatically called “Environment-Friendly”. The competition criterion in PoS of this structure will make it more profitable for the whales.

Tangle


Tangle is recognized as the new generation of DLT. This technology has been developed according to the Directed Acyclic Graph (DAG). It doesn’t have a block-like structure; therefore, it is named Blockless Blockchain too. Such graphs provide high flexibility without extra costs in DLT. Railblocks and Hedera-Hashgraph are popular examples of implementing this idea which are currently used. The most reputable cryptocurrency developed by Tangle structure is called IOTA.
Cyclic graphs are those from a node of which can be started and returned to that node again after passing the other nodes. Considering this fact, acyclic graphs don’t enjoy such routes. By directed graph, we mean directedness of its edges in a way that you can just move in the direction of that edge; the directions are one-way. In figure (2) an example of acyclic directed graphs is depicted.

Acyclic directed gragh
In Tangle, the transactions are DAGs nodes, and the edges are their confirmations.  The new transaction is added as a new node to the graph. This new node is connected to two nodes from the graph. The direction of this connection is from the new node to those two nodes which have been confirmed. This connection means confirming those two transactions, and all transactions ended to them. The confirmation process is done by the one asking for the new transaction and during which it is assured that the balance of all the accounts is nonnegative. The first transactions in this structure are called “Genesis” and the transactions related to generating digital tokens. Hence, in such a structure, no new block will be added to the network. The transactions that a transaction confirms directly (through connecting directly) are called “parent transactions,” and the transactions confirmed by them are called “child transaction.” The user should confirm two unconfirmed transactions from the graph before confirming his/her transaction; the process of selecting these two transactions is named “Tip selection.” This process is started with selecting a genesis and finally ends in the tip of the edge with a random movement. It is natural for the user to conduct tip selection twice to add his/her transaction to the graph. According to what has been pointed out there is no miner in the Tangle structures, so no fee is subtracted for transactions’ confirmation. In figure (3), an example of communications between transactions is shown in Tangle structure graph.
In this figure, green nodes are genesis transactions, red one are tips (transactions waiting for confirmation), and blue nodes are transactions which have been confirmed. When a transaction is confirmed directly or indirectly by the other transactions, it becomes a part of the consensus and tampering with it is not possible then. 

In figure (4), transactions which have been confirmed directly and indirectly via purple transaction are depicted in orange. The number of transactions confirming a transaction determines its cumulative weight, and the transactions gets more valid to the extent this amount increases. This feature strongly reduces the possibility of double spending attack in Tangle.

Finally, considering the features of Blockchain and Tangle, the following advantages can be delineated for Tangle technology as a specific sample of distributed systems:
•    Tangle spends less energy for confirming transactions, so it is environment-friendly.
•    There is no limitation in adding a new user to Tangle and increasing the number of requests leads to the increase of its speed, since new transactions confirm the other transactions, but increasing the number of requests in Blockchain extends waiting line to be confirmed. 
•    In Blockchain, each block accommodates a limited number of transactions in itself; hence, the network faces limitation of transaction confirmation rate. However, in a blockless structure of Tangle, there is no limitation on the transaction confirmation rate.
•    Confirming transactions and keeping accounts balance are carried out with the cooperation of all users. Each user who asks for executing a new transaction should investigate the trueness of other transactions. This idea causes the network not to need any miner through network public participation, and consequently, there will be no need to pay the fees to confirm the transaction.
•    Paying fee in Blockchains such as Bitcoin causes transactions with a very little amount to encounter the problem. As an example, the transaction fee of paying charges of a cup of coffee using Bitcoin can be more than the charges of the original good (or service). This very issue makes practicality of such a cryptocurrency uneconomic for simple daily transactions (transactions with the very little amount, which are called micro-transactions). Therefore, Tangle will be a more economic option comparing to Blockchain.
•    One of the claims of IOTA developers as the most current well-known structure is its resistance against quantum attacks. Such attacks are made using very high power of quantum computers and provide the possibility of reversing hash function for the attacker. Therefore, many experts believe that by developing quantum computers in the future, the likelihood of tampering with Blockchain will raise, but as IOTA developers allege, due to using Winternitz One-Time signature in this structure, the possibility of making quantum attacks will lower for tampering with IOTA.
Despite all positive features of Tangle, its implemented sample by IOTA has a very important vulnerability. An attacker who owns 33 percent of hash rate of the network, can tamper with it as he/she wishes. To remove such a weakness, IOTA broadcasts transactions named “Milestone” by a unique node called “Coordinator.” This node belongs to IOTA Foundation and undertakes protecting the network. The existence of coordinator questions distributed network and somehow creates central management for it. The simplest way to eliminate the coordinator is to increase the network hash rate through increasing the number of users. However, by launching a research council, IOTA founder succeeded in eliminating dependence on coordinator in May 2019 by offering a solution known as Coordicide. Offering this solution resulted in the market’s positive reaction and increased the value of each digital token of IOTA.

Written by:

Dr. Pooyan Ghamari


Check this link for more information:

https://www.linkedin.com/pulse/introducing-different-types-cryptocurrencies-publics-them-ghamari/