What is the concept of consensus in a blockchain?

Let’s me explain the concept of consensus in blockchain in simple terms:

Chandan | web3 Research
4 min readJul 30, 2023

Imagine you have a digital notebook that you share with your friends. In this notebook, you all write down transactions, like who borrowed some money from whom or who bought a new game.

Now, the problem is that you and your friends live in different parts of the world, and you don’t trust each other completely. You want to make sure that all the transactions in the notebook are accurate and that no one can cheat by changing the information.

Here comes the idea of consensus in blockchain:

Consensus is like an agreement among all your friends about what should be written in the notebook. Instead of trusting just one person to update the notebook, everyone gets a chance to validate the transactions.

Here’s how it works:

1. Someone proposes a new set of transactions to be added to the notebook. Let’s call this person the “proposer.”

2. Before adding these transactions, everyone else in the group checks if the proposed transactions are valid. They do this by using some rules and math.

3. If more than half of your friends agree that the proposed transactions are valid, they all write those transactions in their own notebooks.

4. Once the majority agrees, the new transactions become a part of the notebook, and this updated notebook is shared with everyone in the group.

5. Now, everyone can see the same information in their notebooks, and they all know that the transactions are accurate because they all agreed on it.

In a blockchain, the notebook is called a “block,” and each page in the notebook is a “transaction.” The process of everyone agreeing on what should be in the notebook is called “consensus.”

This consensus in blockchain is crucial because it ensures that all the participants in the network have the same information and that no one can cheat the system. It also makes sure that the blockchain is secure and reliable, even if some people in the group are not trustworthy.

That’s the basic idea of consensus in blockchain, where everyone works together to agree on the truth and keep the system running smoothly!

Let’s dive a bit deeper into how consensus works in a blockchain:

In a blockchain network, multiple participants, also known as nodes, are connected to each other through a peer-to-peer network. Each node has a copy of the entire blockchain, which contains a series of blocks, and each block contains a set of valid transactions.

The goal of consensus in a blockchain is to ensure that all nodes agree on the validity and order of transactions in each block. This agreement is crucial because it helps maintain the integrity and security of the blockchain.

To achieve consensus, different blockchain platforms use different consensus mechanisms. The two most common mechanisms are “Proof of Work” (PoW) and “Proof of Stake” (PoS).

1. Proof of Work (PoW):
In the PoW consensus mechanism, which is famously used by Bitcoin, nodes compete to solve complex mathematical puzzles. The first node to solve the puzzle gets the right to create a new block and add it to the blockchain. Solving these puzzles requires significant computational power, and the process is often referred to as “mining.”

When a node successfully solves the puzzle and creates a new block, it broadcasts this block to the rest of the network. Other nodes then verify the validity of the block and its transactions by checking if the solution to the puzzle is correct and if the transactions meet the predefined rules.

If the majority of nodes agree that the block is valid, it is added to the blockchain, and the process starts again for the next block.

2. Proof of Stake (PoS):
In the PoS consensus mechanism, as used by Ethereum and some other blockchain networks, the concept is different. Instead of competing through computational power, nodes are chosen to create new blocks and validate transactions based on the number of coins they “stake” or “lock up” as collateral.

Nodes that want to become validators must put a certain amount of their cryptocurrency holdings into a special smart contract as a stake. The more coins a node stakes, the higher the chances it has to be chosen as a validator.

Validators then take turns proposing new blocks. Other nodes, often called “bonded validators,” verify the proposed block and its transactions. If the majority agrees that the block is valid, it gets added to the blockchain, and the validator is rewarded with transaction fees or other incentives.

If a validator acts dishonestly or tries to cheat the system, a part or all of their staked coins may be taken away, which acts as a strong incentive for validators to act honestly.

Conclusion:

Consensus mechanisms are the backbone of blockchain networks, ensuring that all participants agree on the truth of the blockchain’s history. Whether it’s the energy-intensive PoW used by Bitcoin or the more eco-friendly PoS used by Ethereum, the goal remains the same: to create a secure, transparent, and decentralized system where everyone plays by the rules. By achieving consensus, blockchains enable trust in a trustless environment and make it possible to operate decentralized applications and cryptocurrencies without the need for a central authority.

--

--

Chandan | web3 Research
Chandan | web3 Research

Written by Chandan | web3 Research

Researching the frontier through on-chain data in Layer 1/2s, DeFi, and modular ecosystems.

No responses yet