One of blockchain's biggest promises is that it's a trustlesssystem that uses the community to help verify if transactions are genuine. But how does it do that? Well, different networks use different methods, and those methods are called consensus protocols. It's essentially the rules by which a network operates.
Below we explore what they are, how they work, and the most popular types currently in use today.
What are Consensus Protocols?
A blockchain, or distributed ledger, is spread across nodes whose job it is to verify transactions on the network. This is one of the key ideas about blockchain, and gives it its unique decentralized flavor.
As a result, anyone can submit information to be stored onto a blockchain and therefore it is important that there are processes in place that can ensure everyone agrees on what information to add and what to discard. These rules, are essentially known as consensus protocols. They verify transactions and help keep the network safe.
A consensus protocol is traditionally set before the blockchain is first created, but some networks like Ethereum, are changing the consensus protocol it works on while the network is live. More on that below.
How do Consensus Protocols work?
The consensus protocol at the heart of a blockchain network gives a specific method for verifying whether a transaction is true or not. It provides a method of review and confirmation of what data should be added to a blockchain's record. Because blockchain networks typically don't have a centralized authority dictating who is right or wrong, nodes on a blockchain all must agree on the state of the network, following the predefined rules, or protocol.
For Bitcoin, the consensus protocol is Proof-of work (PoW), the block mining process which confirms each transaction. Other types of consensus protocol include Proof-of-Stake (PoS) and Proof-of-Authority (PoA).
Consensus can be defined as agreement, protocols are rules. Simply, consensus protocols could be viewed as “agreement rules.”
What do consensus protocols do?
Prevent a single entity taking control
If a network has consensus then all participating nodes agree on the state of a blockchain. Thus, data is recorded as the “truth” and the blockchain is able to function with more and more data added as transactions take place or smart contracts are executed.
If you're a little hazy on how blockchains work, we have a guide for that too.
Allows users on a decentralized to trust users without a controlling third-party
A consensus protocol prevents a single entity from controlling a blockchain or distorting the “truth” of what should be recorded.
Double spending is an example of what could happen if one entity tried to take control of the entire network by creating its own version of the blockchain. For example, an attacker could spend some Bitcoin, then alter the block due to be recorded on the blockchain so it doesn’t show the spend. The attacker could broadcast their version of the blockchain, less the spend record. The attacker would have used some Bitcoin, but the coins would not be recorded as spent on the chain and could be spent again.
Bitcoin’s consensus protocol, PoW, prevents this from happening because when that version of the blockchain is compared to other versions held on other nodes, it will be slightly different from everyone else's, and that version will be rejected by the other nodes.
What are some of the most common types of consensus protocol?
Proof-of-Work (PoW): The first blockchain, Bitcoin, uses PoW. To validate transactions to the Bitcoin blockchain “miners,” who are the nodes solve cryptographic, or mathematical problems, using their computers. Miners who solve a problem and validate and enable a block record are rewarded with bitcoin.
Proof-Of-Stake (PoS): Ethereum is moving from PoW to PoS. In PoS there are “forgers” instead of miners. These forgers stake an amount of cryptocurrency which allows them a chance, based on probability, to be a block validator. The successful forger receives the relevant block transaction fees as a reward. Staking their own cryptocurrency on a block provides a disincentive for a forger to try and trick the network as they'll lose the stake if they're proven to be incorrectly adding transactions to the network.
Delegated Proof-of-Stake (DPoS): This method functions in a similar way to PoS. But, instead of using probability, cryptocurrency holders are able to cast votes apportioned to their stake in order to appoint witnesses. These witnesses secure and validate the blockchain, they do not need their own cryptocurrency, but they do need votes. This consensus protocol is more centralized than others. DPoS is used by BitShares, Steem, and EOS.
Proof-of-Authority (PoA): Arguably more centralized again, PoA has predetermined block validators. New blocks on a blockchain are only created when the validators are in majority. The protocol is similar to PoS. The validators are publicly known and accountable for determining their role and eligibility for PoS validation. A newer blockchain, Elysian, uses PoA as well as some Ethereum testnets, or test blockchains.
Consensus protocols, like all blockchain technologies, are evolving to cope with the various challenges growing a decentralized network brings. None are perfect, and each comes with its own set of compromises.
PoW, used by Bitcoin uses large amounts of computer processing power and thus electricity, it also takes a long time to verify if a transaction is true or not, meaning it's not great for everyday usage. There are solutions being built on top of Bitcoin to solve this, such as the Lightning Network.
There is also the concept of decentralization to consider. PoW is very decentralized as many nodes validate blocks in a mathematical way. Newer networks however, choose to centralize power in the network to help improve speed. There is always a debate going on at the heart of the blockchain community over how much centralization is acceptable, we expect this debate to wage on for some time yet.