The 2 consensus algorithms you should know

algoritmos de consenso

Can you imagine the typical Christmas dinner with the whole family? Now, let’s suppose that the menu hasn’t been decided yet, and each assistant gives their opinion on what they would like to have for dinner. Probably, New Year’s would come and you would still be without an agreement and without dinner. Or worse, the mother would decide, and the rest would have to swallow the decision, literally. That’s why reaching a consensus is often so important, so that the most important dinner of the year doesn’t get ruined. For this reason, the cryptocurrency industry has popularized consensus algorithms.

Introduction

In our article on DLT networks, we already highlighted the importance of these algorithms. These algorithms are the mechanisms that these networks use to coordinate the nodes (our diners), and to incorporate transactions into the system (that is, to decide on the menu). Therefore, they are an essential part of the functioning of these structures.

Let’s remember that in classic DLT networks, decentralization is one of the most valued characteristics. This characteristic implies that the decision-making power does not belong to any specific person (the mother) or group, but rather to the entire set of nodes that make up the network. If all the diners accept the rules of the game, no one will oppose the resulting menu.

consensus algorithms

In the case of cryptocurrencies, the consensus algorithm is what allows nodes to agree on the “single source of truth.” It replaces the need for trust or central authority in traditional systems. Therefore, it doesn’t matter if there is no trust among participants. The algorithm itself ensures that the incorporated information is truthful, preventing malicious attacks and unwanted developments in the network. In this article, we analyze the most commonly used consensus algorithms, their weaknesses, and strengths. The two predominant consensus algorithms are:

  1. Proof of Work (PoW)
  2. Proof of Stake (PoS)
    • Delegated (DPoS)
    • Leased (LPoS)

Proof of Work (PoW)

The first of these algorithms is the most popular and was initially introduced by the Bitcoin network. Proof of Work (PoW) gets its name because it essentially requires nodes to perform a certain amount of work to mine a new block of transactions. It’s like if all diners had to solve the same puzzle, and the first one to solve it gets to choose the menu.

When a node successfully solves the puzzle, it decides to incorporate a specific block of transactions into the network. The other nodes agree that this block represents the “single truth” and therefore accept it. If someone attempts to introduce a duplicate transaction into the network, it would be incompatible with the accepted “single truth” and thus rejected by the nodes.

The only way to corrupt the network would be to “buy” the acceptance of the majority of nodes, but this is expensive and highly unlikely. This is known as a “51% attack,” although it is rare in well-established networks.

Functioning

Now that we have a general understanding of how this algorithm works, let’s delve a bit deeper. First, let’s define the “puzzle.” What the nodes have to solve is known as the “hash.” A hash function is used to transform any block of data into a fixed-length series. From a mathematical perspective, this function is very easy to verify but extremely difficult to solve. Continuing with the puzzle analogy, it is straightforward to check if our solution is correct by comparing it to the picture on the box. However, it is not easy at all to arrive at that solution.

In the case of the hash function, the solution is obtained through multiple trial and error attempts. This algorithm requires significant computational power. In this case, it doesn’t matter how “smart” the node is because its chances of solving the hash won’t increase.

When a node finds a solution, it sends it to the rest of the participants for verification. This way, everyone agrees that the solution is correct. Once the solution is verified, the node can incorporate the chosen block into the network, and it is rewarded with newly created coins, as well as transaction fees paid by users. This entire process is referred to as “cryptocurrency mining.”

Advantages

The main advantage of this algorithm is its high level of security. By requiring significant computational power, it becomes difficult for the network to be attacked. Additionally, since the difficulty of the problem adjusts to the number of existing nodes, the resolution time remains consistent. This is crucial in terms of cryptocurrency scalability.

Another advantage is the equality among nodes. Once they connect to the network, all nodes have an equal chance of solving the hash function. Thus, there are no nodes with an advantage over others, and the network remains democratic.

Lastly, the hash of each block is related to the hash of the previous block. This allows for coherence throughout the network. In fact, modifying a block without affecting all subsequent blocks is not possible. Hence, transactions are considered more irreversible the more blocks are mined afterward.

Disadvantages

However, this algorithm is not without its drawbacks. Firstly, we’ve already mentioned the computational power required to solve the hash. When the network is small, this power can be handled by almost any device, even a personal computer. However, as the network grows, so does the demand. There comes a point where a regular computer is insufficient, and specialized equipment is needed. Moreover, if some of the current nodes are no longer capable of solving the problem, they will cease to participate. In the long run, this concentration of decision-making power in a few nodes reduces decentralization.

Secondly, this computational cost leads to significant energy consumption, which is not favorable in the current context of energy transition. According to some estimates, the Bitcoin network’s energy consumption exceeds that of countries like Sweden or Norway. This has been subject to harsh criticism on multiple occasions.

Lastly, and related to the previous point, there is controversy surrounding the usefulness of this algorithm. In the end, we are talking about continuous trial and error attempts to solve a problem that doesn’t actually exist. The resolution of the hash does not contribute any value to any aspect of society. It is solely used to keep the Bitcoin network, among others, functioning. Hence, many people argue that such energy expenditure is senseless, even if it comes from renewable sources.

Proof of Stake (PoS)

With Proof of Work, our beloved family no longer has any issues choosing the Christmas menu. However, this process is slow and requires effort that not all members are willing to undertake. That’s why they decide to come up with a method that is equally effective but faster and more agile. This is how Proof of Stake was born. This algorithm is based on something as simple as “the more you have, the more you’re worth”. Its success lies precisely in its simplicity.

Let’s imagine that our diners decide to draw lots to decide the menu, but taking into account the contents of their pockets. For every €5 in value in their pockets, they receive a ticket, and when everyone has their tickets, a lottery is conducted, just like in a lottery draw. Obviously, each ticket has the same chances. That’s why the diner with more tickets has a greater chance of winning. This is, in essence, how Proof of Stake works.

Each time a block is added to the network, the lottery is conducted again, so all participants have a chance of being chosen. Thus, the democratic nature of the system is maintained. Currently, many cryptocurrencies use PoS. In fact, some, like Ethereum, have transitioned from PoW to PoS considering it more advantageous.

Functioning

In reality, the functioning of this algorithm takes into account several factors. One of the most influential factors is undoubtedly the possession of cryptocurrencies by each node or, more precisely, the number of cryptocurrencies that the node is willing to “lock” or stake. During the lottery, nodes must provide a stake in the form of cryptocurrencies. This stake is what increases or decreases the chances of success for each node in the lottery. The higher the stake deposited, the greater the chances of the node (process known as “staking“).

Additionally, this algorithm considers other factors, such as the length of time the node has remained connected to the network. This rewards nodes that contribute more to the success and continuous operation of the network. Once the selection of the node is complete, it can perform its function (validate and record the block) and receive the corresponding reward.

When the process concludes, nodes have the option to increase the stake deposited to improve their chances, and the lottery starts again. As it is a random lottery without significant mathematical computation involved, the computational effort is lower compared to Proof of Work, which is one of the appreciated aspects of this algorithm.

Leased Proof of Stake (LPoS)

There are variations of the Proof of Stake algorithm, and one of them is Leased Proof of Stake (LPoS). In this variant, users have the option to “lease” their coins to other participating nodes. Then, all nodes enter a lottery in which the network randomly selects a node to validate the block, and that node shares the earned fees among the leasers.

This system aims to give more decision-making power to users with lower capacity. Moreover, the leasing of votes is not fixed, so the number of validating nodes in the network is dynamic.

Delegated Proof of Stake (DPoS)

The other major variant of PoS is Delegated Proof of Stake (DPoS). This algorithm functions similarly to a democratic system. Coin owners vote for their delegates, and the elected delegate will ultimately validate the block and receive the fees.

In DPoS, delegates play a crucial role in block validation and maintaining network consensus. They are trusted individuals or entities chosen by the coin owners, and their election is based on the number of votes they receive. This system aims to enhance scalability and efficiency by delegating the responsibility of block validation to a smaller group of trusted delegates.

These variations of the Proof of Stake algorithm offer different approaches to achieving consensus, catering to different goals and considerations within the cryptocurrency ecosystem.

This system is therefore decentralized because anyone can be voted for by the participants, and delegates cannot commit any wrongdoing without risking being expelled by their voters. On the other hand, a node with greater resources will still have more voting power. Additionally, the fact that decision-making power is concentrated in a group of delegates makes a 51% attack or collusion among the delegates more plausible.

Advantages

The advantages of the Proof of Stake algorithm can be understood by comparing it with Proof of Work. Proof of Stake requires much less computational power, making it a more environmentally friendly and scalable alternative. It allows for a higher level of decentralization since there are no barriers to entry for new nodes.

Lastly, it is important to highlight that this algorithm can be considered secure. With the miner of the block being chosen through a random process, it becomes difficult for a malicious node to attack the network. Simply possessing 51% of the tokens in the network is not enough to guarantee being selected. Therefore, this algorithm is even more secure than Proof of Work, at least against certain types of attacks.

Disadvantages

On the downside, its biggest drawback is likely the high level of participation required. The network rewards not only token ownership but also factors like the duration of network connection and other elements. This makes it necessary to have a very high level of connection to maintain significant probabilities, which could expose security vulnerabilities in the connections of these users.

Moreover, by significantly rewarding nodes with greater stake, smaller nodes will have minimal weight in decision-making. Theoretically, they can be selected, but this will happen only a small number of times due to statistical reasons. In the long run, this can concentrate decision-making power in a few nodes and reduce decentralization.

Conclusion

With everything discussed above, we have explored several alternatives for our beloved family to decide on the Christmas menu without major issues. However, every election process has its disadvantages. There may not be a perfect consensus algorithm, but one should seek an algorithm that fits the needs of each cryptocurrency.

Factors such as scalability, ease of implementation, decentralization, and security are crucial in designing these algorithms. Therefore, these elements will determine how suitable each algorithm is based on the specific needs at hand.

Related articles

dora

What is DORA? Digital Security in the European Union

In a socio-economic environment where digitization is increasingly important, the security risks faced by financial entities are very different from those of a few years ago. In this regard, the emergence of new technological infrastructures attracts new types of dangers, such as cyber attacks. Therefore, companies are dedicating an increasing budget to protect themselves from […]

Learn More
security

The 6 sectors most affected by the cryptocurrencies

Since the cryptocurrencies arrived to the financial sector, the investors have been looking for different ways of investing in them. The easiest way to do it is directly through the exchange platforms, but it is not the only way. In fact, it is possible to benefit from them performance using the classical investment approach. Therefore, […]

Learn More
efectivo

The use of cash and the digitization of the economy

In recent years, the emergence of cryptocurrencies has highlighted a trend that had been developing for some time. Society is using less and less cash, and it’s no longer the preferred means of payment for consumers. Therefore, we will conduct a retrospective analysis to examine how we arrived at this situation and what scenarios may […]

Learn More

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.