Consensus Algorithms

BlockstreetHQ Team
Blockstreet HQ
Published in
5 min readJul 11, 2018

The advantages of blockchain technology are surprisingly straightforward on the surface. They are public, which means it can be easier to ensure that they are transparent and audited. They are also decentralized, which eliminates the potential for single points of failure. A distributed database is much harder to hack or manipulate. However, the public, decentralized nature of the blockchain also means that any entity, individual, or party can attempt to add information to the database.

This is what makes the concept of “consensus” so important. Since the trustworthiness of actors on the network cannot be accounted for, all new information has to be reviewed and verified before being accepted. In this article, we’ll go over two of the most widely utilized methodologies for arriving at a consensus state: Proof of Work (PoW) and Proof of Stake (PoS).

What is Proof of Work?

Proof of Work is the requirement of solving complex mathematical equations in order to create blocks on the blockchain (refer back to Transactions & Mining if this process doesn’t sound familiar).

Mining serves to verify the legitimacy of a transaction (guarding against “double-spending”) as well as to create new digital currency at an algorithmically determined rate in the form of rewards for miners who perform the verification and creation of blocks.

All the miners in the network race to be the first to solve the mathematical problem. Once a miner emerges victorious, they announce their achievement to the network and are rewarded with a predetermined amount of cryptocurrency (created by the protocol itself).

As more miners (and thereby more computing power) is added to the network, the protocol adds a greater level of “difficulty” to the mining process, which in turn increases the average number of calculations it takes to add a new block. This also pushes up the cost of block creation, forcing miners to become more efficient in order to stay profitable. Difficulty is re-adjusted periodically by the protocol to set the average block creation time to 10 minutes.

While Proof of Work was the de facto methodology for propelling blockchains everywhere, Ethereum developers in particular are pondering a switch to a different consensus system called Proof of Stake.

What is Proof of Stake?

The Proof of Stake system forgoes the mining process and instead operates by electing users to create blocks by putting up their own cryptocurrency as a “stake.” Blocks are forged by these users (referred to as forgers) in exchange for transaction fees (rather than “mining rewards”). This system is typically deployed in a digital currency ecosystem where all of the currency units are created at launch and the number is capped.

To forge new blocks in this system, a forger will put up their own currency as the “stake” before participating in the validation process. If they validate fraudulent or incorrect transactions, they lose their stake in addition to losing their chance to collect any transaction fees from the resultant block. This ensures that there is a natural incentive for block forgers to validate the right transactions.

As the Proof of Stake system does not have a built-in method for distributing coins initially, many cryptocurrencies that elect to use it begin with ICOs (in which portions of the existing currency pool are sold to investors and stakeholders). Others start off with a Proof of Work system with plans to adopt Proof of Stake at a later date.

Proof of Stake: Selecting Users for Block Creation

Selecting which user creates the next block in a Proof of Stake system is vital for a healthy, functional blockchain. Simply selecting users with large account balances would allow high net worth forgers to effectively control the process, which is why selection is typically randomized or based on parameters that have less to do with overall account balance and more to do with creating reasonable parity of opportunity.

Randomized block selection utilizes a formula which uses a blended metric involving low hash values and the size of a user’s stake. Nodes are usually able to predict who will be selected, as stake size information is visible to the public. Per their whitepapers, Nxt and BlackCoin are two cryptocurrencies that utilize a randomized block selection method.

Coin age based selection uses a metric called “coin age” to determine the next forger. This metric is derived by multiplying the number of coins at stake by the number of days the coins have been held. Coins that have been unspent or unstaked for 30 days or more can be used to compete for the right to forge. Once a stake has been used, the coins in that stake have their “coin age” reset to 0. The longer a forger fails to create a block, the greater their chance at success becomes. Additionally, there is a maximum window of 90 days for block creation (which prevents users with very old and large stakes from becoming the de facto controllers of the blockchain).

Typically, proof of stake coins set a target interest rate that users can expect to earn from staking their coins — these are the transaction and block creation fees. The fact that these systems are usually lower-cost (in terms of energy and hardware) leads to greater decentralization, as the barriers to entry are lower, which encourages more individuals and entities to run nodes.

Closing Thoughts

Consensus mechanisms were the answer to the Byzantine Generals’ Problem and the foundation of Byzantine Fault Tolerant systems. Proof of Work and Proof of Stake are just two of the implementations of a decentralized peer-to-peer system that take advantage of these mechanisms.

As decentralized ledgers and systems become more widely utilized and adopted, we can be sure that new consensus algorithms will be developed based on needs and other arising parameters. It will no doubt be interesting to follow the progress made by developers to continue to create better, more efficient systems — especially as energy and hardware considerations become a more pressing concern due to the perceived impact on the environment.

--

--