Proof of work vs proof of stake explained! Here's a simplified explanation on how a PoW blockchain differs from PoS, and how it applies to Bitcoin.
4. The Byzantine Generals’ Problem
Before I begin discussing proof-of-work, it’s important for you to be aware of the Byzantine Generals’ Problem, also known as the Byzantine Fault Tolerance.
Proof-of-work is a computational protocol miners use to validate transactions in a cryptocurrency network & add the transaction to the blockchain. Put simply, miners use their computers to churn through a ton of different guesses until the computer comes up with the right answer that fits within the network’s required parameters. Different cryptocurrencies use different mathematical formulas (or functions), all of which are based on extremely complex cryptography. A hash is a certain piece of information, ranging from a letter or number to even an entire word or text file. A hash function is a cryptography-based math equation where you input a hash value into the equation then get an encrypted string of numbers & letters as a result (the hash). Let me help you visualize it to make it easier. We’ll represent our hash function as h(x) = y, where h is the mathematical equation (aka the “hash function”), x is a dynamically-changing hash value, and y is the encrypted output (or hash). In the case of Bitcoin, the hash function that’s used is known as SHA-256 (which is an acronym for Secure Hash Algorithm, which uses a 256-bit hash). The hash value that you input can be as many different numbers & letters as you’d like, but the output will always be a string of 64 letters or numbers. The reason why this is so secure is because SHA-256 is a one-way formula, meaning it’s impossible to reverse engineer your output to find out what the original hash value was. So proof-of-work is essentially just that: you have a given hash function you’re required to use along with a 64-digit answer; and as a miner, you set your computer to “work” by plugging in a bunch of different hash values in an attempt to guess the right answer. Once you do so, you’re able to validate a transaction, add it to a block, and get rewarded for your efforts in the form of Bitcoin, which are released as block rewards. Think of mining as simply a race to guess the right answer. The miner who gets the right answer first gets the reward.
The proof-of-stake protocol differs from proof-of-work in the sense that mining power is determined by the number of coins you hold of that particular cryptocurrency; the more coins you hold, the more mining power you have. Mining power with proof-of-work, on the other hand, is determined by how powerful your computer is & how much available electricity you have at your disposal that you can direct towards mining. In proof-of stake, holding ownership of the coins demonstrates your “stake” in the network. Methods have been implemented to grant smaller miners a chance to mint the next block, such as randomized block selection & coin age based selection. There’s also the option of running a masternode, which I discussed in my previous video on hard forks. One of the advantages of the proof-of-stake protocol is that it solves the Tragedy of Commons issue, which states that eventually, at some point in time, once all 21,000,000 Bitcoin have been rewarded & are in circulation, Bitcoin miners will be less motivated to mine in the Bitcoin network since there will no longer be any block rewards at that point, and the only way they’ll only be able to earn Bitcoin is from transaction fees. Less miners means more opportunity for an attack on the network, since it’ll be easier to control 51% of the network’s computational power. Proof-of-stake solves that by putting your own coins & investment at stake.
1. Which is better?
Both protocols have their own advantages & disadvantages. Proof-of-work allows for not just miners, but also developers & the coin’s community members to vote on potential changes to be implemented into the network. But on the flipside, proof-of-work requires exorbitant amounts of electricity to run mining rigs. As of 2017, the Bitcoin mining network used more electricity in a year than all of Ireland as a whole. Each Bitcoin transaction uses an average of 300 kilowatt hours of electricity, which is enough to bring 36,000 kettles full of water to a boil. Proof-of-stake, on the other hand, is said to be more energy-efficient than proof-of-work, while at the same time more secure. But its biggest disadvantage is that the miners (or stakeholders) are the ones who hold all the power. Unlike in proof-of-work, miners able to theoretically implement whatever changes they so choose without having to get approval from developers or community members. This contradicts the coin’s supposed “decentralized nature” by potentially putting all the voting power & control in the hands of a centralized few.