Comprehensive Review of Proof-of-Work Consensus in Blockchain

  • Proof of Stake (used by Ethereum)
  • Byzantine Fault Tolerance (used by Hyperledger)

What Is a Consensus?

A consensus in a blockchain is the process by which a network of mutually distrusted nodes reaches an agreement on the global state of the chain of blocks. In blockchain, transactions or data are shared and distributed across the network. Every node has the same copy of the blockchain data. Consensus allows all of the network nodes to follow the same rules to validate transactions and add new blocks to the chain, and therefore allows it to maintain uniformity in all of the copies of a blockchain.

Proof of Work

Proof of work, also referred to as PoW, is the most popular consensus algorithm used by blockchain and cryptocurrencies such as Bitcoin and Ethereum, each one with its own differences.

How PoW Works

In general, PoW is like a race between miners to solve a cryptographic puzzle; upon solving the puzzle, they win the chance to add the block to the chain and get rewarded. As shown in the following screenshot, miners collect all pending transactions from the decentralized network and compete with each other to solve the puzzle. Whoever solves the puzzle will generate a block and push that block into the network for verification from other nodes, after which, the other nodes can add that block to their own copy of the blockchain:

Targets and Difficulty

A target is a blockchain-specific 256-bit number that the network sets up for all miners. The SHA-256 hash of a block’s header — the nonce plus the rest of the block header — must be lower than or equal to the current target for the block to be accepted by the network.

Incentives and Rewards

The winner of the cryptographic puzzle needs to expend huge energy and crucial CPU time to find the nonce and win the chance to create new blocks in the blockchain. The reward for such actions depends on the blockchain itself. In a Bitcoin blockchain, the winner will be rewarded with Bitcoin, the cryptocurrency in the Bitcoin blockchain.

Double-Spend Issues

Satoshi’s original intention in using a PoW mechanism is to solve double-spend issues and ensure the integrity of the global state of the Bitcoin blockchain network. Let’s say Alice sends 10 BTC to Bob, and at the same time or later on she pays Catherine the same 10 BTC. We could end up with the following three situations:

  • Both transactions are submitted simultaneously and both go into the unconfirmed pool of transactions. In this case, only the first transaction gets a confirmation and will be added in the next block. Her second transaction will not be confirmed as per validation rules.
  • Both get confirmed and are added into competing blocks. This happens when miners take both transactions from the pool and put them into competing blocks. The competing blocks form a temporary fork on the blockchain. Whichever transaction gets into the longest chain will be considered valid and spent, and the other one within the block on the short chain will be recycled. When it is reprocessed, it will be rejected since it is already spent. In this case, it may take a few blocks to get the other one recognized as the double-spent one.

Advantages and Disadvantages of PoW

However, there are a few drawbacks with the PoW algorithm, thanks to the economic cost of maintaining the blockchain network safety:

  • Vulnerability: PoW consensus is vulnerable to 51% attacks, which means, in theory, dishonest miners could gain a majority of hashing power and manipulate the blockchain to their advantage.
  • Centralization: Winning a mining game requires specified and expensive hardware, typically an ASIC type of machine. Expenses grow unmanageable, and mining becomes possible only for a small number of sophisticated miners. The consequence of this is a gradual increase in the centralization of the system, as it becomes a game of riches.

Additional Insights

As briefly discussed in the previous section, one of major barriers for widespread adoption of blockchain technology is its intensive use of resources. Luckily, the rapid development of Blockchain as a Service (BaaS) poses an ideal compromise to the problem at hand and Alibaba cloud Blockchain-as-a-Service (BaaS) is one of the solution.

Summary

By now, you have a better understanding of why consensus algorithms play a very vital role in the operation of a blockchain system. In short, in this article we explained what a consensus and the Proof of Work algorithm are. We also covered the nitty gritty of Proof of Work for adding a new block of data to the blockchain network. At the end, we discussed other topics like how Proof of Work was invented to solve double-spend issues and what are main advantages and disadvantages of using Proof of Work.

About the Author

Matt Zand is a serial entrepreneur and the founder of 3 tech startups: DC Web Makers, Coding Bootcamps and High School Technology Services. He is a leading author of Hands-on Smart Contract Development with Hyperledger Fabric book by O’Reilly Media. He has written more than 100 technical articles and tutorials on blockchain development for Hyperledger, Ethereum and Corda R3 platforms. At DC Web Makers, he leads a team of blockchain experts for consulting and deploying enterprise decentralized applications. As chief architect, he has designed and developed blockchain courses and training programs for Coding Bootcamps. He has a master’s degree in business management from the University of Maryland. Prior to blockchain development and consulting, he worked as senior web and mobile App developer and consultant, angel investor, business advisor for a few startup companies. You can connect with him on LI: https://www.linkedin.com/in/matt-zand-64047871

Original Source:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store