Header Ads

Header ADS

What is proof of work and proof of stake algorithms?

 Cryptocurrencies like Bitcoin uses enormous amounts of electricity to secure their networks. But why is that? And more importantly, what are the alternatives? Mining new coins takes a lot of computing power because of the proof of work algorithm. The idea was first introduced in 1993 to combat spam emails and was formally called proof of work in 1997. However, the technique went largely unused until Satoshi Nakamoto created Bitcoin in 2009, he realized that this mechanism could be used to reach consensus between many nodes on a network and he used it as a way to secure the Bitcoin blockchain. However, the proof of work algorithm works by having all nodes to solve a cryptographic puzzle. This puzzle is solved by miners and the first one to find a solution gets the minor reward and this has led to a situation where people are building larger and larger mining farms like this one. According to Digiconomist, Bitcoin miners alone uses about 54 terawatt hours of electricity, enough to power 5,000,000 households in the US or even powered the entire country of New Zealand or Hungary. But it doesn't stop there. Proof of work gives more rewards to people with better and more equipment. The higher your hash rate is, the higher the chance that you'll have to create the next block and thus receiving the mining reward. To increase chances even further, miners can come together in what's called mining pools. They combine their hashing power and distribute the awards evenly across everyone in the pool. So to sum it up, proof of work is causing miners to use massive amounts of electricity, and it encourages the use of mining pools, which makes the blockchain more centralized as opposed to decentralized. So to solve these issues, we have to find a new consensus algorithm that is as effective or better than proof of work. 



In 2011, a Bitcoin talk forum user called Quantum Mechanic proposed a new technique that he called proof of stake. The basic idea is that letting everyone compete against each other with mining is just wasteful. So instead, proof of work uses an election process in which OneNote is randomly chosen to validate the next block. Oh yeah, small difference in terminology here. Proof of stake has no minors, but instead has validators, and it doesn't let people mine new blocks but instead, mint or forge new blocks. Validators aren't chosen completely randomly. To become a validator, a node has to deposit a certain amount of coins into the network as stake. You can think of this as a security deposit. The size of the stake determines the chances of a validator to be chosen to forge the next block. It's a linear correlation. Let's say Bob deposits $100 into the network while Alice deposits 1000. Alice now has a 10 times higher chance of being chosen to forge the next block. This might not seem fair because it favors the rich, but in reality it's more fair compared to proof of work. With proof of work, rich people can enjoy the power of economies at scale. The price they pay for mining equipment and electricity doesn't go up in a linear fashion. Instead, the more they buy, the better prices they can get. But back to proof of stake. If a node is chosen to validate the next block, he'll check if all the transactions within it are indeed valid and if everything checks out the nodes signs off on the block and adds it to the blockchain. As the reward, the node receives the fees that are associated with the transactions inside this block.

 OK, but how can we trust other validators on the network? Well, that's where the state comes in. Validators will lose a part of their stake if they approve fraudulent transactions. As long as the stake is higher than what the validator gets from the transaction fees, we can trust them to correctly do their job because if not, they'll lose more money than they'll gain. It's a financial motivator and holds up as long as the stake is higher than the sum of all the transaction fees. If a node stops being a validator, his stake plus all the transaction fees that he got will be released after a certain period of time, not straight away, because the network still needs to be able to punish you should they discover that some of your blocks were actually fraudulent.

 So the difference between proof of work and proof of stake are quite significant. Proof of stake doesn't let everyone mind for new blocks and therefore uses considerably less energy. It's also more decentralized. How is that? Well, in proof of work we have something called mining pools. Those are people who are teaming up to increase their chances of mining a new block and those collecting a reward. However, these pools now control large portions of the Bitcoin blockchain. They centralized the mining process, and that could be very dangerous. If the three biggest mining pools would merge together they would have a majority in the network and could start approving fraudulent transactions. Another important advantage is that setting up a node for a proof of stake based blockchain is a lot less expensive compared to a proof of work based one. You don't need expensive mining equipment and thus proof of stake encourages more people to set up a note, making the network more decentralized and also more secure. But even proof of stake isn't perfect and it also has some floss. Now you might think, hold on a minute. If I buy a majority stake in the network, I can effectively control it and approve fake transactions and you would be correct. This is called the 51% attack and it was first discussed as a weak point of the proof of work algorithm. If a single miner or group of miners can obtain 51% of the hashing power, they can effectively control the blockchain. Proof of stake, on the other hand, makes this attack very impractical depending on the value of a cryptocurrency. If Bitcoin would be converted to proof of stake, acquiring 51% of all the coins would set you back a whopping $79 billion. So the 51 percent is actually less likely to happen with proof of stake. But that's not the only risk proof of stake algorithms also have to be careful how they select the next validator. It cannot be completely random because the size of the stake has to be factored in. But at the same time, the stake alone isn't enough because that will favor rich people who will get chosen more frequently will collect more transaction fees, become even richer, and thus increase their chances of being chosen as a validator even further. There are a number of proposals to fix this, like Coin Hbase selection for instance. Another potential problem is when the network chooses the next validator but he doesn't turn up to do his job. This could easily be solved by choosing a large number of backup validators as a fall back.
 

No comments

Powered by Blogger.