The process of mining make uses several cryptographic algorithms to make blockchain secure, consistent and stable, and miners are responsible for verifying the data, and they make use of consensus algorithms, means all miners agree at one point that either this data is valid to be added to the block inside blockchain or it is invalid and should be rejected.
Below we will get to know two most popular consensus algorithms.
PROOF OF WORK
Bitcoin was the first ever cryptocurrency which was based on the underlying technology called blockchain, which is the decentralized distributed ledger and contains a chain of blocks and each block stores the data. Miners are the thousands of computer machines controlled by individuals which verify every new data comes in.
Now, proof of work is the consensus algorithm in which miners provide the proof that this data is valid, and they do this by solving the complex cryptographic problems which are set by the system whenever a new data comes in, and when any miner in the network solves the problem, then that data is stored in new block inside a blockchain after being validated by all nodes in network, and the miner who solves the problem, gets the reward of new coins (like bitcoins in case of bitcoin digital currency or tokens in ethereum). In short, proof of work is the way of verifying the data which then generates the new coins.
ISSUES IN PROOF OF WORK ALGORITHM
- This process of mining requires powerful computer machines, which take much of the electricity and hence generate a lot of heat, just for the sake of solving math problems, and only one miner gets rewarded eventually, in the result all energy of other mining machines in the network is wasted.
- Another problem with this algorithm is that in recent days, miners have found a new way of getting the chance of earning coins by making pools (or groups) in which all members try to solve the problem together, and whenever any of the pool solve it, the reward coins are distributed in whole pool members. Nowadays, there are large pools which control more than 80% of blockchain network, hence making the blockchain network centralized, as the core concept of blockchain is the decentralization, means blockchain network is being controlled by some pools which can be dangerous for many reasons
- One of the reason is that if two or more large pools decide to be merged together, then there are chances of 51% attack in which if the one or more large pools (a group of miners) gets a control over 51% of blockchain they can start approving the fraudulent transactions
- If we continue using proof of work in mining, we can face the issue of Tragedy of Commons, as there will be less reward given to miners in future, so they will rely more on transactions fees, which is another way of earning coins, and miners will verify the transactions at any fee they get which will encourage people to pay even less transactions fee, so there will be less number of miners remain in the blockchain network which will make the network insecure, hence it will increase the chances of 51% attack
PROOF OF STAKE
To overcome the issues of Proof of Work (PoW), the new concept has been introduced, called Proof of Stake (PoS), which was first adopted by Peercoin (cryptocurrency), then followed by Blockchain and Shadowcoin.
Proof of Stake is also the consensus algorithm in which miners validate the new blocks depend on how much they deposit the coins which they already have, in the system. In short, suppose any person holds 5% of all bitcoins available today, can validate 5% of transactions come in. Depositing our own bitcoins does not mean to give them away, but they are kept at stake, and stake means to show the ownership of the coins.
HOW IT WORKS
For example, there is a new block came in, and there are three miners called Alice, Bob, and Peter, all are competing to get the chance of being a validator. Now, if Alice has deposited 20% percent of all bitcoins available, Bob has deposited 12%, and Peter has deposited 6%, now there are 20% chances for Alice to get the chance for being validator, and so on.
BENEFITS OF POS OVER POW
- Proof of Stake selects some validators to validate the data, based on their deposited amount of coins as stake, so only selected miners’ energy is utilized and all other miners don’t waste so much energy by computer machines
- Proof of Stake keeps an eye on selected validators, as if they start approving fraudulent transactions then they lose some part of their stake (coins deposited in the system) and if they continue to approve fraudulent transactions then they will lose all of their stakes, so until the validators’ stake is higher than the sum of all transaction fees they have got yet, we can assume that they are doing their job correctly, and when they quit from being validators then their money is released after certain period of time, including the amount they deposited initially, but amount does not release immediately because system still need to be able to fine them if it discovers there are some fraudulent blocks
- Setting up node is very easy in proof of stake as compared to proof of work because, in proof of stake, we don’t need to purchase expensive equipment for mining and that is the reason more and more people are encouraged to set up a node, which then makes the network more decentralized and secure
- Proof of Stake makes 51% attack impractical, as there is a possibility in Proof of Work that if two or more large pools get emerged then they can get 51% of control on blockchain and they can start approving fraudulent transactions for their benefits, but it is impossible to do in Proof of Stake because if for example bitcoin blockchain is converted into Proof of Stake and any individual miner or pool try to get 51% control of blockchain then he will need to have 80 million dollars (which are equal to 51% bitcoins), which is not possible
RISKS IN PROOF OF STAKE
Though Proof of Stake provides several benefits and it is more effective than Proof of Work, but still, it is not perfect because it is in the development phase, and there are some flaws and risks which need to be handled, and lots of research is being done on it. Here we will discuss some of the risks in Proof of Stake:
- The system should be careful when selecting validators, as miners with the greater number of coins have more chances to be selected as validators, and once they are selected they become richer with getting transaction fees, which increase their chances of being validators frequently
Another risk is that if system selects the validators and they don’t verify the data or just do nothing. This problem can be solved by creating a backup of validators who will take control if above is the case