paint-brush
Consensus Mechanisms Explained: PoW vs. PoSby@turnerschumann
23,953 reads
23,953 reads

Consensus Mechanisms Explained: PoW vs. PoS

by Turner SchumannApril 5th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

A central aspect of <a href="https://3iq.ca/3iq-research-group/blockchain-basics-2/" target="_blank">blockchain technology</a> is the distributed ledger, which contains a record of all previous transactions. It is called a <em>distributed</em> ledger because it is not stored in a central location, rather it is stored across a network of computers across the world. Key to the operation of a distributed ledger is ensuring the entire network collectively agrees with the contents of the ledger; this is the job of the consensus mechanism.

People Mentioned

Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Consensus Mechanisms Explained: PoW vs. PoS
Turner Schumann HackerNoon profile picture

A central aspect of blockchain technology is the distributed ledger, which contains a record of all previous transactions. It is called a distributed ledger because it is not stored in a central location, rather it is stored across a network of computers across the world. Key to the operation of a distributed ledger is ensuring the entire network collectively agrees with the contents of the ledger; this is the job of the consensus mechanism.

Behind many cryptoassets, there is a consensus mechanism. The purpose of a consensus mechanism is to verify that information being added to the ledger is valid i.e. the network is in consensus. This ensures that the next block being added represents the most current transactions on the network, preventing double spending and other invalid data from being appended to the blockchain. In addition, the consensus mechanism keeps the network from being derailed through constant forking.

There have been a number of different consensus mechanisms devised, each with their own pros and cons. They all serve the same core purpose as described above, but differ in methodology. The primary difference between varying consensus mechanisms is the way in which they delegate and reward the verification of transactions.

The most popular blockchain consensus mechanisms are the Proof of Work (PoW) and Proof of Stake (PoS) systems. This article will be focussed on describing and comparing PoW vs PoS, note however, that a number of other systems exist, such as Delegated Proof of Stake (DPoS) and Federated Byzantine Agreement (FBA).

Proof of Work (PoW)

The Proof of Work concept existed before cryptoassets. The idea was first published by Cynthia Dwork and Moni Naor in a 1993 journal article, however, it wasn’t until 1999 the actual term “Proof of Work” was coined by Markus Jakobsson.

In Satoshi Nakamoto’s Bitcoin White Paper, it is theorized that the only way to overpower the network strength of Blockchain networks is through a 51% attack (Read more about 51% attacks in Blockchain Basics) The Bitcoin White Paper proposed the use of a Proof of Work system to prevent an entity from gaining a majority control over the network. Applying Proof of Work in this manner is arguably the central idea necessary for Bitcoin, as it allows for trustless and distributed consensus.

How Bitcoin mining works:

  1. A group of transactions are bundled into a memory pool (mempool).
  2. Miners verify each transaction in the mempool is legitimate by solving a mathematical puzzle.
  3. The first miner to solve the puzzle gets rewarded with newly minted bitcoin (the block reward) and network transaction fees.
  4. The verified mempool, now called a block, is attached to the blockchain.

The type of puzzle miners must solve has a few key features that define the Proof of Work system:

  • The puzzles are asymmetric, meaning it is difficult for miners to solve but the correct answer is easily verified by the network.
  • The puzzles have no skill involved, they require brute force. This ensures certain miners do not gain an unfair advantage over others. The only way for a miner to improve their odds of solving a puzzle is to acquire additional computational power; something that is very energy and capital intensive. Read about the computational power required to gain majority control of the Bitcoin Blockchain in Blockchain Security.
  • The puzzle parameters are periodically updated in order to keep the block time consistent. The Bitcoin protocol, for example, has a block generation target time of 10 minutes. So for example, if the average block time over two weeks has decreased to below 10 minutes, the network will automatically increase the difficulty. This, in turn, increases the number of calculations and the average time required for the puzzle to be solved.

Proof of Stake (PoS)

Proof of Stake systems have the same purpose of validating transactions and achieving consensus, however, the process is quite different than in Proof of Work systems. With Proof of Stake, there is no mathematical puzzle, instead, the creator of a new block is chosen in a deterministic way based on their stake. The stake is how many coins/tokens one possesses. For example, if one person were to stake 10 coins and another person staked 50 coins, the person staking 50 coins would be 5 times more likely to be chosen as the next block validator.

A key advantage of the Proof of Stake system is higher energy efficiency. By cutting out the energy-intensive mining process, Proof of Stake systems may prove to be a much greener option compared to Proof of Work systems. Additionally, the economic incentives provided by Proof of Stake systems may do a better job of promoting network health. Under a Proof of Work system, a miner could potentially own zero of the coins they are mining, seeking only to maximize their own profits. In a Proof of Stake system, on the other hand, validators must own and support the currency they are verifying. These advantages and more will be discussed in detail below.

Another key distinction between Proof of Stake and Proof of Work is that under Proof of Stake there is no new coin creation (mining). Instead, all of the coins are created in the very beginning. This means the validators must be fully rewarded through transaction fees as opposed to newly minted coins.

Comparing Proof of Work and Proof of Stake

Cost and Energy

Proof of Stake systems have the potential to be a much more cost-efficient and green alternative to Proof of Work systems. The computational power required to operate a Proof of Work system is very energy intensive. The Bitcoin network, for example, requires an annual energy consumption comparable to that of Colombia (57.6 TWh annually)1. In addition, the competitive nature of mining means an increasing amount of money is being invested into more powerful mining computers, which in turn will require more and more energy to be supplied.

1. Data as at April 3rd, 2018. Retrieved from https://digiconomist.net/bitcoin-energy-consumption

Proof of Stake systems do not require mining or the accompanying energy hungry processing power. As a result, Proof of Stake systems require a mere fraction of the energy to run. The lower energy costs also make the role of validating more accessible to anyone in the community, whereas the role of mining is becoming increasingly reserved for large-scale operations.

Security

Proof of Stake systems in crypto is relatively newer than Proof of Work systems and it still hasn’t seen the same level of adoption. As a result, it hasn’t been as rigorously tested as Proof of Work systems and a few potential security risks have been identified.

Constant forking of a blockchain is not healthy for a network and leads to instability. In Proof of Work systems, if a blockchain is forked, miners will have to make the decision to continue supporting the original blockchain or switch to the newer forked blockchain. In order to support both sides of the fork, a miner would have to split their computational resources between the two. In this way, Proof of Work systems naturally discourages constant forking from occurring through an economic incentive.

Proof of Stake systems, on the other hand, do not inherently discourage forking. When a blockchain forks, a validator will receive a duplicate copy of their stake on the newly forked blockchain. If a validator signs off on both sides of the fork, they could potentially claim twice the amount of transactions fees as a reward and double spend their coins; this is known as the ‘nothing at stake’ problem. A participant is not required to increase their stake in order to validate transactions on multiple copies of a blockchain, thus, there is no economic incentive preventing this bad behavior.

A potential solution to the ‘nothing at stake’ problem is to impose a deposit that will be locked for a period of time. Ethereum plans on switching from a Proof of Work system to a Proof of Stake system sometime in 2018, with a proposed consensus protocol called Casper. Casper will utilize a deposit solution in which validators are required to submit a minimum deposit in order to participate. If the protocol determines a participant has violated a set of rules, such as signing off on multiple forks, the deposit will be confiscated.

Centralization

An increasing concern with blockchain networks utilizing Proof of Work systems is the risk of centralization. As noted earlier, the role of mining in Proof of Work systems is becoming increasingly reserved for large-scale operations. Control of blockchain networks is moving from the community at large to fewer and fewer hands, contrary to the decentralized ethos of most cryptoassets.

Proof of Stake systems potentially provides a more fair solution. The amount of network control a participant can gain in a Proof of Stake system is directly proportional to how much they invest. If one participant invests ten times more than another participant, they will receive ten times the amount of control. On the contrary, under Proof of Work systems, if a miner invests 10 times more into equipment than another, they will actually receive more than 10 times the computational power. This comes as a result of bulk purchasing deals and the increased efficiency of high-end equipment. As a result, it is becoming increasingly less profitable and more difficult for individuals to compete against large mining farms.

Reducing centralization of the entities in control of validating transactions is fundamental to the distributed architecture of a blockchain network; this is why the consensus mechanism plays such an integral role. A properly functioning consensus mechanism is necessary in order to maintain the trustless, immutable, and distributed nature of any blockchain network.

References:

Castor, A. (2017, May 17). A (Short) Guide to Blockchain Consensus Protocols. Retrieved from:https://www.coindesk.com/short-guide-blockchain-consensus-protocols/

Rosic, A. (2017). Proof of Work vs Proof of Stake: Basic Mining Guide. Retrieved from: https://blockgeeks.com/guides/proof-of-work-vs-proof-of-stake/

Manning, J. (2016). Proof-of-Work Vs. Proof-of-Stake Explained. Retrieved from: https://www.ethnews.com/proof-of-work-vs-proof-of-stake-explained

Hertig, A. (2017, November 2). Where’s Casper? Inside Ethereum’s Race to Reinvent its Blockchain. Retrieved from:https://www.coindesk.com/ethereum-casper-proof-stake-rewrite-rules-blockchain/

Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. Retrieved from: https://bitcoin.org/bitcoin.pdf

Digiconomist. (2018). Bitcoin Energy Consumption Index. Retrieved April 3, 2018 from: https://digiconomist.net/bitcoin-energy-consumption

WorldData.info. Energy consumption in Colombia. Retrieved April 3, 2018 from: https://www.worlddata.info/america/colombia/energy-consumption.php