DEV Community

Cover image for Consensus Mechanisms: How Blockchains Reach Agreement
Shreya Shenoy
Shreya Shenoy

Posted on

Consensus Mechanisms: How Blockchains Reach Agreement

In a decentralized system, maintaining trust is essential and consensus mechanisms play a crucial role in ensuring the secure addition of blocks. In this post, we will explore two of the most widely used consensus mechanisms: Proof-of-Work (PoW) and Proof-of-Stake (PoS).

It's important to note that numerous other mechanisms exist, each with its unique characteristics and benefits. And if you're curious to explore additional consensus mechanisms, make sure to check out the linked resources at the end of this article!


Consensus model: Proof-of-Work

In Proof-of-Work (PoW), miners (participating nodes) compete to solve a cryptographic puzzle. The first miner to solve the puzzle is rewarded with cryptocurrency and is given the right to add the block to the chain. Bitcoin operates on this consensus model.

The cryptographic puzzle is a hash function that takes as input the block header and a nonce. Miners compete to solve the puzzle by repeatedly changing the nonce until the hash meets a certain criteria. The hash function is designed to be very difficult to compute, but very easy to verify. To solve this, miners use specialized hardware to perform billions of calculations per second.

Mining Competition

Once a miner finds a nonce that generates a hash that satisfies the difficulty requirements, they broadcast the solution to the network. The other miners then verify the solution and add the block to the blockchain. The miner who found the solution is rewarded with newly minted cryptocurrency.

Miner Win

This process ensures that blocks are added to the chain in a secure and transparent way. It also prevents anyone from tampering with the blockchain, as any changes would be immediately apparent to the network.

It is also a way to prevent double-spending attacks. A double-spending attack is an attempt to spend the same bitcoin twice.

Drawbacks to Proof-of-Work

The computations needed to add a block in the proof-of-work consensus mechanism require massive amounts of computer power, which translates to a significant amount of energy consumption. This has become an environmental concern as the popularity of cryptocurrencies has grown.

Proof-of-work is also slower and less scalable than other consensus mechanisms.

Proof-of-Stake (PoS) is a consensus mechanism that has grown in popularity. Ethereum officially switched to PoS in 2022 as a more secure and energy-efficient way to validate transactions and add new blocks to the blockchain.

To illustrate the difference, Bitcoin can only process around 7 transactions per second, while Ethereum can process around 30 transactions per second.


Consensus Model: Proof-of-Stake

In PoS, staking replaces mining competitions. Participants who wish to engage in currency forging need to put up a certain amount of tokens (stake). One node out of the participating nodes is randomly selected to validate the block being added.

Stake Selection

The random selection of nodes to validate blocks is not truly random. There are a few factors that influence the probability of being selected, such as the amount of cryptocurrency staked by the node. For example, someone with more money at stake has higher chances of being selected to validate the node. Additionally, different cryptocurrencies use different selection techniques, such as randomized block selection and coin age selection.

How does PoS maintain security?

Due to their own currency being at stake in this mechanism, nodes are incentivized to validate blocks honestly because they are penalized if they are caught cheating. If a node validates a block that is invalid, they will lose a portion of their stake. This helps to ensure that the network is secure and that nodes are not able to manipulate the blockchain.

PoS Validation

Validators who validate blocks correctly are rewarded with transaction fees.

This way PoS is more energy-efficient, as it does not require miners to use specialized hardware to solve complex mathematical puzzles. It is also more scalable and can handle a larger number of transactions.


TLDR? Here's a short video outlining the difference between the two consensus mechanisms and also describing some others out there:


Also, check out these links to learn about additional consensus mechanisms:

12-min Video Explaining 7 Different Mechanisms
Solana's use of Proof-of-History
Beginner's Article: Consensus Mechanisms in Blockchain


Overall, blockchain is promising technology with the potential to revolutionize the internet as we know. It is still in its early stages of development, but it is already being used by a wide range of businesses and organizations.

Here's an overview of the concepts covered in this series:

Article Contents


Web3 is a new decentralized internet that is built on blockchain technology, and it is still in its early stages of development. However, there are already a lot of cool developments happening in web3, such as decentralized finance (DeFi), non-fungible tokens (NFTs), and decentralized autonomous organizations (DAOs).

If you are interested in learning more about blockchain technology and web3, follow me on dev.to and Twitter. I would be happy to answer any questions you have.

Top comments (0)