top of page

Consensus Algorithm

Updated: 25 minutes ago


A consensus algorithm is a mechanism that allows users or programs to coordinate in a distributed network. It should guarantee that all participants in the system agree on the current state of data, even if some agents fail. In other words, the system must be resilient to failures.

In a centralized system, a single entity has control over the entire system. In most cases, they can make changes at their discretion because there is no complex governance system to achieve consensus among a multitude of network participants or administrators.

But in a decentralized system, it's a whole different story. Suppose we are working with a distributed database - how do we achieve agreement on which records are added?

The solution to this issue in an environment where unfamiliar individuals do not trust each other was perhaps the most crucial step paving the way for blockchains. In this article, we will discuss the importance of the consensus algorithm for the functioning of cryptocurrencies and distributed ledgers.

Consensus Algorithm and Cryptocurrency

In cryptocurrencies, user balances are recorded in a database - the blockchain. It is important that each node in the network maintains an identical copy of the database. Otherwise, the information will diverge, violating the principles of reliability and openness of the entire cryptocurrency network.

Satoshi Nakamoto, the creator of Bitcoin, proposed the Proof of Work system to coordinate participants. Later, we'll discuss how PoW works, but for now, let's define some common features of many existing consensus algorithms.

Firstly, we need users (let's call them validators) who want to add blocks to provide some stake. Stake is a value that the validator must deposit, which will serve as a guarantee against their malicious actions. If validators attempt to deceive, they will lose their stake. Stake can be computational power, cryptocurrency, or even reputation.

You may logically ask: why should they risk their own resources? The point is that here operates a special system of rewards for work. Usually, rewards are issued in the form of native tokens of the protocol, and the funds for them are taken from user fees and newly created cryptocurrency, sometimes from both.

Another important feature is transparency, allowing to detect attempts of deception from users. Ideally, block creation should be expensive, while verification should be cheap for everyone. This ensures that validators will be under the control of ordinary users.

Types of Consensus Algorithms

Proof of Work (PoW)

Proof of Work (PoW) is the progenitor of all consensus algorithms in blockchain. Initially implemented in Bitcoin, the concept itself has been around for some time. In PoW, validators (called miners) hash the data they want to add until they find a suitable solution to a cryptographic puzzle.

A hash is a seemingly random string of letters and numbers generated when you process data through a hash function. But if you run the same data through it again, you will always get the same result. Change even one detail, and your hash will be completely different.

Examining the output data, it's impossible to accurately determine what information was input to the function. For this reason, hashes are excellent for proving that you knew something at a certain time. You can give someone such a hash and then provide the initial information so that the person can pass it through the function and verify that the output matches.

In PoW, the protocol sets conditions for confirmation (validation) of a block. For example, it may say that only a block whose hash starts with 00 is valid. The only way to create a block that meets this combination is to iterate through the input data. Validators adjust their program to produce different results with each hashing until the correct hash is formed.

In large blockchains, finding a suitable hash is extremely difficult: it would require an entire warehouse of specialized equipment for hashing large amounts of data (such as ASIC setups) to be competitive and able to create a valid block.

The stake in mining is the cost of such equipment and the electricity expended on work. ASIC (Application-Specific Integrated Circuit) equipment is designed for one task, so it cannot be used for anything other than cryptocurrency mining. The only way to recoup the initial investments is through mining and rewards for successfully added blocks.

For the network, it's enough to ensure that you indeed created the correct block. Even if your ASICs went through trillions of combinations to get the correct hash, it's enough to pass the data through the function once to verify its correctness. If your data produces a valid hash, the block will be accepted by the network as valid, and you will receive a reward. Otherwise, the network rejects your request to add the block, and it can be said that you wasted time and electricity.

Proof of Stake (PoS)

Proof of Stake (PoS) emerged in the early days of Bitcoin as an alternative to Proof of Work. The PoS system does not require miners, specialized equipment, or massive energy consumption. All you need is an ordinary PC.

Ideally, not entirely, you still need to stake something valuable. In PoS, you provide not an external resource (electricity or equipment) but an internal one - cryptocurrency. Requirements may vary in different protocols, but generally, there is a minimum amount of funds that entitles the owner to stake.

During the staking period, the funds are locked in the wallet (they cannot be moved during staking). In most cases, you agree with other validators on which transactions will go into the next block. In a sense, validators bet on the block they want to add to the blockchain, but the choice of the block remains with the protocol.

If your block is selected, you receive a share of transaction fees, depending on your stake. The more funds you lock, the more you can earn. However, attempting to cheat the system by adding invalid transactions, bad actors risk losing part (or all) of their stake. Thus, PoS works similarly to PoW: it's more profitable to act honestly than to try to deceive the system.

Usually, validators are not rewarded with newly created coins; the cryptocurrency of the blockchain must be issued in some other way. This can be done either through initial distribution (such as ICO or IEO) or by launching the protocol with PoW and then transitioning to PoS.

So far, pure Proof of Stake has only been deployed in smaller cryptocurrencies. Therefore, it is unclear whether it can serve as a viable alternative to PoW. Although this algorithm seems theoretically justified, in practice, everything happens a little differently. After deploying PoS within a network with a large amount of funds, game theories and various financial incentives come into play. If someone wants to "hack" the PoS system, it is only with a guarantee of extracting benefits, so we can only find out how likely this is in the network.


Mechanisms for achieving consensus are vital for the operation of distributed systems. Many consider the greatest achievement in Bitcoin to be the use of Proof of Work, allowing users to coordinate a common set of facts.

Today, consensus algorithms form the basis not only of digital currency systems but also of blockchains that allow developers to run code in a distributed network. They have become the cornerstone of blockchain technology and are key to the long-term viability of various existing networks.

3 views0 comments

Recent Posts

See All



bottom of page