Blockchain Semantics Insights
Business Case | Deep Tech | Announcements | Blockchain Glossary |
What is the difference between Proof-of-work and Proof-of-Stake?By Abhishek Singh | April 6, 2018, 7:59 a.m. GMT
We have all heard stories about how the Bitcoin Blockchain is now consuming more electricity than several countries put together. Ever stop to wonder why that might be the case. That’s largely because of the consensus algorithm that Bitcoin Blockchain uses to ensure safety and immutability of data. Read on to learn more about it.
Proof of work
A proof of work is a piece of data which is costly and time-consuming to produce but easy for others to verify. Producing a proof of work involves solving a mathematical puzzle which requires trial-and-error. It is a GPU-intensive process involving hashing of data. Whichever miner solves the puzzle first gets the reward.
Hashing is a cryptographic technique which maps data of arbitrary size to data of a fixed size. There are multiple algorithms for it. The SHA-256 algorithm is used in Bitcoin. When SHA-256 is applied on a content, it results in a fixed length output. Any change to the content would result in a new output. The content can be a single letter or a page full of texts, the output would always be of the same length. Hashing is useful in determining the purity of the content.
Role of hashing in proof of work
A block contains a set of transactions, nonce and a few more things. Blockchain adds a variance called nonce in each block. This nonce is like a salt added to the contents of a block. As you can suspect, due to the introduction of nonce, the hash output of the contents of the block will change. The puzzle that miners solve is to identify the value of nonce so that the hash output of the block being mined starts with a specific number of leading zeroes. Note, the hash of the contents of the block being mined should start with a specific number of leading zeroes. The value of the nonce that will achieve this is basically what miners are trying to solve for. The number of leading zeroes to achieve is called the difficulty of the Blockchain network at the time of mining. The difficulty is decided by the Blockchain network itself. As you can imagine, the higher the difficulty set, the more difficult it will be to evaluate the nonce. There is no formula to calculate nonce. It is just a series of hit and trials. This evaluation of nonce to achieve a hash value of the block data which honors the set difficulty is the "work" that the miners perform. The right value of the nonce is the output at the end of the work.
Proof of Stake
Proof of Stake is another consensus algorithm being evaluated and slowly adopted by a few Blockchain networks. Here, miners do not have to solve any mathematical puzzle and burn computing power and electricity. There is no competition for validating transactions to earn rewards amongst miners. Miners are simply ‘tapped on the shoulder’ or nominated to verify each transaction.
Why is it called proof-of-stake then? That’s because miners have to stake a certain number of coins of the Blockchain network where they want to participate in the consensus process. The more cryptocurrency you stake the higher your chances of getting nominated to verify a transaction and getting the reward for doing so. Amount of cryptocurrency could also be replaced by or used alongside age of the miner in the Blockchain. You probably understand by now that miners are then not even the right name to call them by, let’s call them creators. They create blocks after all even if they do not ‘mine’ the blocks.
Block Selection Method
For this method to work effectively, there needs to be a way to select which user gets to create the next block. Selecting the creator by their riches alone will result in a permanent advantage for the richer creators who decide to stake more cryptocurrency than others. To counter this problem, newer methods of selection like ‘Randomized Block Selection’ and the ‘Coin Age Based Selection’ methods have been coined (no puns intended).
The system ensures honesty as the point of staking your cryptocurrency is that on evidence of corrupt behavior or manipulation of the system, a creator’s staked cryptocurrency can be confiscated by the governing mechanism of the Blockchain.
Proof of stake systems are more environmentally friendly, as electricity and hardware costs are lower. A greater number of people are encouraged to run nodes and get involved because it is easy and affordable thus leading to decentralization.
Both Proof of Work and Proof of Stake, the way they have been described here are typically modified and built upon differently by different Blockchains. Also, remember that these are not the only standards that are used- these are simply the more powerful ones. We will talk about other consensus algorithms in another post.