POW vs. PoS: a comparison of two blockchain consensus algorithms
The proof of work (POW) consensus algorithm is the most commonly used in the blockchain technology. Both Bitcoin and Ether, the two most famous cryptocurrencies, use it. However, Ethereum, the underlying protocol of Ether, plans to transition to the proof of stake (PoS) algorithm as part of their development roadmap. This will be a project of high significance and the crypto enthusiasts are eagerly debating the POW vs. PoS comparison.
The importance of blockchain consensus
The two most important promises of blockchain are decentralization and immutable record. It’s a distributed database that the computers on the network, called ‘nodes’, maintain in a shared manner. All nodes are complete ledgers, i.e. they have the entire transaction history in the blockchain. Hence the blockchain technology is also called ‘distributed ledger network’ (DLT). The network can’t be destroyed by taking out any central server.
Block records, called ‘blocks’, are linked via a protocol program, and no existing block can be deleted or modified. Adding a new block is the only way to update blockchain, and any node can do so without any central authority.
If a node disregards the predefined standards and creates a block then the other nodes will ignore it. However, if the non-compliant node continues to create blocks in contravention of the standards and a few other nodes also start creating blocks on top of the non-compliant blocks, then a dispute will arise in the community. The community can choose a hard fork and take away the state of the network before the dispute arose, however, frequent hard forks impact the stability of the network. A consensus mechanism is needed to prevent such non-compliant nodes causing frequent hard forks.
There can also be malicious nodes overpowering the other nodes of the network by using the ‘distributed denial of service’ (DDoS) attack. Such nodes can trigger false transactions, for e.g. ‘double-spend’ i.e. spending the same cryptocurrency twice. The consensus mechanism is required to guard against this.
What is the POW algorithm?
Cynthia Dwork and Moni Naor had first conceptualized POW in 1993, although Markus Jakobsson had given the name in 1999. Bitcoin is the most famous implementation of POW and we will use it to explain the concept.
Transactions in the Bitcoin blockchain are grouped in a memory pool called ‘mempool’ while a block is created every 10 minutes. Every transaction in mempool needs verification, and ‘miners’ do it. The transaction verification process is called ‘mining’.
The Bitcoin user requesting the transaction provides the transaction data to the miner who then proceeds to verify the transaction and includes it in the next available block. However, to include the transaction in the next block the miner needs to know the cryptographic hash value of the last recorded block and that’s hidden from everyone. This hash value must be referenced for creating a new block.
To find the hash of the last block the miner must try one number after another in a show of brute computing power, and no skills are needed. The miners are rewarded with a fraction of the Bitcoin and hence it’s a competitive process. The successful miner is the one who beats everyone else in this game and solves this massive mathematical puzzle by using immense computing power. After finding the hash of the last recorded block the miner announces it to the network for the other nodes to verify and creates a new block with the transactions in the mempool post verification.
The cryptographic puzzle solved by the miner is asymmetric. It’s moderately hard for the miner but the other nodes in the network can very easily see the evidence of the massive number crunching done. Over time the miners find the puzzle easier, and the block generation time reduces from 10 minutes. Hence, the puzzle is revised every 14 days to make it more complex. That effectively means more computing power will be needed henceforth.
Carrying out a DDoS attack by capturing 51% of the total computing power in this network is too expensive, and the hacker will end up spending more than he can make off with. Hence POW makes blockchain very secure.
However, this high security comes at a heavy cost. The ever-increasing computing power of the nodes requires ever more electrical energy, for e.g. before the end of 2018, Bitcoin mining operations will consume more energy in Iceland than the total domestic energy consumption of the country. Bitcoin isn’t backed by any tangible asset and such strain on the environment for a digital currency is attracting negative media coverage. Also, the involvement of all nodes in the transaction validation process impacts the scalability and transaction throughput.
Besides, it’s hard for the individual miners to continuously upgrade their hardware to solve ever more complex mathematical puzzle and foot the increasing electricity bill. Hence there is increasing centralization of mining with large organized mining rigs dominating the scene. Such indirect centralization is against blockchain’s core principle of decentralization.
How is the PoS algorithm different?
In case of PoS algorithm, a set of nodes decide to stake their own cryptocurrencies for the transaction validation. They are called ‘stakers’. The larger the amount of stake and the longer the duration of the stake, the better are the chances of the staker to get transaction validation responsibility.
All cryptocurrencies in this network are already created, and there’s no mining. This eliminates the need to solve a complex cryptographic puzzle. The continuous upgrade of hardware and soaring energy costs are eliminated, too. The transaction validation process is called ‘forging’.
Also, there isn’t a need for the entire network to be involved in the transaction validation process, which improves scalability. PoS allows another technology solution to be implemented, and it’s called ‘sharding’. Originally a concept from database management, where it means storing different partitions of the database in separate server instance for higher efficiency, in blockchain sharding means storing horizontal portions of the network in separate groups of nodes. Since no node can see the entire network, sharding can’t be implemented in conjunction with POW algorithm, and PoS is needed with separate stakers for separate shards.
POW vs. PoS: which is better?
POW is well-tested and used in many cryptocurrency projects. DDoS attacks on a blockchain employing this algorithm are impossible with today’s computing technology. However, the high energy cost, increased strain on the environment, associated adverse media coverage, increasing centralization of mining operations, and low transaction throughput will likely make it unviable in the long run. Communities are increasingly concerned about high energy costs of Bitcoin mining, and China is officially banning all such operations.
The PoS algorithm provides for a more scalable blockchain with higher transaction throughput, and a few projects have adopted it already, for e.g. DASH cryptocurrency. However, it’s less secure than the completely decentralized POW algorithm.
It’s possible to buy a majority of the coins in the network, become the staker of choice, and validate wrong transactions as part of an attack. However, the market economy has a natural safety valve for this, because the price of the coin will rise significantly when someone tries to buy such massive amount of coins, making the attackers’ job far more difficult.
It’s also possible for a staker to turn rogue and validate wrong transactions. Ethereum project, as part of their planned transition to PoS, has designed the ‘Casper’ protocol where such rogue stakers will be punished by confiscating their staked cryptocurrencies and barring them from staking ever again.
If the planned implementation of PoS in a protocol as famous as Ethereum goes well, then the crypto community will probably be reasonably assured about the ability of the PoS algorithm to keep the network safe. That may tilt the scale in favor of the PoS, and only time will tell which one will be the blockchain consensus algorithm for the future.