Table of contents
Proof of Work and Proof of Stake models are called 'consensus mechanisms', and they are a requirement to confirm transactions that take place on the blockchain, without the need for third-party integration.
Proof of work was the first Consensus mechanism in the crypto market dating back to 2009. In order to understand what proof of work is, we need to first understand what a consensus mechanism is and why it is needed.
In a centralized database, say a financial record system, the database is theoretically managed by an administrator who has access to add, update or delete into the database. Theoretically, if they want, they can ask for what we owe them in regards of the data.
However, blockchain operates differently. It has a distributed ledger and is self-governing. Now suppose if one user on the network says that we owe them $10k, this information can be checked by other nodes on the network and can be flagged as fraud instantly making it an important advantage of the consensus mechanism. The consensus model makes the blockchain more reliable, fair, real-time, efficient and transparent.
Everyone is on the same page!!!
Suppose Bob sends $10 to Tom, ideally Bob's account should be debited and Tom's account is to be credited. In a centralized database, this transaction will be owned by an administrator and can be tampered with theoretically. However, on a blockchain network, this information will be stored in a decentralized ledger which is public. But how do we ensure that everyone has the same record about this transaction between Bob and Tom? This is where proof of work comes into the picture!!!
Proof of Work
It’s a consensus mechanism much like the proof of stake, but there is a lot more to it. It is an algorithm to eliminate the fake usage of computing power. It was designed to eliminate the issue of double spending on crypto projects.
Now suppose Bob has $10 in his account and he sends $10 each to both Tom and Alice. This should not be possible since Bob has just $10 in his account. In the case of centralized authority, it can be verified by the administrator but in the case of blockchain, it is done by proof of work. Double spending is bad for any crypto project because it creates duplicate tokens and makes the project worthless as the price cannot be predicted. An image is given below for your reference:
How does Proof of Work function in a use-case?
Blocks on the blockchain are essentially a list of transactions, for example, each block on the bitcoin network consists of up to a hundred transactions each. Suppose Bob sends $10 to Tom and $5 to Alice, these two are separate transactions on the network and are associated with a block where each block is then attached to a previous block forming a chain of blocks called the blockchain. Miners are essentially the one’s participating on the blockchain to add a new block. On a typical bitcoin network, it takes up to ten minutes to find the winning proof of work to add the block. Here is an image for your reference:
What happens when a block is mined?
Mining a block on the network is essentially complex guesswork where miners randomly guess a password to a block. These passwords are hash functions that depict that a miner has spent a considerable amount of time in order to find a winning combination. This is where proof of work comes in, i.e., you have proof that you spent considerable time trying to find the combination that works. As a result, miners are rewarded with cryptos or get transaction fees as rewards, and the mined block is then broadcasted to everyone in the network so that everyone is on the same page!!!
Advantages of Proof of Work:
- Secure - PoW makes blockchain safe, reliable, permanent, fair, and transparent. It’s secure since in order to have a fraudulent transaction it would take the need to own around 51% of computational power, which comes to billions of dollars.
- Consensus - Since everyone has the same record, everyone is on the same page all the time.
Disadvantages of Proof of Work:
- Impact on the environment- The PoW is extremely expensive for the environment. As per a report, PoW on bitcoin used as much energy as all of Switzerland.
- Inability to scale- On a bitcoin network, each block is solved in around ten minutes making it non-scalable for a large-scale use case.
- No Penalty- Another disadvantage of PoW is that in comparison to centralized databases, where a centralised authority will impose penalty in case of malicious attempt for fraudulent transaction, no penalty exists on blockchain network for malicious attempts though proof of stake does have this provision.
PoW powered projects:
- Bitcoin cash.
Proof of Stake
As discussed above cryptocurrencies like bitcoin use enormous amounts of energy in order to secure their network. Why is that and most importantly what are the alternatives?
The proof of work concept came in 1993 in order to combat junking email, however, the technique largely remained unused till 2009, when Satoshi Nakamoto came up with the bitcoin. He realised that this can act as a consensus mechanism to secure the bitcoin blockchain.
Impact of PoW and the need for an alternative
Proof of work involves solving complex cryptographic puzzles as a result of which miners across the world started setting up mining farms. These mining farms have a severe impact on the environment as in some cases these mining farms are consuming as much electricity as enough to power 5 million households in the US or even to power the entire country of New Zealand or Hungary.
On the blockchain network, miners with better infrastructure will be able to mine more and get more rewards. As a result miners across the network are now collaborating to create miner pools, where they share the computing power and distribute the coin evenly, this leads to centralization of coins among groups of miners, which is against the spirit of blockchain.
We need a new algorithm!!!!
In order to solve these issues with PoW, we needed a new consensus algorithm. In 2011, a bitcoin user named Quantum Mechanics came up with a white paper named Proof of work instead of Proof of stake. The idea was that miners on the network competing against each other is a waste of resources, instead in proof of stake where we will have randomly chosen nodes to act as a validator. The term miner was replaced with validator and the process of mining was replaced with minting/forging.
Validators against miners
Validators aren’t exactly randomly chosen rather nodes have to deposit certain tokens to the network as a stake, one can think of these deposits as security deposits. The size of the deposit determines the chance that the nodes have in order to forge the next block.
Suppose Bob deposits $10 and Alice deposits $100, in that case, Alice will have a ten times higher chance of forging the next block into the blockchain and the chance vs deposit is a linear graph in such a case. This does seem that Proof of stake favors the rich however in the economy of scale in PoW, it favors the rich even more.
For ex: say 1khw= 1$ however 1000khw = 800$, so on scale POW starts favouring the rich even more.
How Proof of Stake works?
Once a node is chosen to validate the transactions in the block, the node validates it and then adds the block to the blockchain. As a result of this validation, validators receive fees associated with the transaction fees of the transactions inside the block.
How can we trust validators on the network?
That’s where the stakes come in. Remember that each validator has to deposit a few tokens as a security. Now suppose if validators validates the fraudulent transaction, then they lose part of the stake deposited to the network. So if the value of the stake is higher than the value of the transaction is validated, validators will lose more than they validated for a fraudulent transaction.
Once the validators stop validating the transaction, then the deposit and the transaction fees earned by forging the blocks are released after a certain period of time. Why not straight away? Because the network needs time to validate and punish any fraudulent transaction that might have been validated.
Difference between proof of work and proof of stake
Disadvantages of PoS:
However 51% of market cap of bitcoin is huge amount and is practically not feasible. 51% of bitcoin = $770,857,985,848 * 0.51 = $393,137,5727,82.48
In case a chosen validator is un-available to forge the block, this will slow down the transaction, however, this case is encountered by having enough backup validators.
PoS powered projects:
- Ethereum is working on POS system called Casper.
In the next article, we will look at various token standards around Ethereum.
This article is part of Research & Development work being done by Pushkar Kumar, Suresh Konakanchi, and Ruchika Gupta. We will be covering a series of articles along with open source projects around blockchain, smart contracts, and web3 in general. Here is the list of all the articles that you can follow to start with Blockchain and write your first contract: