---
# System prepended metadata

title: Consensus

---

# Consensus

1/14 "Consensus” is a fundamental concept in distributed systems and blockchain technology. In this context it refers to the agreement among all miners in the network on the current state of the blockchain. In this thread we'll try to unpack this concept 👇
![](https://i.imgur.com/Pj1NaPO.png)

    The goal of blockchain consensus is to maintain the exact same copy of the history on all nodes.

    In a centralized system, solving this issue is easy: a central coordinator can simply impose the transaction order. In a distributed system this is not possible, and a more complex mechanism is required.

    The process for adding to the ledger in Blockchains consist of appending a new block to the distributed data structure. This involves two main steps, each with their own choice of algorithms: selection of the block proposer and consensus on the inclusion of the proposed block.

The former involves deciding which node gets to generate the next block, the latter focuses on whether or not a new block is accepted into the blockchain data structure. Both steps are equally important and entirely different.

The easiest way to choose the next block producer would simply be taking turns or choosing the next block producer randomly. In fact, taking turns is a very good choice in situations with a fixed number of authorized participants. This is usually the case of permissioned consortium blockchain used in enterprise setups.

However, such a scheme does not work in public blockchains, in which anyone can participate freely, 

Sybil attack. Therefore a mechanism is required to attach an economic difficulty to the act of obtaining a ticket.

PoW attaches a cost to participating in the block producer selection algorithm.
Proof of work (PoW) is a form of cryptographic proof in which one party (the prover) proves to others (the verifiers) that a certain amount of a specific computational effort has been expended.
PoW is not a consensus algorithm at all, it is merely a Sybil-resistant tool for selecting the next block producer.
PoW can be combined with a number of consensus algorithms. 

The actual consensus algorithm in a blockchain system is executed after a block has been proposed by the chosen block producer. Participants have to reach an agreement on whether to include a block or not. Bitcoin and similar blockchains, including Ethereum, don’t really execute any particular algorithm to reach such an agreement. Instead, they choose a hands-off approach which simply allows temporary disagreements and establish a rule that the strongest chain wins, meaning the chain supported by the majority of the network’s computing power. Temporary forks are accepted and are indeed quite common. This form of consensus is sometimes termed Nakamoto consensus

consensus protocols that work quite differently. BFT consensus protocols execute a number of communication rounds between the participants of the network to vote on the inclusion of a block and reach a firm agreement.

It has been mathematically proven that this type of protocol can keep operating correctly as long as less than one-third of the participants act maliciously. The disadvantage of BFT consensus is that it scales badly, due to the communication overhead involved. For this reason, this type of protocol is mainly used in situations where the number of validators is limited and known in advance

Nakamoto consensus only provides probabilistic finality. This means that the probability of a block being final increases with every additional block added to the chain but never reaches theoretical certainty

    formal vs informal
    permissioned vs permissionless
    (partial) synchronous vs asynchronous

    The three consensus problems studied most are Byzantine Broadcast, Byzantine Agreement, and State Machine Replication (the problem that blockchain protocols solve).
    
    Permissioned protocols are those in which all participants are known from the start of the protocol execution. In the links below, permissioned protocols are further classified according to the model of message reliability: either synchronous, partially synchronous, or asynchronous. 

    Permissionless protocols are those with permissionless entry: Anybody is free to join in the process of reaching consensus, and the set of participants may even be unknown at any point during the protocol execution. 

    Very roughly, SMR is the problem that blockchain protocols are designed to solve: Clients send in a sequence of transactions of their choosing and the processors implementing the SMR protocol have to agree on an order in which to implement those transactions.

2/14 In most traditional consensus algorithms, each participant in the network is trusted. In blockchains, we assume an *adversarial* context, in which participants can behave erratically or even maliciously.

3/14 Consensus mechanisms that can tolerate these adversarial contexts are called Byzantine Fault Tolerant or BFT (as in the Byzantine Generals Problem). There are several different BFT consensus mechanisms used in blockchain networks, each with its own pros and cons.
![](https://i.imgur.com/I16DnCp.png)

4/14 Proof of Work (PoW) was the first consensus mechanism used in blockchains, introduced by Bitcoin. In it, participants must solve a complicated math puzzle in order to validate transactions and create new blocks, and consider the longest chain of blocks to be the valid one.
![](https://i.imgur.com/rExcoWK.png)

5/14 Participants who try to lie or behave maliciously must outperform the rest of the honest network in computational power to keep solving these puzzles. As long as the majority of participants are honest, the network is secured.

6/14 Proof of Stake (PoS) is another popular consensus mechanism that uses a different approach. Instead of solving mathematical problems, some participants "stake" their tokens to validate transactions and create new blocks. These participants are called *validators*.
![](https://i.imgur.com/avZhKkh.png)

7/14 The main idea behind PoS is that, if a validator behaves maliciously, the network will punish them by taking away their tokens from them. At the same time, validators are rewarded a small amount of money for their work, as an incentive to keep producing blocks.

8/14 Other consensus mechanisms include Delegated Proof of Stake (DPoS), Practical Byzantine Fault Tolerance (PBFT), Federated Byzantine Agreement (FBA) and BFT based on DAGs.

9/14 Consensus is crucial for maintaining the integrity and security of a blockchain network. Without it, the network would be vulnerable to attacks and unable to function properly.

10/14 As blockchain technology continues to evolve, it's important to consider different consensus mechanisms and how they might be used in different applications.

11/14 New algorithms are still being investigated because they have the potential to improve upon current algorithms in terms of performance, efficiency, or accuracy.

12/14 The limitations of current algorithms also need to be studied in order to identify areas for improvement, and to guide the development of new algorithms that can overcome these limitations.

13/14 Additionally, as the data becomes more and more complex and diverse, the current algorithms may not be able to handle them, so new algorithms are needed to process these new types of data.

14/14 Overall, Consensus is the backbone of the blockchain technology which ensures the integrity and security of the network.
