Blockchain Pills- Consensus

Fausto Castellano
Coinmonks
5 min readApr 28, 2024

--

One of the most complex topics in the blockchain world is consensus. If I were to simplify its description, it would be like this:

Consensus is the strategy to bring cooperation in a group of competitors.

Before explaining consensus, let’s take a step back to discuss the concept of decentralization.

We can begin by categorizing payment systems into three types:

  1. Centralized payments
  2. Decentralized payments
  3. Distributed payments

Centralised payments

This payment system is characterized by the presence of a central authority, such as a bank. The bank maintains the register of all accounts and transactions.

Example

  • Alice wants to send $10 to Bob.
  • Alice contacts the bank and informs them that she wants to send $10 to Bob.
  • The bank debits Alice’s account by $10 and credits Bob’s account with $10

Decentralised payments (current system)

In this system there are several banks, interconnected. Not all banks maintain direct connections with one another. Not all banks are interconnected, meaning they don’t all have accounts in each other’s ledgers.

Each bank maintains records of all accounts and transactions for its clients. Alice has an account with Bank 1, while Bob is a client of Bank 3.

  • When Alice contacts Bank 1 and requests to transfer 10$ to Bob’s account at Bank 3, Bank 1 debits Alice’s account by 10$ and initiates a transfer to Bank 2.
  • Bank 1 sends the 10$ transfer to Bank 2, which credits Bank 1’s account with the same amount.
  • Meanwhile, Bank 2, not directly connected to Bank 1, processes the incoming transfer from Bank 1.
  • Bank 2 records the credit of 10$ to Bank 1’s account and a corresponding debit of 10$ to Bank 3’s account.
  • Bank 3, upon receiving the transaction details from Bank 2, debits Bank 2’s account by 10$ and credits Bob’s account with the same amount.

The transaction is successfully completed.

Distributed payments

In this payment system, there are no banks. Every user is connected, directly or indirectly, with each other.

  • Each user maintains the ledger of all accounts and transactions.
  • Alice writes on her copy of the ledger: “Alice -10$” and “Bob +10$”.
  • Alice sends the payment information to the nodes closest to her.
  • The closest nodes update their ledgers and write: “Alice -10$”; “Bob +10$”.
  • The nodes then transmit the payment information to other nodes.
  • Bob receives the payment information, updates his copy of the ledger, and writes: “Alice -10$”; “Bob +10$”.

Consensus

Consensus is the mechanism through which actors coordinate their actions

Not known, anonymous, or pseudonymous actors pose a significant threat to coordination. For example, a node may duplicate a transaction, interfere with third-party actions, manipulate the system, or provide false information. This challenge is known as the Byzantine Generals’ Problem.

The Byzantine Generals’ Problem is a classic issue in distributed computing and game theory, operating more or less in this manner:

In a network of communicating nodes (generals), they must agree on a coordinated action (attack or retreat) against a common enemy (defend or surrender). The challenge arises when some generals may be traitors, sending conflicting messages to different nodes.

The goal is clear: despite potential traitors, loyal generals must reach a consensus to ensure successful collective action.

The difficulty lies in the fact that traitorous messages can cause confusion, leading to coordination failure and potential defeat.

The solution to the Byzantine Generals’ Problem involves creating incentives to coordinate actions among participants while ensuring a robust system that can withstand incorrect behaviors or malicious attacks. In Blockchain, this is often achieved through the implementation of consensus mechanisms, such as Proof of Work (PoW) or Proof of Stake (PoS).

Byzantine Fault Tolerance (BFT)

Byzantine Fault Tolerance (BFT) protocols aim to address this issue, ensuring consensus despite the presence of traitors.

The problem is fundamental to understanding fault tolerance and consensus mechanisms in distributed systems.

Byzantine Fault Tolerance (BFT) is a concept well-know in distributed computing and distributed systems. It is designed to enable systems to continue functioning correctly even when some components exhibit failures or malicious behaviors, known as Byzantine faults. These faults can include nodes sending fraudulent, corrupted, or ambiguous messages to other nodes.

The goal of BFT is to ensure that the system can achieve reliable consensus despite the presence of malicious actors. In practice, this means that even if some nodes (or processes) within a distributed system do not behave correctly, the other nodes can still reach agreement on which actions to take.

BFT is crucial in applications where reliability and security are paramount, such as blockchain networks, distributed financial systems, and flight control systems. There are various algorithms and protocols designed to achieve BFT, each with its own trade-offs in terms of fault tolerance, efficiency, and scalability (Blockahin trilemma).

Consensus: Proof of work

Proof of Work is the consensus mechanism used by BTC and many layer 1 networks. It drew inspiration from previous technologies like E-gold and hashcash. The process operates as follows:

In a distributed system, there is a delay in the transmission of information. Every node collects information at slightly different times. Each node packages transactions into 1MB blocks.

If the blocks are accepted by the other nodes, the mining node receives a reward in the form of layer 1 coins plus transaction fees. The sooner a block is issued, the more likely it is to be recognized as valid and rewarded.

The calculations required to create blocks are costly, as energy and machines are paid for in fiat currency. The nodes’ interest lies in maintaining a secure network to ensure that the reward (layer 1 coin) retains its value.

Consensus: Proof of Stake

In Proof of Work (PoW) systems, nodes compete with each other to publish blocks and receive rewards based on computational capacity. PoW relies on an underlying industrial system to ensure network security.

In Proof of Stake (PoS) consensus mechanisms, the ability to publish nodes can depend on the amount of all issued coins locked in a node; the more coins, the higher the probability of publishing a block.

Similar to PoW systems, it is possible to compromise the consensus in PoS by controlling 50%+1 of the “voting power” (i.e., computational capacity), but in PoS, this control is based on economic power.

There are various trade-offs:

  • Environmental considerations
  • Adversarial challenges
  • Time required to replace nodes
  • Security

5 core principles for consensus

OPEN: Everyone can write on the blockchain and participate in the consensus.

Public: Everyone can check what is happening on the blockchain. The ledger is public for everyone in a permissionless environment.

NEUTRAL: The trustlessness of the blockchain makes it neutral and impartial. Nobody can take advantage of a counterparty through the usage of a permissionless blockchain.

BORDERLESS: Due to its decentralized nature, a permissionless blockchain has no geographical location.

CENSORSHIP-RESISTANT: Nobody can prevent anyone from joining and participating in the network, thanks to the decentralized nature of the blockchain itself.

--

--