---
# System prepended metadata

title: Blockchain consensus algorithms

---

# Blockchain consensus algorithms


Blockchain - distributed database where every node stores the whole database and is responsible for its correct updating.

Such distributed systems are prone to faulty and malicious members, which may mess with the system state (database). It is especially important for working with sensitive data (such as finances). This concern is often modeled as [*Byzantine Generals' Problem*](https://lamport.azurewebsites.net/pubs/byz.pdf), where members want to come to an agreement while having a impostor among them. Therefore, some approach for ensuring consistency needed. Consensus protocols are responsible for this.

In blockchain data is stored as ordered chain of blocks.
Block is abstract collection of information with one important propery - it contains hash of previous block, and therefore adding a new block is the only way to modify the chain of blocks.

Depending on protocol realization, some peers can produce their own new blocks and validate blocks from other peers.

There are many way to reach consensus in blockchain system. In report we will consider Proof of Work (PoW) and Proof of Stake (PoS) consensus, since they are most popular. There are multiple variations of these protocols, so we will settle on the most popular representatives from each world: Bitcoin (PoW) and Ethereum (PoS).


## Proof of Work

### Description

Proof of work is first and most popular consenus algorithm, [presented](https://bitcoin.org/bitcoin.pdf) by the author of Bitcoin, Satoshi Nakamoto.
In order to produce a new block, peer needs to solve a cryptographic puzzle that requires a long computation and therefore a lot of hardware work. 
Information about the solved puzzle is placed inside block data and such blocks are considered valid and accepted by other peers on the network.
Peers that produce blocks are often called _miners_. For the producing the block and the support of the consensus, the miner receives a small reward.


### Strengths

* High security level provided by the consensus.
* Independent and decentralized

### Weaknesses

* Huge amount of computing generates a lot of heat and has a bad effect on the ecology.
* In comparison with [traditional finance systems](https://academy.binance.com/en/glossary/transactions-per-second-tps), it has low TPS.

### Opportunities

* Introducing new mining algorithm can improve decentralization of bitcoin. As for now, all bitcoin miners uses ASIC hardware, since it's aimed at calculating the hash only. ASICs are very expensive and are almost always bought by large groups of people, which creates centralization. Introducing algorithm similar to [ethash](https://ethereum.org/ru/developers/docs/consensus-mechanisms/pow/mining-algorithms/ethash/)
* Bitcoin has virtual machine that can execute some scripts. It is however [not Turing-complete](https://github.com/bitcoinbook/bitcoinbook/blob/a3229bbbc0c929dc53ec11365051a6782695cb52/ch06.asciidoc#turing-incompleteness). This limits possibilities of smart contracts on the chain, which makes creation of things, such as bridges, oracles, NFTs, custom tokens, voting and other agreements, harder or maybe even impossible. Introducing it has certain benefits.


### Threats

* Main possible threat of bitcoin and all POW chains is 51% attack. If a group of people controls more than 50% of the hashing power, they can produce invalid blocks and break the whole blockchain.
* Disk space required to run Bitcoin node monotonically increases and [has already reached 400+ GB](https://ycharts.com/indicators/bitcoin_blockchain_size). Today it is still achievable by most of the nodes, however in the future it can make running a node much harder.
* During the time, POW systems became less decentralized, because cryptographic puzzle became more complex, an ordinary person doesn't have enough computation power to produce new blocks.


## Proof of Stake

### Description

This consensus mechanism uses stakes - "bets" that members place as a guarantee of their honesty. Just like nodes in proof-of-work relying on possessing computing resources, they rely on possessing certain amount of finance resources (i.e. money). Such nodes are usually called *validators*.

They earn rewards for doing their job correctly, which encourages people to participate. In contrast, if the majority finds out that a validator misbehaves, the collateral is destroyed, which makes attacks unprofitable.

### Strengths

* Does not promote high computation loads, so it is [more friendly to the environment](https://arxiv.org/pdf/2109.03667.pdf).
* Makes it easier to engage in block production by yourself. Only a minimal stake amount is needed.

### Weaknesses

* Validators (who already have money) are incentivized to do their job, which leads to "rich get richer" movement and centralization.
* Quite complex to implement.


### Opportunities

* Bitcoin has the largest market capitalization among other blockchains. [CCAF estimated](https://ccaf.io/cbeci/index/comparisons) its energy consumption to be similar to entire countries of Finland and Phillipines. Switching to PoS instead can improve environment.

![](https://i.imgur.com/tu8XKhs.png)

* To reduce implementation complexity, developers can (and [do](https://github.com/paritytech/substrate)) build frameworks for blockchains to not reinvent common components each time.
* [Sharding](https://ethereum.org/en/upgrades/sharding/) is planned to be shipped to Ethereum that should increase performance of the networks and reduce fees while keeping security at the same level.
* Techniques, such as [erasure coding](https://wiki.polkadot.network/docs/learn-comparisons-ethereum-2#consensus), can help to reduce load on blockchain members and potentially increase performance.

### Threats

* Some [crazy dude](https://www.bbc.com/news/technology-63402338) can decide to buy lots of PoS-backed tokens and perform 50%+1 attack.
* Disk space required to run Ethereum node monotonically increases and [has already reached 1000+ GB](https://ycharts.com/indicators/ethereum_chain_full_sync_data_size). Today it is still achievable by most of the nodes, however in the future it can make running a node much harder.

## Comparison


|                  | Proof of work (Bitcoin)                                                                   | Proof of stake (Ethereum)                                                                                 |
| ---------------- |:----------------------------------------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------- |
| Block producing  | Miner have to bruteforce block signature                                                  | Validator has to stake 32 ETH once and later he/she will be randomly selected as block producer           |
| Reward           | Miners get block reward for mining a block                                                | Validators doesn't get block reward, they are paid a network fee from transactions                        |
| Block speed      | about **10 minutes**. relatively slow in order not to violate the integrity of the network | **12 seconds**. Relatively fast since every 12s only one validator can produce block                      |
| Malicious action | Required to have 51% of all network computing power. Almost impossible in real life.      | Required to have 51% of cryptocurrency on the network. Almost impossible in real life and makes no sense. |
| Efficency        | Less expensive and less energy-efficient                                                  | More cost and energy-efficient                                                                            |
| Hardware         | ASIC miner farm                                                                           | Simple ubuntu server                                                                                      |
|Competition|Yes, minners always compete|No, every validator has fair and equal chance to produce block|

