New: Wallet recovery made easy with Ledger Recover, provided by Coincover

Get started

Up your Web3 game

Ledger Academy Quests

  • Test your knowledge
  • Earn POK NFTs
Play now See all quests

The Classroom

PATHWAY F) Blockchain Basics

chapter 4/4

Consensus Mechanisms: How Blockchains Stay Secure

Read 7 min
Medium
book with pages
KEY TAKEAWAYS:
— The participants in a decentralized network need to come to an agreement when deciding which data should be added and what shouldn’t in order to keep the network secure.
— This decision making process ensures transactions can be completed without relying on central intermediaries.
— The rules they use to come to this agreement are called consensus mechanisms, and there are various different types—including Proof of Work (PoW) and Proof of Stake (PoS). 

If you want to understand the inner workings of a blockchain network, you’ve got to wise up on consensus mechanisms. If that sounds new to you, read on. They’re the whole reason decentralized blockchains even exist.

Consensus mechanisms are necessary for all decentralized blockchains, and by extension, all cryptocurrencies. To explain, blockchains store their information distributed across the whole network in nodes. These nodes are real computers across the world, each with a copy of the blockchain’s entire history. So, when there’s a new piece of data to add to the network, the nodes must agree whether it should, or shouldn’t, be added to the chain.

As such, there’s an incredibly meticulous process of deciding which new files to add. If the network’s nodes had conflicting records, it would cause havoc on the wider network. For example, you wouldn’t want someone successfully spending funds they don’t have, or even worse, spending your funds without your permission!

Well, this is exactly what consensus mechanisms protect against. Since all of the nodes must participate in the validation of new data, there’s plenty of chance for participants to flag mistakes or malicious transactions.

In fact, without consensus mechanisms, decentralized networks wouldn’t be possible. But before we get there, let’s go back to basics. In fact, what is a consensus mechanism exactly?

What Is a Consensus Mechanism?

A consensus mechanism is the method in which blockchain nodes all come to agreement about whether a piece of data can join the chain. Essentially, they are just a predetermined set of agreements to decide if they should—or shouldn’t—add a transaction to their record. This set of agreements allows a blockchain network to reach a conclusion in a decentralized manner, meaning there are no supervisors or admins needed.

What Is Blockchain Consensus For?

Consensus mechanisms are useful for countless reasons, but the two most notable are; avoiding errors & malicious transactions, and reaching agreement in a decentralized way.

Avoiding Errors & Malicious Transactions

When important data and user balances are on the line, it’s extremely important that the blockchain remains free of errors. This way you can guarantee the network only contains genuine transactions. Not only that, using this method will also make sure that malicious transactions are identified. That way, they don’t join the chain. Multiple nodes are responsible for adding or rejecting blocks, and this makes it very difficult to sneak a bad transaction through the validation process.

Decentralization

A consensus mechanism is also for decentralization. In short, it allows nodes to come to agreement without a centralized entity’s assistance. However, not all blockchain networks using a consensus mechanism are decentralized.

If you’ve ever heard the term “strength in numbers”—it applies perfectly to blockchains. To explain, the less participants there are in the network to validate and process data, the easier it is for them to reach consensus. As such, a system secured by just a few people is easily corrupted. That means, the more participants there are to reach consensus, the more secure the network is.

So now you know what a consensus mechanism is, but what about how it works?

How Do Consensus Mechanisms Work?

Simply, the blockchain only processes a change when a majority of nodes agree that the new piece of data fits with the blockchain’s consensus mechanism, that predetermined set of agreements. Since they run using the same framework, every node is expected to reach the same conclusion. And when the majority agree, they reach consensus!

You can think of this as a voting process. If more than half of nodes vote to include it, the transaction will be added to the blockchain. Otherwise, the network discards the transaction.

Then most of the time, a consensus mechanism will involve a way to incentivize honorable participants, and punish bad ones. This is important to keep the network secure, and free from bad actors aiming to exploit the power of processing transactions. Beyond that though, consensus mechanisms can vary greatly from how they are secured to how they process transactions.

Let’s explore some of these different consensus mechanisms and how they affect a blockchain’s workings:

Consensus Mechanisms: What Types Are There?

All consensus mechanisms look to achieve agreement in a decentralized network, but exactly how they achieve this varies significantly. 

Just like how you can have a jury, a parliament, a council, and various other ways to work towards an agreement about something, blockchain protocols can use different consensus mechanisms. 

Let’s take a look at some of the most popular ones.

Proof-of-Work (PoW)

Proof of Work (PoW) is the very first decentralized consensus mechanism used to secure the Bitcoin blockchain.

It was created in 2008 by Satoshi Nakamoto. If that sounds familiar, it’s because it’s the same person responsible for the first and most popular blockchain; the Bitcoin network.

A Proof-of-work consensus uses a decentralized network of specialized computers which put in computational work. This computational work determines which transactions are added to the blockchain next. Next a miner arranges them in a block and broadcasts them to the network.

PoW is a deterrent to anybody who wants to spam the Bitcoin network or attempt to seize majority control over it. To explain, the amount of computational effort needed to ‘mine’ a block is feasible but incredibly costly. This deters attackers from trying to forge blocks, while also preventing a single entity from effectively monopolizing the network. Simply, cheating the network is just too expensive.

Although Proof of Work is certainly a robust consensus mechanism, it has one major problem—energy usage. 

All those specialized computers that work to keep blockchains secure through Proof of Work suck up a huge amount of power. According to some estimates, the Bitcoin mining network uses a whopping 77.78 TWh of electricity…. which is similar to a small country!

Used by Bitcoin (BTC) | Litecoin (LTC)

Proof of Stake (PoS)

consenus

To combat PoW’s energy consumption, blockchain developers, Sunny King and Scott Nadal created their environmentally friendly alternative in 2012. This was later dubbed Proof of Stake (PoS) and it quickly became a very popular consensus mechanism. 

Rather than requiring a large network of miners to crunch numbers, a proof-of-stake network uses validators instead. These validators propose and validate blocks, and in return, they earn a reward.  However, to ensure they act honestly, validators must put up a certain amount of the network’s native coin as collateral. This is called crypto staking. If a validator behaves honorably, they earn a reward, but if they behave maliciously, they can lose their stake via slashing, and they can even lose their role too.

Used by Ethereum (ETH) | Cardano (ADA | Tezos (XTZ) | Cosmos (ATOM)

Other Consensus Mechanisms

While proof-of-work and proof-of-stake are the most popular of consensus mechanisms, they aren’t the only options in existence. In fact, there are now countless consensus mechanisms which use these innovations to build something of their own. Even within the proof-of-stake umbrella, we also have nominated proof-of-stake, delegated proof-of-stake and a number of others.

There are also other types of consensus mechanisms that don’t follow either of these systems, such as proof-of-storage and proof-of-authority.

It’s important to note that although nodes and consensus mechanisms allow blockchains to act without a central authority, it doesn’t automatically mean they are decentralized. Some consensus mechanisms are more centralized than others, as their models fit their purpose.  Since different networks aim to achieve different goals, we’re also probably likely to see many more consensus mechanisms far into the future too.

How Consensus Mechanisms Shape A Blockchain

Consensus mechanisms are an extremely important aspect of many blockchains. Put simply, they are the only reason why cryptocurrencies are so secure. Understanding how they work and their differences will help you understand the nitty-gritty details of this technology.

There are also a few ways to take part in the consensus mechanism yourself, from crypto mining, to validating—and you can also earn rewards from helping others participate too. For example, you could fund a validator and receive rewards that way!

With public blockchains, almost anybody can participate in the role of keeping a cryptocurrency network secure. This makes for a much more inclusive financial system that you can be a part of.


Related Resources

Stay in touch

Announcements can be found in our blog. Press contact:
[email protected]

Subscribe to our
newsletter

New coins supported, blog updates and exclusive offers directly in your inbox


Your email address will only be used to send you our newsletter, as well as updates and offers. You can unsubscribe at any time using the link included in the newsletter.

Learn more about how we manage your data and your rights.