Enterprise Blockchain: Consensus Algorithms
Blog: The Tibco Blog
Achieving consensus can be difficult. Whether it is planning a family vacation, or solving the Star Wars vs. Star Trek debate, reaching agreement across a number of (potentially) distributed individuals can be tough. The same is also true in blockchain, as the lack of central authority and involvement of anonymous participants (especially with public blockchains like Bitcoin) introduces various complexities when trying to determine if transactions are valid, and to get the network to an agreed-upon state.
In the blockchain world, the techniques utilized to achieve agreement and make the network harder to attack are typically referred to as consensus algorithms. Various algorithms exist, and debates continue as to which algorithm is best, even when one also considers permissioned or private blockchains (where participants are typically known, and the risk of malicious behavior is usually smaller). Through this blog, we will explore a few of the common algorithms and approaches, without focusing on a single blockchain technology stack (although certain algorithms may only be implemented by one or two technologies) or deployment topology.
No conversation around consensus protocols would be complete, of course, without first mentioning BFT (Byzantine Fault Tolerance). Many articles exist which describe the basic premise behind this concept, which is typically described as and related to the Byzantine Generals problem. Practical Byzantine Fault Tolerance (PBFT / Hyperledger Fabric), Federated Byzantine Agreement (FBA / Stellar), and Delegated Byzantine Fault Tolerance (dBFT / Neo) are all protocols that have been introduced in an attempt to achieve consensus in this distributed, non-centralized world. Research in this area has subsequently led to various other related approaches, with the overall goal being to achieve consensus in an environment where machines may fail at any time or behave maliciously.
Following BFT, the first algorithm to mention is referred to as Proof of Work (PoW). Probably made most popular by the Bitcoin network, proof of work essentially involves a mathematical “guessing game” where miners utilize specialized hardware to derive a “nonce” via trial-and-error. Once this is value is determined, the winning miner adds its block to the network, and the process starts again across all miners with a new block and transactions. Changing existing blocks becomes very difficult as the ledger grows longer, as it would be computationally very expensive to re-compute the subsequent blocks at a rate faster than the rest of the network. The complexity of this “guessing game” is also adjusted by the network such that new blocks are mined approximately once every 10 minutes (in the case of Bitcoin).
This process, however, is argued to be computationally expensive and “wasteful”, especially when it comes to the amount of electricity required to operate the mining pools and specialized hardware (ASIC). This is one of the reasons why China has (until recently) dominated the location of these mining pools, as low-cost electricity was readily available (regulation changes, however, may push these mining pools out of China). Many studies and estimates have been made to look at the amount of power required across the globe by bitcoin mining (e.g. popular reports by Digiconomist or a recent report by Morgan Stanley, which estimates that Bitcoin’s power demand will equal the energy consumed in a year by the entire country of Argentina), but it is very hard to validate the exact number. Regardless, it is obvious that this approach is not always the best solution, and thus there is a large amount of research being conducted to see how the security of a blockchain network (especially in a public context) can be maintained with perhaps a more efficient protocol.
A second set of approaches are typically categorized as Proof of Stake (PoS). There are many variations that fall within this category, and the movement of the Ethereum network towards one of these variations (often referred to as “Casper”) has also made this approach fairly well known. With PoS, blocks are not just created by miners — the originators or leaders of block creation are selected based on the size of the stake they have in the network. This reduces energy consumption as the computational demands associated with PoW are removed, but there is still a risk that computational power may be used to bias the leader election process. Cardano, which introduced a PoS algorithm called Ouroboros claims, however, to have the first PoS-based protocol that is “provably secure”, and shows some promise.
Proof of Spacetime (PoSt) is in some ways similar to PoW in that mining power is proportional to computational resources. However, in this case, the computational resource is not ASIC or GPU processing power, but active storage (see Filecoin as an example). PoSt may be used to determine if certain data is being stored for a period of time, and this approach may be combined with Proof of Replication (PoRep) to determine if data has been replicated to unique storage. PoSt and PoRep utilize expensive resources in this context (storage), but the resources are not “wasted” as in PoW.
Tangle, part of the IOTA IoT-focused “ledger of things” is a “blockless distributed ledger” that utilizes a directed acyclic graph (called the “tangle”) for storing transactions. Consensus in this model is quite different, as the goal of this approach is to enable IoT devices to communicate and “pay” one another (via micropayments) for capability or services. Since these payments may be quite small, having onerous transaction fees does not make sense, and thus the goal of the protocol is to allow for the validation of transactions without having to pay transaction fees to miners. To achieve consensus in Tangle, a participant must approve two other transactions before they can send a transaction. This approval is done via a type of PoW algorithm (not as computationally expensive or time consuming as with Bitcoin), and approved transactions are forwarded over the network where they may be approved by other participants. This process continues until the transaction is determined to be fully confirmed. This process can (in theory) happen quickly as the number of transactions grows and can greatly reduce the costs associated with achieving transaction consensus.
At this point, we will stop while we are ahead, or this blog could turn out to be many pages! As one can see, the area of consensus is a crowded world. As research continues, expect to see more algorithms that attempt to solve the problem of consensus, while achieving higher levels of performance and scalability. Also note that we are also seeing “pluggable” consensus algorithm capabilities, which allow creators of (typically) permissioned or private blockchains the ability to pick the model that best suits their needs. The list above is by no means an exhaustive list, but hopefully this gives you a bit more clarity into the world of blockchain consensus.