Introduction to Proof of Work
In Proof of Work, the miners have to solve a cryptographic puzzle. This puzzle is difficult to solve but easy to verify. The first person to find the solution broadcasts it on the network and other nodes verify it after which the miner receives a reward.
For the block to be valid, the output needs to start with a certain number of zeros at the beginning of the hash value. This depends on something known as ‘The Difficulty’. The computing power of the network changes the output. Bitcoin networks adjust the difficulty and that helps slow down the creation of new blocks. In Bitcoin, it takes 10 minutes to calculate the Proof of Work and add a new block to the chain. In order to produce the hash value with the desired amount of zeros, in the beginning, the miners add a ‘Nonce’ into the block number. Nonce stands for ‘Number Only Used Once’. It is the first number needed for solving a block of the blockchain. This is the number that the miners are searching for in order to solve the block.
This makes it hard to tamper with blockchains, as tampering one block leads to a change in all blocks and the proof of work of each block has to be redone. Therefore, the use of hashing with consensus ensures security. It is assumed that the miners have completed the work for that specific difficulty level.
The probability of the miner being chosen to update the next block is determined by the computing power a miner controls. For example. If a miner controls 20% of the network power, the probability of him winning is 20%. The more computing power, the more the chances of obtaining a new Bitcoin.
The need for this led to a situation where people started building larger and larger mining farms. POW gives more rewards to people with better and more mining equipment. The higher the hash rate, the more the chance that you will get to create the next block and get a reward. To increase their chances, miners are coming together and form mining pools. They combine their hashing power and distribute the reward amongst them equally.
Unfortunately, Proof of Work uses massive amounts of electricity. Mining pools also cause centralization of the network as they control large portions of the network. This is extremely dangerous as if massive pools come together, they would hold the majority in the network and this could make tampering of the blockchains a possibility. To successfully tamper with a blockchain one has to tamper all the blocks on the chain and redo their proof of work. To do this they need to control over 50% of the P2P networks. Only then it will be valid or accepted. It is possible in theory but in practice it’s impractical. This model is called 51% Attack model. It is the weak point of POW. If Miners obtain 51% of the hashing power, they can approve fake transactions and control the blockchain.
Proof of Stake (PoS)
In 2011, a new technique was proposed which came to be known as Proof of Stake. This technique works as an alternative to Proof of Work. The idea was that it was extremely wasteful to let everyone compete against each other with mining.
Proof of Stake is similar to depositing money in a bank, where interest is given based on the amount and duration it is held. It is utilized by Cryptocurrency by allocating token based on Coin Age. Coin Age is the quantity and duration tokens are held for. For example, 100 tokens held for 20 days is 2000 Coin Age.
Proof of Stake works on an election process. 1 node is selected to validate the next block. In POS, there are no Miner or Mining. Instead, there are Validators, and they either Mint or Forge.
The selection of the Validator is not completely random. A peer has to deposit a certain amount of coins into the network like a security deposit, as a Stake.
The size of the Stake determines the chances of a validator to be chosen to forge the new block. For example. M deposits $10 whereas, Z deposits $100. The chances of Z being chosen as a validator are higher. Here, the peer chosen validates the next block by checking if all the transactions within it are valid. Once it is validated, he signs off on the block and adds it to the Blockchain. The node then receives fees associated with the transaction in the block.
Trust is developed by the validators on the network by the means of the Stake. Validators deposit a stake and can lose it if they validate fraudulent transactions. If the stake is higher than the amount they would receive from the transaction fees, they can be trusted to do their job; as they would lose more money if not. It acts as a financial motivator. If a peer stops being a validator, their stake and transaction fees are held back for a certain period of time in case they need to be punished by the network for validating a fraudulent transaction.
Proof of Stake has advantages over POW. It is more energy-efficient, less susceptible to the 51% attack, and less expensive.
As POS does not require expensive mining equipment and does not compete against other miners’ computing power, it saves on both money and electricity. This also encourages more people to set up a node, but only a few elected validators can verify a block, making the system more decentralized and secure.
There are also fewer chances of a 51% attack as POS makes it hard and impractical to acquire that amount depending on the value of a cryptocurrency. When a bitcoin is converted to Proof of Stake, acquiring 51% coins would lead to a loss of many billion dollars.
But Proof of Stake doesn’t come without its own risks and disadvantages. In POS, how they select their validator can’t be completely random as the size of the stake has to be considered. The stake alone isn’t enough as it will favor rich people who will get chosen more frequently and will also collect more transaction fees. This will make them richer and increase their stakes and chances of being chosen as a validator continuously. Proposals to fix this include coin age-based selection of validators.
There is also the risk of a chosen validator not doing the job he is appointed to do, but this can be solved by appointing backup validators.
Proof of Stake still requires more research to understand and mitigate the risks it presents.