Consensus Protocols: How Are Blockchains Secure?
|— 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 protocols, and there are various different types—including Proof of Work (PoW) and Proof of Stake (PoS).
As we saw in our ‘what is blockchain” piece, blockchains are a type of database that are used to securely process and track the distribution of data across a large number of computers (known as nodes).
These nodes are like a network of identical filing cabinets that all work to keep a record of everything that ever happened on a blockchain and there’s an incredibly meticulous process of deciding which new files to add to each cabinet, since they all need to stay in sync to keep everything running smoothly—otherwise they’d end up with conflicting records.
Each file added to the cabinet could represent practically anything, but generally represents a transfer of value, i.e. a record of someone sending a payment to someone else—this is what you’d expect from a blockchain like Bitcoin or Litecoin.
What is a consensus protocol?
Being decentralized, there are no supervisors or admins deciding what data should or shouldn’t be added to the database. But thanks to the magic of blockchain, they don’t actually need any!
Instead, the filing cabinets (nodes) just need a set of agreements that they can use to decide if they should add a transaction to their records, or reject it. This set of agreements is known as a consensus mechanism—since the blockchain only gets updated when a majority of nodes agree to do so, i.e. they reach consensus!
This is an incredibly important process, since these records could relate to the transfer of funds from one person to another—we wouldn’t want someone successfully spending funds they don’t have, or even worse, spending other people’s funds! This type of thing is what consensus systems protect against, and more.
You wouldn’t want to use a blockchain that can’t keep your funds safe, right?
Why do blockchains need to reach consensus?
We’re still exploring all the ways blockchain can be used and there are now literally thousands of blockchains out there all with different purposes.
Nonetheless, they’ve all gone one thing in common—they need to maintain accurate records, or they’d be pretty much useless.
Unlike a bank, blockchains don’t have any central authority tasked with keeping the records up to date… there are no administrators, operators, or clearinghouses to refer to.
Instead, with the process of reaching an agreement about the current state of the network falls to the nodes—these are the computers that keep a complete record of the blockchain.
Practically anybody can start up a node and help with this process, you can usually start one up yourself in less than half an hour if you want.
Fortunately, if you opt to help secure the network, you don’t actually have to sit there manually reviewing each transaction before it can be confirmed—just imagine how incredibly tedious that would be! This process is instead directly handled by software, using a defined set of rules.
When important data and user balances are on the line, it’s super important that the blockchain remains free of errors, and only genuine transactions are recorded. This is why an agreement about the current state of things before the blockchain is updated—to prevent nodes recording conflicting information.
You can think of this as a voting process. If more than half of nodes vote to include a transaction, then it will be added to the blockchain. Otherwise, it’s trashed.
Most of the time, users involved in maintaining consensus must put something at stake to prevent them from acting maliciously, since they’ll lose their stake if they are caught out. On the flip side, there are often incentives in place to act honestly.
If you’ve ever heard the term “strength in numbers”—it applies perfectly to blockchains. As you can imagine, a system secured by just a few people could easily be corrupted through collusion if the majority of people are ‘in on it’, but this is pretty much unfeasible when there are potentially tens of thousands of people involved.
What consensus systems are there?
All consensus systems 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 systems.
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 protocol used to secure a blockchain—the Bitcoin blockchain to be specific.
It was created in 2008 by the OG of the cryptocurrency industry known as Satoshi Nakamoto—the same pseudonymous entity that invented Bitcoin.
It uses a decentralized network of specialized computers (known as miners) which put in computational work (cracking complex calculations) in order to choose which transactions are added to the blockchain next (they’re then bundled into a new block).
Satoshi designed PoW to act as a deterrent to anybody who wanted to spam the Bitcoin network or attempt to seize the majority control over it—since 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—since they’d be effectively throwing their money away trying due to the sheer size of the Bitcoin network today.
Proof of Stake (PoS)
Although Proof of Work is certainly a robust consensus system, 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!
This is why two early blockchain developers, Sunny King and Scott Nadal, put their brains together in 2012 to create a more environmentally friendly alternative, known as Proof of Stake (PoS)—which quickly became the second most popular consensus mechanism used today.
Rather than requiring a large network of miners to crunch numbers to find the next block, the task of filling blocks with transactions is instead handled by validators. These have to put up collateral (usually a significant sum of tokens) to ensure they act honestly, and could lose some or all of their stake if they break the rules.
A validator chosen to produce the next block can then fill it with transactions they deem to be valid and they earn a reward at the same time.
This setup is generally more energy-efficient than Proof of Work and offers similarly impressive security—which is partly why the second most popular blockchain (Ethereum) is looking to migrate from PoW to PoS.
Nominated Proof of Stake (NPoS)
Nominated Proof of Stake (NPoS) is one of the newest consensus mechanisms and is essentially an updated version of regular Proof of Stake.
It was first implemented by Polkadot in 2020 and introduces a few changes that are designed to make it easier to participate in the consensus process.
Rather than simply relying on validators like in PoS, NPoS also introduces another key stakeholder known as a nominator. The nominators vote in the validators they believe will operate in the best interests of the network, and back them by putting up their stake.
This is similar to voting for a governor, mayor, or some other official—if that official had to share his salary with everybody who voted him in!
Validators are then chosen to produce the next block and if they act honestly, get rewarded (most of which is distributed to the nominators).
This is thought to be a much more inclusive way to secure a blockchain, since practically anybody can become a nominator just by bonding some tokens and selecting a validator they trust. While running a validator requires some technical expertise and specialized computer hardware, becoming a nominator is a ‘set it and forget it’ kinda thing.
Consensus systems are an extremely important aspect of many blockchains, and are the reason why cryptocurrencies are generally considered to be incredibly secure.
They’re also the bread and butter for many cryptocurrency miners and node operators, who can earn substantial rewards for helping secure the network—if they’re willing to put up a stake to take on the position.
Unlike in the world of centralized finance, 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 governing.