Proof of Work vs. Proof of Stake: An In-Depth Discussion
Get a handle on consensus mechanisms for cryptocurrencies.
Join the DZone community and get the full member experience.
Join For FreeAt the outset, remind yourself of the traditional ways of making financial transactions. Note that there is either a bank, the government, or some other authority that guarantees the validity of transactions.
Now, remember the most general explanation of Blockchain technology; it is a distributed ledger with no trusted intermediary or central governing body. The definition itself gives rise to two obvious questions — Who determines the validity of a blockchain transaction and how is this process performed?
The answer to the first question is somewhat simple — the nodes or members of the network participate in the validation process. In other words, a blockchain works upon the consensus of the nodes in its network.
The second answer, however, is significantly more complex, so much so, that it has initiated and sustained a prolonged debate with which this blog is concerned.
In blockchain, consensus is reached using specific "consensus mechanisms." Among these are Proof of Work (PoW) and Proof of Stake (PoS), the most discussed mechanisms, primarily because of their immense potential in establishing the validity of blockchain transactions.
Both have their upsides, as well as their downsides. This discussion into Proof of Work vs. Proof of Stake intends to delve into the debate in order to provide readers with a better understanding of the subject.
Consensus Mechanism and Security
It is the method of reaching an agreement in a blockchain system, based on specific computational algorithms. These algorithms work with mathematical proofs and are thus virtually fault-free in and of themselves.
Although there can be many consensus mechanisms (and in fact there are), PoW and PoS are the most common. The process by which nodes validate transactions by solving a mathematical puzzle is called mining. The network’s consensus mechanism determines a node’s ability to participate in the mining process.
That said, it is somewhat evident that ensuring secure and valid blockchain-based transactions is one of the significant functions of consensus mechanisms. Later in this insight, we’d see that these mechanisms are devised to tackle the problems of blockchain hacks and frauds.
Blockchain technology is much revered for being immutable and secure. Yet, it would indeed be a mistake to think that the hacker community isn’t looking for newer ways to breach newer technologies. Obviously, hacking a blockchain is significantly more difficult than committing any other cybercrime, but it is not impossible. Not yet, at least!
Although there are a variety of breach attacks, blockchain projects are affected by two the most — Distributed Denial of Service (DDoS) and 51% attacks. Since the significant differences between PoW and PoS emanate from their ability to tackle these attacks, let’s discuss these two briefly here.
- Distributed Denial of Service
For this attack, hackers initiate multiple, fake requests. Consequently, they consume most or all of the network’s processing resources. The obvious result? The network server crashes! When this happens, every other node in the network is cut off from the server. - 51% Attack
Theoretically, if a node acquires 51% of the network’s total mining power, it can bend the network according to its wishes. The attacker who controls a majority of the network can:- Validate fraudulent blocks beneficial to it.
- Revert previously validated transactions.
- Enforce double-spending.
Another crucial point here is that smaller networks are more vulnerable to majority attacks. Why? Because it is easier for someone to acquire control over 51% of the network. Renting the required computational power, for about an hour or so, should be enough!
Proof of Work vs. Proof of Stake at a Glance
Proof of Work | Proof of Stake |
---|---|
Participating nodes are called miners. | Participating nodes are called validators or forgers. |
Mining capacity depends on computational power. | Validating capacity depends on the stake in the network. |
Mining produces new coins. | No new coins are formed. |
Miners receive block rewards. | Validators receive transaction fees. |
Massive energy consumption. | Low to moderate energy consumption. |
Significantly prone to 51% attacks. | 51% attacks are virtually impossible. |
What Is Proof of Work?
Although the idea existed prior to the invention of blockchain, Satoshi Nakamoto popularized the PoW consensus. The Bitcoin blockchain was the first major implementation of the PoW consensus protocol. So, PoW is often referred to as blockchain’s "original" consensus mechanism.
Initially, at least, PoW was hailed as the most reliable method for blockchain consensus. It enabled the realization of the decentralized dream and ruled out intermediaries at the same time to ensure valid transactions.
However, as the size of the blockchain networks grows, the problems of this mechanism become increasingly apparent. And, at times, it is impossible to tackle them.
How Does Proof of Work Work?
In PoW, miners have to solve a cryptographic puzzle to validate a transaction. One might visualize it as a race, where the miners are competing to be the first one to solve the puzzle. The answer to this puzzle is known as a hash.
So, what’s in it for the miners? For every transaction they validate, miners are rewarded with the blockchain’s native cryptocurrency, plus, a transaction fee.
The puzzles are immensely complex, and it requires massive computational power to solve them. The implementation of the PoW consensus protocol can be summarized as follows:
- A new transaction is broadcast to the network.
- Miners rush to compute a hash value that matches with that of the transaction.
- The first one to solve the hash receives the reward.
- A new “block” is created, which includes the recently concluded transaction.
A part of every new hash contains the hash value of the previous transaction in the block. It does two things — it prevents miners from validating fraudulent transactions, and it prevents double-spending.
Presently, the Bitcoin network mines one block of transactions every ten minutes. Certain alterations to the Bitcoin blockchain has enabled Ethereum, the other primary user of PoW, to complete this task in 16 seconds (approx).
The complexity of a PoW puzzle depends upon the number of nodes in that network. A puzzle’s complexity is directly proportional to the computational power required to solve it. This causes certain severe ramifications for a PoW-based blockchain.
Since we are interested in understanding the difference between PoW and PoS, we must resist the urge to speak about the problems of the PoW mechanism at this point. Instead, we’ll discuss those in relation to the PoS mechanism.
What Is Proof of Stake?
Faced with the problems posed by Bitcoin’s PoW protocol, the blockchain community is looking for a new, more beneficial way of establishing consensus. The idea of the PoS consensus was propounded by Scott Nadal and Sunny King in 2012.
Presently, the Ethereum community is working relentlessly for the mainstreaming of the PoS protocol within the blockchain world. Ethereum’s version of the PoS protocol is called Casper. When launched, it is expected to do away not only with the problems of the PoW protocol, but also those of the PoS protocol itself. For a detailed understanding in this regard, readers can refer to our insight on What is Ethereum.
In PoS, computational power is replaced by currency power. It depends on the number of tokens a node has in its wallet. In other words, your ability to validate a transaction depends on how much "stake" you have in the network.
It’s worthwhile to note here that there will be no miners in the PoS system. Instead, there will be validators or forgers. Why? Because there will be no block rewards, only the transaction fee. Moreover, new coins will not be mined. Instead, they will be produced by the creators at the time of launching the network. This number never changes.
How Does Proof of Stake Work?
Instead of initiating a race to be the first validator, the PoS protocol randomly selects a validator based on their stake in the network.
Suppose you have tokens worth 10% of the block in your wallet. It gives you the ability to validate only 10% of the block.
If Casper sees daylight, we will see the existence of validator pools. Nodes in a network will be able to join these pools at any point of time and any phase. Obviously, validators will be chosen from these pools. To uphold the principle of decentralization, there will be "no priority scheme" in this process.
So, at this point, we know what Proof of Work and Proof of Stake are. We also understand how they work. Now, we must determine which one is better and why?
Proof of Work vs. Proof of Stake: Which Is better?
Bearing in mind everything that we have learned so far, let us now look at the significant problems of the PoW protocol. Also, let us see how PoS presents a highly plausible remedy to these issues.
Massive Resource Consumption
The biggest problem with PoW is that it requires insurmountable amounts of computational power. By extension, it entails a mammoth electricity consumption. According to a report published in The Economist in 2018, Bitcoin alone consumed 22 Terawatt-hours of energy every year. The number almost equals the annual energy consumption of Ireland.
So, what’s the problem here? Most of this computational power is wasted, as only one miner is rewarded for each block while thousands compete for it. Moreover, such magnitudes of energy consumption is a serious threat to the environment. Added to that is the huge cost of the hardware required for mining under the PoW protocol.
An interesting fact! To "save" on these costs, groups of PoW miners have set camps in places like Iceland. Why? To trap the geothermal energy available there to generate electricity for crypto-mining. Elsewhere, as well, miners are known to develop small, often illegal, hydel projects to meet their energy needs.
To make things worse, PoW's need for power will never be satiated. Because, as the network grows, so does the complexity of the algorithms. This, in turn, leads to an increasing need for hash power. So, we can witness an upward spiral where the power requirement is always on the rise.
The simple, token-based PoS system is a significant breakthrough in this regard. Indeed, PoS would also require computational power. But, that is expected to be equal to the power of a Raspberry Pi. Consequently, the implementation of full-scale PoS would mean a massive reduction in the overall power consumption of the blockchain world.
Mining Pools
Partly to maximize the rewards, and partly to save on establishment costs, individual miners accumulate their resources and form mining pools. The biggest of the mining pools are full scale, industry-like establishments. They employ hundreds of staff and invest millions of dollars in the process. As a result, some major issues arise.
First, they bring back centralization into the blockchain community. Second, they heighten the risks of a 51% attack.
A closer look at the mining charts of both Bitcoin and Ethereum reveals a staggering reality. More than 50% of the network’s hash power, is owned by three or four of the greatest mining pools.
If at any point, these pools decide to join hands and attack the blockchain, it would be impossible to stop them.
Under the PoS system, however, 51% attacks are rendered virtually impossible. Here, to attack the blockchain, a node would have to own 51% of all available Ether (Ethereum’s native cryptocurrency) in the network. We are talking of billions of dollars here!
Arguably, it doesn’t seem impossible that someone purchases that much Ether. Now, there’s a catch! If someone does indeed try to buy it, the demand in the market would be higher than the supply. Consequently, the price of the tokens would rise, and so would the overall cost. In all, 51% attacks under PoS are so expensive that they cease to be profitable.
Also, if you really have a 51% stake in the network, it would be foolish to attack it. Because, as and when the security of the network is compromised, the value of the tokens goes down — the value of your own wealth goes down, as well.
Apart from these, PoS is also expected to lay the foundations for a faster and more scalable blockchain. Some theoretical vulnerabilities of the PoS system have indeed been pointed out.
The Bitcoin blockchain popularised the Proof of Work protocol. Although it is still the dominant protocol followed by Blockchain giants like Bitcoin and Ethereum, it has some inherent problems. Among other things, its energy requirement is massive. And, given the presence of mining pools, it is highly prone to 51% attacks.
As a remedy, Ethereum is trying to popularise another method, namely the Proof of Stake. Ethereum’s version of PoS — to be called Casper — is expected to transform the blockchain world. It’ll not only eliminate the drawbacks of PoW but also open new horizons for Blockchain.
It’s true that PoS might also have its vulnerabilities. The benefits that it brings to the table seem favorable to those offered by PoW.
Published at DZone with permission of Akash Takyar. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments