The ABCs of Blockchain: Protocols & Consensus Algorithms

Started by RafaelJames, Aug 05, 2022, 10:03 AM

Previous topic - Next topic

RafaelJamesTopic starter

We are talking about the protocols or consensus algorithms on what, in fact, the blockchain works. But everything is not limited to this, there are many terms associated with these protocols that explain their work. To be honest, I spent quite a lot of time and went through a lot of resources to learn the protocols and their components. And I thought that good wasted in vain and decided to make a new publication with my research.

The pillars on what blockchains rely

Each blockchain is based on a protocol, and given that each of the blockchains serves its own purpose, the number of protocols is clearly more than one. Apropos, blockchain is not only about cryptocurrencies, these "databases" are also used in other areas and are only gaining momentum.

Each blockchain has its own protocol as a set of rules and actions aimed at transferring data. The blockchain protocol is the same set of rules that ensures the security of transactions in the network of a particular blockchain. Blockchain networks function because they are decentralized. This means that every node on the network should validate transactions. The node is usually a computer or similar system.

In turn, there is a consensus algorithm - this is a mechanism that checks the correctness of certain rules, that is, it checks that the transaction is correct and the protocol is followed. What are they and how do they differ from each other? There are actually a lot of them, so we will cover the main and often common scenarios.

PoW (Proof-of-Work - Proof of Work)

Proof-of-Work is a bitcoin consensus technique that has given birth to, one might say, a new profession on the market, namely the miner. The meaning, as always, lies in the name, in order to participate in the transaction, network members need to solve an arbitrary mathematical puzzle to find the hash (hash) and publicly prove the work done in order to avoid cheating the system. The first one who is lucky enough to find the right solution gets the opportunity to add a block to the chain. The bonus is not only the addition of a new block, but also the opportunity to receive a reward for the work done, this is the main motivator for participating in this protocol.

A hash function is a function that converts an array of input data of arbitrary length into an output bit string of a fixed length, performed by a certain technique. The transformation performed by the hash function is called hashing. The result of the conversion is called a hash.

With proof-of-work, bitcoin and other cryptocurrencies transactions can be processed peer-to-peer in a secure manner without the need for a third party. There are 2 drawbacks to this protocol:

    The process of calculating the hash requires a lot of energy, which only increases as more miners connect to the network, which means that at the present time it no longer meets environmental standards.

    The participants in this protocol are more interested in gaining benefits than in developing the network and maintaining the fairness of the network, which may affect security in the future.

PoS (Proof-of-Stake - Proof of Stake)

Proof-of-Stake was created as an alternative to Proof-of-Work and seeks to overcome its shortcomings, such as big power consumption. This mechanism reduces the amount of computational work required to validate the blocks and transactions that keep the blockchain secure. Computing power (block validation) is replaced by staking, whereby a person's mining ability is randomized by the network.
Owners offer their coins as collateral for the convenience to validate blocks and become "validators". The validator checks the correctness of the transactions in the block. If done correctly, they add the block to the block chain and receive a reward for their contribution. However, if a validator proposes to add a block that is known to be invalid, it loses some of its staking assets as a penalty. Usage examples are NXT, Tezos, Peercoin, Blackcoin.

Staking is the process of locking up cryptocurrency assets in order to earn rewards or interest.

These two protocols are undoubtedly very alike, as their main goal is to add new blocks to the blockchain, but there is a key difference:

    Proof of Work (POW) uses a competitive verification method to validate transactions and add new blocks to the blockchain.

    Proof of Stake (POS) uses randomly selected network participants to validate transactions.

DPoS (Delegated Proof-of-Stake - Delegated Proof of Stake)

Delegated Proof-of-Stake is similar in operation to PoS, except that it includes a voting and delegation mechanism to incentivize users to secure the network and validate blocks with coins left as collateral. Thanks to this pledge, users can participate in the voting, where delegates are chosen, who will be responsible for all aspects of conducting transactions. When the delegates are finally elected, it is important that they can agree on which transactions to reject and which to approve. Used in Cosmos, Tron, EOS.

Delegates are users in the DPoS system who control governance on the blockchain. Other users vote for delegates. The delegate can propose changing the size of an individual block, or changing the number of witnesses who are paid to verify blocks. When changes are proposed by a delegate, blockchain users vote to accept those changes.

Validators are nodes that can verify that blocks created by different witnesses follow the consensus rules. If a user becomes a block validator, all they have to do is run the validator and check the network.

Witnesses are users who are responsible for the security and verification of the blockchain. To become a witness, the user should receive a sufficient number of votes.
The total number of witnesses on a single server can vary from 21 to 101. Although a witness can hold certain transactions outside of a block, it cannot change information about a transaction. There is a lot of competition among witnesses, if a witness loses the trust of users, another one takes his place.

This protocol is particularly reliable. Consensus techniques are at the heart of every blockchain network. Using the right algorithm ensures fast and secure transaction verification, along with lower power consumption than PoW systems, DPoS also takes less time than PoS systems. Plus, the participants of this network are very motivated by the fact that the network pays well for the performance of its duties.


Thanks to competition, the risk of fraud is minimal, since all users are interested in the operation of their network, and also, of course, want to take the best in the system, so the "rotten screw" is at once removed.
Everything in it looks very natural, just as it should be in life. In this post, I did not consider all existing protocols, but I decided to start with this so as not to overload either myself or readers.


the whole point of pow consensus is that no one can predict who will be the next signer of the block, and the leading consequence of this is that no one can here and now sign it as he pleases

in pow consensus, the right to sign blocks must be paid with energy costs

in pos consensus, for the right to sign blocks, you should to 'pay' blockchain coins (usually they do not pay, but block from spending for a certain period), the very first pos consensus for this simply took a list of unspent outputs and calculated according to a deterministic algorithm (does not spend resources) with probability depending on how old this input is and how many coins it contains (i.e. the probability of signing a block was directly proportional to the number of coins and their age)

in dpos consensus for the right to become a witness (miner) you need to get votes, coins in the hands of any participants (often they themselves are their buyers)

Practice has shown that every consensus based on trust is vulnerable (in dpos, people had to choose which witnesses to trust, but in practice, a few percent did it thoughtfully, the rest stupidly delegate this right to another) and this vulnerability was repeatedly exploited

practice has also shown that a consensus based solely on inner blockchain variables (all pos) is vulnerable to rewriting, because of this, they tried to fix the original pos with hybrid algorithms, combining it with pow (turning it into a pure pow with an add-on) or checkpoints from trusted persons , protecting against rollback, which completely kills the meaning of consensus in principle

proof of capacity, as far as I remember, is also vulnerable to blockchain rewriting, which is the old burstcoin, which is probably the last chia, but did not study the issue

in the end, the only non-vulnerable consensus remained - pow, and then with the 'absence' of an older brother nearby using the same mining algorithm.

p.s. I could look at proof of identity, very interesting concept, idena cryptocurrency, but do not rush to buy coins ;) their high price will weaken its protection


Quote from: RafaelJames on Aug 05, 2022, 10:03 AMThe process of calculating the hash requires a lot of energy
Is where I think "the dog is buried". That is, in fact, energy is the equivalent of a cryptocurrency in terms of value. Although if we take the same fiat (paper money), then energy is also spent on their production, although much less. And this, in turn, means that it is possible, in principle, to determine the real price of bitcoin in dollars, as the cost of the energy spent on its calculation. 8)


the order of participation is determined in dpos blockchains of the eos type, where the windows agree (protocol for this) who will work in what order, if someone missed their turn by timeouts, they are thrown out of the list and punished with fines.
pos itself does not determine the order.
but an algorithm is possible (the classic first pos did this) when a node immediately understands without time—consuming calculations whether it can sign a block or not, and if two or more nodes at the same time, it doesn't matter, the next block will put in place (each node chooses whose branch to use, the algorithm is usually simple - who arrived faster he stays.