Understanding Consensus Models
There is a multitude of mechanisms used in peer-to-peer sharing protocols to maintain a valid history, some more common than others. In this document, we review a wide range of algorithms so you can familiarize yourself with many different kinds of consensus mechanisms.
For simplicity, we will use the term "agreement" when referring to the underlying algorithm or mechanism of consensus in peer-to-peer protocols, including but not limited to Blockchains.
Now, it is important to take note of the progression and improvement of various agreement systems for distributed networks. Many are variations on previous existing and tested solutions, and every single one most definitely borrows some of its core design from past works.
Before we dive into the various categories and break them down in detail, let us iterate quickly the problem we're trying to solve with all of these implementations.
The problems that occur most often in a network of decentralized peers, where the power structure can be split between its members, are often referred to as being solved through Byzantine Agreement (BA). This nomenclature comes from a popularized decision-making problem that arises when any number of soldiers (or peers) in an army (or network) have the option of acting arbitrarily and potentially cause harm to other members of the group - the General's Problem. A network which can successfully prevent and heal from issues produced by bad actors and unavailable peers is said to be Byzantine Fault Tolerant (BFT). As many of your know, Bitcoin is claimed to be the first practical application of such category in modern times.
Before exploring agreement styles, one should be familiar with the general flow of decentralized ledgers like Blockchains. Typically, accounts have a pair of keys, one used to receive coins and the other to send them. The members of the network can create accounts and are connected to other peers. The peer's role is to propagate data, like transactions, to other peers. Peers can optionally participate in creating blocks of transactions which could be added to the chain, depending on agreement. The Blockchain is the series of blocks which are said to contain the official transaction history, is immutable and distributed.
The various kinds of agreement that come with different protocols are in most cases results of trade-offs and optimisations regarding decentralisation, speed and accuracy.
There are multiple consensus models used in various blockchain networks. The two primary functions of the consensus model are to prevent any one party from maliciously affecting the blockchain, and also to control how often new coins are found, or “mined.” The consensus model is also the mechanism used to determine who has the power to add new transaction groups, otherwise known as blocks, to the blockchain. Lastly, it’s used to determine the method by which everyone agrees the blockchain is correct and accurate. Consensus models are designed to operate in a trustless environment. This means that if party A and party B both participate in storing and adding to the blockchain, party A does not need to trust that party B’s activities are valid and correct because they can cryptographically validate the work done by party B on their own, and vice versa.
Also known as POW, Proof-of-Work is the consensus model used by Bitcoin. In POW, the machines responsible for adding blocks to the blockchain must attempt to solve a complex mathematical problem. The purpose is not to arrive at the answer for the sake of the answer itself. The true purpose of the mathematical problem is to control how often blocks can be added to the blockchain, and make it increasingly difficult for any one machine to affect the blockchain. This is because there are new coins attached to each block after the problem is solved, and the mathematical problem prevents these new coins from being created too quickly or too slowly. Moreover, there is a string of mathematical answers associated with each block, and they relate to one another. This means that if a bad actor wanted to fraudulently alter past blocks, they would have to cryptographically solve that block’s problem and all subsequent blocks up to and including the present block, all before someone else solves the present block. This is extremely difficult (astronomically difficult) and becomes exponentially more challenging the farther back in time you go to attack the data. The reason this is so difficult is because the complexity of the mathematical problem goes up as more machines join the network to solve the mathematical problem and receive the new coins in that block. The consensus algorithm handles the difficulty autonomously- in Bitcoin’s case, adjusting every two weeks.
If you understood the concepts behind Proof-of-Work so far, than it should be easy to conclude that as more machines join the network to solve problems and add blocks, it makes the blockchain more secure and harder to crack. This is an intrinsic goal of Proof-of-Work: to have as many machines as possible trying to solve the mathematical problems. More machines make for a more robust network, and fewer machines make the network weaker and more susceptible to attack. The computational might of a POW network is measured by a term called “hashrate,” or how many attempts can be made at solving a mathematical problem per second. Bitcoin is the largest POW network, boasting about 31,722,971 Terahash per second as of May 2018 according to Blockchain.info. Adjusting for date published and difficulty, that’s the hashpower of about 903 quadrillion XBox Ones according to this article.
Obviously, there are not 903 quadrillion Xbox Ones securing the network. These days, most machines responsible for maintaining and securing the network are computers with special processing chips called ASICs. They are much more efficient at dealing with Bitcoin-related processing tasks than a consumer PC or high-end graphics card.
It isn’t hard to guess that more machines hunting for Bitcoins on the network lead to more energy consumption, at least in the short term. According to a widely regarded website that tracks Bitcoin energy consumption, the Bitcoin network currently uses about the same energy as the entire Czech Republic, and growing daily. It sounds like runaway energy consumption that will need all Earth electricity somewhere within our lifetime. However, a concept called the “halving” curbs this. Every 4 years, the new Bitcoins created with each block reduce by half, which can also cut mining revenues in half. Thus, the machines trying to acquire new Bitcoins will have a few options. The first is for all operators in the world to unanimously agree to reduce their hashpower all at once, lowering the computational cost of finding new Bitcoins. This is not feasible because no one knows everyone else, so there is no one to negotiate with. The second option is to hope Bitcoin price increases 100%. This will retain the same profitability as before the halving occured. The problem with this option is a doubling in Bitcoins price will likely attract many new machines to the network as they join the “Gold Rush 2.0.” The final option is to reduce the electrical cost while maintaining the same hashrate. This leads to advancements in more efficient machines and renewable energy technology. Thus, while the POW consensus model does pose an energy issue at scale, in can also serve to further energy innovation.
Another miscellaneous hindrance with POW is long confirmation times. It’s remarkable to see something like Bitcoin change hands in only 10 minutes without a central clearing house involved. However, because of the sheer number of devices storing copies of the blockchain, a certain time frame is needed to “reach consensus,” or make sure that all nodes running the blockchain get an up to date copy every time a new block is produced. The more devices on the network storing the blockchain, the more leeway you need to give the network to reach consensus. Because of this, it can prove difficult to structure a POW blockchain that sends funds within seconds while retaining the highest security possible as well as keeping the ledger intact.
Some cryptocurrency projects interested in the technology dabbled with and eventually brought to existence a new consensus model designed from the ground up, called Proof-of-Stake, or POS. In the Proof-of-Stake consensus model, it is not the computational might of the machines working on transactions and solving hashproblems that matters, as is with POW. POS assigns weight and trust evenly to coin holders according to how many they have, AKA their “stake” in the network. That means if you are in control of 1% of the total coin supply, your “node,” or machine that runs the blockchain software, will on average be responsible for validating 1% of all blocks. Another way to illustrate the idea is that you have a 1% chance of validating the next block. This can come with a reward of transaction fees or even new coins as well.
POS comes in many flavors, as different development teams put their own spin on the concept. Some may have all coins that will ever exist minted in what’s called a “genesis block.” Others may mint a certain amount in the first block, and then issue new coins for each subsequent block up to a limit. Still others mint coins ad infinitum, causing a decaying inflation rate that never truly stops. Proof-of-Stake was designed to offer a few key advantages over Proof-of-Work. Because trust is based on coin ownership and not computational might, POS networks cost a micro-fraction of the energy that larger POW networks like Bitcoin require. As a general rule, a POS network has the potential to “reach consensus” sooner, resulting in faster transactions. Additionally, special hardware is most often not required, and POS nodes can run on standard computers and servers.
From a security and vulnerability standpoint, POS is interesting. For a POW network to retain a secure state, no one should control the majority of the machines running on the network. A failure to prevent majority control could result in what’s called a “51% attack,” during which a majority controller could maliciously affect the blockchain.
In POS territory, this attack would be characterized by a majority shareholder who is in control of 51% of the coins fraudulently modifying the ledger. For POS, ideally you want a lot of different people who don’t know each other holding random amounts of coins, and you don’t want one or two entities controlling the vast majority of coins. However, it should be noted that just because one person or a small group controls most coins, it does not mean attack is imminent. As they would have a sizable investment represented by their coins, and as an attack would bring catastrophe to their own coin value, they are economically disincentivized from executing such an attack.
Delegated Proof-of-Stake or DPOS is a consensus model that further enhances the benefits of POS. In this model, instead of individuals using wallet balances to determine whether their nodes forge blocks, a distributed collective of nodes called “delegates” control the ledger and validate the blocks. This opens doors to sizeable performance improvements, like transaction times, blockchain upgrade lead times, and block size modifications.
There is no limit to the number of delegates that can exist in a DPOS environment. Each provides a valuable service by validating transactions, maintaining a copy of the ledger, and protecting the integrity of the data and the network. However, not all delegates are authorized to validate new blocks and add transactions to the ledger. In DPOS, only a select few have this authorization- they are called “forging delegates.” In Ark’s case, the number of forging delegates is 51. These 51 delegates have the authorization to process transactions and add them to the ledger. However, to have a network used by so many to be controlled by so few goes against the decentralized nature of the blockchain concept itself. Because of this, all users of the network have a say in who is authorized to be a forging delegate, and who is not. This is done through a continuous voting process. The voting mechanism aspect of DPOS restores decentralization to the network.
Users of the blockchain who have wallets cast a vote for any delegate they choose, and the value of the users wallet is assigned as “weight” to the delegate. The 51 delegates with the highest vote weights are declared as the forging delegates. Because of the constant voting and unvoting of wallets, and transactions constantly moving between various wallets assigned to different delegates, the forging delegates are in a constant state of flux. It should be noted, though, that voting for a delegate does not send the wallet balance to the delegate nor does it lock up funds in some sort of escrow. The wallet holder is free to do as they wish with the funds while voting takes place. Moreover, votes remain active even when the user closes their wallet or shuts off their computer. For the service of processing new transactions and attaching new blocks to the ledger, a forging delegate is awarded 2 newly created Ark per block by the system. To maintain their position in the top 51, forging delegates often opt to share a portion of the newly created tokens with their voters. This sharing of token rewards is voluntary, for legal reasons.
What first comes to mind is the hypothesis that it is incredibly difficult or impossible to become a forging delegate. As a user, why vote for a delegate who is not forging, and therefore has no forging rewards to share? To understand that, one must first understand the delegate culture.
Forging delegates tend to share around the same percentage of forging rewards with voters to remain competitive. What tends to happen then is a choice between, for example, two delegates who offer the same or very similar reward benefits. Delegates are people or teams of people who provide their time and support to the community as well as run nodes. Thus, voters then tend to choose delegates who are contributing more to the community as a whole, and avoid delegates who grow stagnant or fail to deliver on their promises.
It usually isn’t instant, but this phenomenon is well documented since Ark’s mainnet launch in March of 2017. This community report outlines more information on delegate history. As more voting weight is secured amongst the most active delegates, and as more new and exciting delegates enter the space with plans to further improve the community, new delegates reach forging status and absentee delegates slowly drop out.
Conclusion and Considerations
If you have made it this far in this piece, it should be apparent that explaining blockchain technology can meander. To describe concept A, concepts B and C must be mentioned, each themselves needing to be described by further mentioning concepts C & D and E & F respectively- understanding blockchain technology is a rabbit hole. Indeed, you may possibly even have more questions than answers at this point. However, with any luck, this piece has guided you to make your next question the right question.