Saving page now... https://komodoplatform.com/blockchain-consensus/ As it appears live September 24, 2020 2:38:34 AM UTC

Blockchain Consensus Protocols: Rules For Decentralized Agreement

Delton RhodesMarch 10, 2020

Blockchain consensus protocols, sometimes called blockchain consensus mechanisms, are sets of rules that determine how a decentralized computer network reaches agreement on which transactions are valid and which are not. This is an absolutely indispensable component of any blockchain network.

In this article, we’ll explore how blockchain consensus protocols work, common issues with validating transactions, and examples of the most popular blockchain consensus protocols in use today.

blockchain consensus banner image

Why Are Blockchain Consensus Protocols Important?

Before we explain exactly how blockchain consensus protocols work, it’s important to understand why they are so important in the first place.

First, let’s recall that all blockchains run on a decentralized peer to peer network. Each computer in this network, called a node, independently validates all transactions and blocks. In effect, each participant in the network is checking the work of every other node in the network. If a mistake is found— that is, if a node is trying to submit a faulty transaction or generate a block with an inaccurate nonce— the rest of the network will notice and reject the process.

For Proof of Work blockchains, this means that all full nodes participate in the process cryptocurrency mining to ensure that each newly mined block is accurate. For Proof of Stake blockchains, this means that all stakers validate all transactions, even the transactions included in blocks that other nodes stake.

Ultimately, this validation is necessary because of the decentralized nature of blockchain networks. In a centralized system, there is just one entity that verifies transactions, so consensus isn’t necessary. That one central authority has all of the power required to approve or reject transactions. While this might be a little more efficient than a decentralized system, it relies upon a single point of failure, which introduces security vulnerabilities and several major moral hazards. It also concentrates power in the hands of a single authority, rather than distributing power among all participants.

Think of a bank— if your bank account balance is $90 and you try to spend $75, then your bank approves the transaction through your bank card and you can make the purchase. If you try to spend $100, then the bank denies the transaction and you cannot make the purchase. There isn’t a large group of people voting on whether to approve or reject the transaction, just one bank making the decision.

Now, let’s shift back to decentralized networks, where each node independently verifies transactions and blocks. It’s easy to see why blockchain consensus protocols are so essential— the network needs to come to agreement on which transactions to approve and which to deny.

Think what would happen if there were no blockchain consensus protocols: either all transactions would be permissible, allowing users to spend infinite funds and render the currency worthless, or the network would never reach agreement on which transactions were valid and it would be impossible for anyone to send any funds at all. In both scenarios, digital currencies are useless.

So, in order for a decentralized network of individual nodes, some of which may be malicious or dishonest, we need a set of rules to help the network reach agreement. This set of rules is known as a blockchain consensus protocol.

The Purpose of Blockchain Consensus

The primary function of a blockchain consensus protocol is to provide security to the network. In particular, blockchain consensus protocols must overcome the Byzantine Generals Problem and prevent double spending of the network’s currency. Let’s examine each of these objectives in turn.

Overcoming The Byzantine Generals Problem

As noted in the previous section, some of the nodes in a blockchain’s network may be dishonest. But the rest of the honest nodes on the network must come to agreement despite the presence of dishonest nodes. In the world of computer networks, this is what’s known as the Byzantine Generals Problem

The concept of the Byzantine Generals Problem was first introduced in 1982. The authors of the essay state the problem as follows:

“[A] group of generals of the Byzantine army [are] camped with their troops around an enemy city. Communicating only by messenger, the generals must agree upon a common battle plan. However, one or more of them may be traitors who will try to confuse the others. The problem is to find an algorithm to ensure that the loyal generals will reach agreement.”

In the analogy, the Byzantine Generals represent the nodes in a decentralized peer to peer network and the messengers would be the packets of information the nodes are sending to one another across the network. There may be traitors among the generals— malicious nodes in the network— so it’s crucial that the loyal generals can come to consensus on which battle strategy to pursue, in spite of this uncertainty. Further, it’s essential that each general is confident that each of his peers will be following through with the same plan that he is. 

Applying this concept to blockchains, a majority of nodes on a network have to agree upon the legitimacy of submitted transactions, data, and the state of the network. 

A related concept known as Byzantine Fault Tolerance (BFT) refers to the ability to keep a network operational even in cases where faults occur. That is,networks must remain operational, even when some nodes are dishonest, even when some nodes lose connectivity and drop off the network, and even when some nodes in the network disagree about which transactions are valid. All blockchain networks must exhibit a strong degree of Byzantine Fault Tolerance to be successful.

Preventing Double Spending

Now on to the second objective of blockchain consensus protocols: preventing double spending. The double spending problem is a challenge unique to blockchain networks that support cryptocurrencies. 

As the name suggests, double spending is the ability to fraudulently spend the same currency twice. In some senses, all currency gets spent twice— if I use a $10 bill to pay for a sandwich, the proprietor will certainly turn around and use that same $10 bill again in the future. 

In some ways, the same is true for BTC. If I send someone, say, 2 BTC, they will be able to use those 2 BTC again. (This isn’t exactly true, since each transaction eliminates one or more UTXO and creates at least one new UTXO, but it holds true enough for the sake of the analogy. For more information on how exactly this works, please see this guide to UTXO.)

However, this is not what we mean when we say “double spending.” Double spending refers to the same person using the same currency from the same wallet more than one time. 

So, to continue on the example above, imagine that I use the same $10 bill to buy the same sandwich. But now, I take that $10 bill back again and use it to buy a cookie and a coffee, too. We all recognize this as stealing— I took funds that were no longer mine and spent them a second time. This is what we mean when we talk about “double spending.”

Double spending is typically made possible as a result of a 51% attack, wherein the attackers gain control of a majority of a network’s hash rate. With various solutions and approaches, blockchain consensus protocols secure a decentralized network against double spending. We will explain a few of the most prominent approaches later in this article.

Common Issues Facing Blockchain Consensus Protocols 

As discussed above, the primary function of blockchain consensus protocols is to overcome the Byzantine Generals Problem and prevent double spending. In other words, the purpose is to provide security. 

However, that’s not the only thing that blockchain consensus protocols aim to achieve. In addition to security, there are a few other characteristics that blockchain consensus protocols strive for— namely, decentralization and scalability. 

Some people within the blockchain space have come to refer to these three traits— decentralization, security, and scalability— as the “scalability trilemma.” The idea is that two of the three can be obtained rather easily, but finding a blockchain consensus protocol that provides all three is extremely difficult.

Decentralization

Some public blockchains (e.g. Ripple) aren't designed to be decentralized, but most public blockchains supporting cryptocurrencies are. Relying upon a centralized database to maintain a digital record of all transactions creates potential security vulnerabilities, such as Distributed Denial of Service (DDoS) attacks. It also presents moral hazards and forces users to trust the authorities in control of the centralized database. 

Decentralization creates higher censorship-resistance and allows networks to operate without the need for a trusted intermediary. Decentralized systems also provide improved security, as every individual participant validates all activity. 

While decentralization doesn’t have a perfectly clear definition— indeed, there is much debate over what exactly constitutes decentralization and what doesn’t— it is something that virtually every blockchain project values. Indeed, most blockchain consensus protocols provide a moderate-to-high level of decentralization. 

Some networks employ a limited number of masternodes or elected stakers, such as Dash and Cosmos, respectively, which reduces decentralization in favor of security in the former case and scalability in the latter. Nevertheless, these networks remain decentralized to a respectable degree.

Security

While the primary purpose of blockchain consensus protocols is security, there are still serious challenges to providing it. 

As mentioned earlier, 51% attacks present a major threat for blockchain networks. Proof of Work blockchains are especially vulnerable, with an average amount of $1.9 million stolen per attack. As the website Crypto51 shows, a one-hour 51% attack can be executed with less than $100 on a number of cryptocurrencies with market caps in excess of $1 million. 

Although other blockchain consensus protocols aren’t nearly as susceptible to 51% attacks, each variety of protocol faces its own set of security vulnerabilities. For example, Proof of Stake blockchains have to guard against “Fake Stake” attacks and “Nothing At Stake” attacks. Oftentimes, blockchain networks have to develop modified consensus protocols or adopt a Blockchain Security Service solution that adds an extra layer of security.

While providing ironclad security is difficult on its own, it’s even more challenging to do without sacrificing decentralization or scalability in the process.

Scalability

All blockchain networks want to be able to scale without limitation. Of course, this currently isn’t practical.

In 2020, achieving high scalability requires accepting tradeoffs in either decentralization or security. Centralized systems can be secure and can scale easily, but they aren’t decentralized at all. Conversely, some decentralized systems can scale but it’s often at the cost of security. Other decentralized systems are ultra-secure but can’t scale.

Take Proof of Work blockchains like Bitcoin, for example. Using Proof of Work hash puzzles that are easier to solve leads to increased scalability but decreased security. In contrast, using hash puzzles that are harder to solve leads to increased security but decreased scalability.

Some blockchain consensus protocols, such as Tendermint BFT engine, provide fast finality and have extremely fast block times, both of which promote scalability. However, consensus protocols like this are somewhat centralized, as they only allow a small group of 100 nodes to become stakers (often called validators). The rest of the nodes in the network must delegate their coins to an elected staker.

Most Popular Blockchain Consensus Protocols

At this point, we’ve covered why blockchain consensus protocols are so important and what functionality they seek to provide to decentralized networks. In particular, consensus protocols provide security to the network while also trying to maintain a respectable level of decentralization and scalability. 

Now, with all of that behind us, let’s take a look at a few prominent approaches to meeting these rigorous demands. We’ll cover the three most utilized consensus blockchain protocols to date: Proof of Work (PoW), Proof of Stake (PoS) and Delegated Proof of Stake (DPoS).

Proof of Work

Proof of Work is a phrase used to describe any system that requires computers to exert computational effort in order to complete a process or task. This extra computational effort results in a solution, which is then presented and verified before the desired process or task is executed.

So, what does this look like for a blockchain network? Through the process known as cryptocurrency mining, all of the nodes in a Proof of Work network try to solve a cryptographic puzzle and find a number called a “nonce.” To put it very simply, the first computer to find the right nonce solves the puzzle, unlocks the block, adds it to the blockchain, and wins some coins for their efforts. 

Proof of Work generally relies upon miners using hardware mining rigs competing to solve these complex mathematical puzzles. Depending upon a PoW network’s hashing algorithm, mining typically involves ASICs,  FPGAs, GPUs, or CPUs. While miners generally need to invest in expensive mining equipment to participate in validation, miners do not need to own any of a blockchain’s coins prior to joining the network.

In 2009, Bitcoin became the first blockchain network to implement Proof of Work as its blockchain consensus protocol. Other examples of popular Proof of Work blockchains include Ethereum, Litecoin, Monero, and Zcash.

Proof of Stake

In the most basic terms, Proof of Stake is a method of securing a blockchain network by allowing people who hold that blockchain’s coins to validate transactions and blocks. 

Through this process, known as staking, stakers are able to earn additional coins (known as block rewards) proportional to the amount staked. Those with more coins at stake typically validate more blocks and thus earn more block rewards.

Since these stakers hold the coin, they have a financial interest in keeping the network honest and making sure no fraudulent transactions are validated. After all, if the network permitted fraudulent transactions, users would find the currency useless, causing a selloff and a massive decline in value. Moreover, in most Proof of Stake systems, bad actors who are caught verifying fraudulent transactions don’t receive block rewards and can lose staked funds.

Unlike Proof of Work, Proof of Stake is considered to be accessible to more people. This is because stakers don’t need to buy and install specialized hardware to participate in validation. Instead, they can actively participate in network consensus with personal computers or mobile devices that support staking wallets. However, in contrast to Proof of Work, you do need to own a blockchain’s coins before participating in validation on a Proof of Stake network.

In 2012, Peercoin became the first blockchain network to implement Proof of Stake (PoS) as its consensus mechanism. Other examples of Proof of Stake blockchains include Stellar, Dash, Neo, and Qtum. Ethereum is working towards a migration from Proof of Work to Proof of Stake.

Delegated Proof of Stake

Delegated Proof of Stake (DPoS) is quite similar to pure Proof of Stake (PoS) in that all users can earn block rewards by staking coins or tokens. However, it is still a distinct protocol with its own unique characteristics. The major difference is that DPoS requires coin holders to vote for “delegates,” who are then responsible for validating transactions. 

This blockchain consensus protocol reduces the number of potential validators on a network. Frequent voting theoretically gives any node an opportunity to become a validator, but it realistically takes some time to build a reputation and gain enough support to get elected by delegates. Most implementations of DPoS generally have increased scalability over PoW and PoS, with the drawback of higher centralization and decreased censorship-resistance.

In 2015, BitShares became the first blockchain to implement DPoS. Other prominent examples of DPoS blockchain networks include EOS, Binance, Cosmos, TRON, Cardano, Tezos, Lisk, and Steem.

Other modifications to the original Proof of Stake mechanism include Liquid Proof of Stake (LPoS), Bonded Proof of Stake (BPoS), and Hybrid Proof of Stake (HPoS).

Other Blockchain Consensus Protocols

It’s important to note that a bevy of protocols for blockchain consensus have emerged over the past several years. Many offer promising solutions but still aren’t as commonly used. 

For instance, Proof of Elapsed Time (PoET) was developed by Intel in 2016 and aims to improve consensus on permissioned, centralized blockchains. PoET can be selected as a consensus mechanism on Hyperledger Sawtooth.

Proof of Burn (PoB) aims to reduce the energy consumption of Proof of Work blockchains. PoB requires validators to send coins to a verifiably unspendable address, known as an “eater address.” Counterparty (XCP) is the most prominent example of PoB.

Hashgraph is an asynchronous Byzantine Fault Tolerance consensus protocol used for directed acyclic graphs (DAGs). Hashgraph was initially released in 2017 and currently supports consensus for Hedera Hashgraph (HBAR).

Blockchain Consensus For Smart Chains

Komodo is a multi-chain platform that provides technology for launching independent, composable blockchains called Smart Chains. These Smart Chains are independent in that each has its own networks, currency, and consensus rules. There is no forced reliance on the Komodo blockchain or KMD coin. Transaction fees are always paid in each Smart Chain's native currency.

When you launch a Smart Chain with Komodo's technology, you can customize your blockchain consensus rules. You can choose Proof of Work, Proof of Stake, or a combination of the two.

In addition, Komodo gives projects the option to level-up to Bitcoin-level security with the Delayed Proof of Work (DPoW) security feature. Other optional security upgrades include Adaptive Proof of Work (APoW), a variation of pure Proof of Work that prevents Difficulty Stranding Attacks, and the Dilithium digital signature scheme, which enables the creation of a quantum-secure blockchain.

If you'd like to learn more about blockchain technology and keep up with Komodo's progress, you can join Komodo's Community Portal and sign up for the monthly newsletter.

Begin your blockchain journey with Komodo today.