Proof of Work Vs Proof of Stake
Real deal – What is the science behind Cryptocurrencies?
Believe me, the list you are looking at took me 2 days to create, not because it is tough to find this information, I was busy drinking rather than sharing this important information with you people. But wait for a moment and look at the list again and realise that it is the list of a few Cryptocurrencies categorised under 3 categories but why is it important to know these categories? It will only take 10 minutes to know the answer, so here we go.
What’s the deal – Why should you know this?
To understand what we are talking about you just need to know that Blockchain is the technology that is based on simple yet complex principle of combining blocks of information and making a decentralized and distributed structure. Look at the picture below to imagine what a Blockchain can look like.
Picture 1
Picture 2
In picture 1 it is self explained how a blockchain works, my motive here is to bring an important term to your notice,that is Nodes. Now look at the second picture it’s a representation of nodes distributed throughout the globe.
So what are these nodes and why are we talking about them here and why are they important? The answer lies ahead so continue reading.
Nodes and Blocks – Real Work Real Workers
Look at the picture again and think of a network that is distributed throughout the world that is connected, every point in this structure is known as Node and their job is to process the information on blockchain and generate new block with the sole motive to add it permanently to blockchain. So you can say that Nodes are builders who create a block of information to form a blockchain. Simple enough right? But the real question is how they create a block of information?
Understand, a Node could be a simple personal computer or a super quantum computer anywhere in the world, they use their computers to solve a set of complex mathematical problems to generate a new block.
Now its your time to understand, what is a Block of Information?
Look at the picture below and imagine a block that is carrying the signature of its predecessor block along with its own signature so it can differentiate itself in the blockchain with important information or set of information. How much information can a block carry depends on its block size.
Now as you understood nodes and that they create blocks of information to create blockchain. Its time to understand how they actually do it, I know that the smart brain of yours already gave you the answer, they do it using their computers. But it is more complex than that.
Time for real action – Proof of Work
The Proof of Work is a concept that is the backbone of most Cryptocurrencies that we see today. The concept was invented by Cynthia Dwork and Moni Naor in year 1993. It is general agreement algorithm that is being used in most blockchain systems that we see today. To make it simple for you to understand I can say that this is the method that is used to generate a new block of information in the blockchain.
As I mentioned earlier nodes use their computers to solve complex mathematical problems to generate new block of information, now these problems could be of many kinds. Some of them that we use today are,
1- Hash function, a problem to find the input, knowing the output
2- Puzzles
3- Merkle tree based
4- Guided tour puzzle protocol
It is not important for you to know about these POW functions I just mentioned these to give you an idea that a problem could be one of many kinds.
In many cryptocurrencies Hash function is being used, so nodes solve the equation to generate a new block in a way that answer to the whole problem. This mathematical equation is called Hash that is also the signature of block that they generate by solving the equation.
Now how easily you can solve the problem depends on the power of your computers that is called hash power.
One will eventually need more hash power as the network grows and more people join the network, to generate a new block of information, in the case of cryptocurrencies the information that a block carries is transaction information or the set of transactions.
So in case of Hash function one node has to find the input hash of the block knowing the output hash that requires millions of permutations and combinations. Assume a website where you enter your password, your password has to go through many hash functions before the server matches it to the hash function that is stored for you initially when you created the password.
In this case even if a hacker gets access to all the hash functions of server he wont be able to get access to your account as he has to go through many hash function before getting the right match with your password.
This is the same in case of cryptocurrencies, nodes know the result which could be of fixed length and might be starting with certain fixed zeroes but still they have to go through many hash functions to compile the provided transactions in the fixed size block which also results in creating new block adding it to block chain, confirming and validating the transactions at the same time.
Notice that the input changed the hash but we know from the beginning that eventually we have to combine the data into fixed output with certain properties.
The new block generated is the Proof of Work that the node did hence they will be rewarded for the services they provided. Many nodes battle with each other or sometimes work together to generate the new block, in which they are confirming and validating transactions. At the end they get the tokens of cryptocurrency that they mined as the reward. Hence nodes are usually called Miners in cryptocurrency world.
Bitcoin(BTC) is the first cyrptocurrency that used POW concept to validate its transactions since then many other cryptocurrencies emerged and used the same concept. Now is the time to look at the first list again.
But why Proof of Work
POW provides biggest defence against DOS attacks (Denial of service in which a hacker floods the system with pseudo requests and when the server crashes one can easily gain access to important information). In case of POW DOS attack is almost impossible as one has to use unreal amount of computational power and time to execute numerous calculations to execute the denial in the system.
Are you going to talk about me or not – Proof of stake (POS)
The Proof of Stake concept was first introduced by Sunny King and Scott Nadal in 2012. Sunny King also created Peercoin (PPC) in 2013 which is the first cryptocurrency to implement Proof of Stake concept. Oh! If you didn’t notice, I mentioned in the first table that Peercoin uses both Proof of Stake and Proof of Work which is actually true.
But Why?
Argument is if POW is successfully powering many cryptocurrencies, what is the need of another algorithm to govern. Truth is there is some complex issues with POW.
1- Biggest problem with POW is power consumption, on record it costs nearly $2500 USD on average to generate a new block in Bitcoin(BTC) blockchain. Government regulations related to energy consumptions adds to this factor making it more difficult to maintain hash power for Miners.
2- While researching about Bitcoin (BTC) I came across a term i.e. 51% attack. My brain asked me what the hell is it. Initially I always suspected what will happen if all the miners stop mining i.e. stop generating new blocks or what will happen if all miners come together to generate a new block. Someone gave a fancy name to this situation that is 51% attack.
Assume a network in which miners are working hard to verify transactions, due to increase in difficulty to mine a block few miners decide to come together and form a group or let’s call it a pool of miners, in which many miners share their computing powers to mine a block. Now what will happen if many pools come together to form a giant pool, let’s call it a Mining Dungeon. In such a case where thousands of miners sharing their hash power form a monopoly which breaks the sole purpose of cryptocurrencies i.e. decentralization.
Now think of a situation in which every Miner in this world forms a group and decides to kick you out of it. With majority of hash power in the network they can manipulate the system by creating a fork in the blockchain as they control the flow of the blocks in the blockchain, it will be their choice, whether to verify the transaction or not. Look at the picture below to understand.
To overcome these unreal tough possible scenarios, the idea of Proof of Stake (POS) was proposed.
Proof of Stake- Will I get to keep something?
Proof of stake proposes the algorithm which uses various combinations in which stake holders who keep more coins according to the present need will get the opportunity to be the node to generate the new block in the blockchain. In POW system we have Miners but here in POS we have Forgers. Their only job is to sign the block which is carrying transactions with their personal key, combining it with set of rules assigned to create a new block.
What rubbish? I said the same thing but Yes this is true this is the whole concept of POS but there is a way to avoid issues with POS.
Know the issues.
1- Biggest problem with the Proof of Stake is its name, why in this world would you like to get involved in something in which you know that the richest person in the system will get the chance to be the node.
2- Same as POW, POS also has a problem of getting 51% attack. What if one-day Bill Gates decides to buy 51% stake of the cryptocurrency, eventually he will get the permanent advantage. This case also applies to group of people.
3- Another situation that can arise in which if two Forgers meet the conditions to sign the block at the same time. In this case the main blockchain will be forked. Don’t worry look at the picture below, I got you covered.
In POW Miners spend their computing powers to create the block so in case of forks, the majority automatically decides to follow one fork chain making it the main blockchain, rather than spending double energy on both forks. But in case of POS one don’t have to spend anything so in case of fork one can decide to sign both forks. Everybody who is smart wants to make extra rewards, what if everybody will start signing both forks? Say 99% of Forgers start signing both forks. But one smart person sends the transaction to blockchain which will go through, as everybody is busy signing no matter whatever the fork is but at the same time that smart person makes another fork which is just the block before he sends the transaction and sends it to himself signing and making rewards without losing anything. This kind of case is termed as “Nothing at stake”.
Brain Storming problem – What Now?
POW is tried and tested with Bitcoin but the problem is high Mining cost. POS can be achieved without spending a single penny but full of issues. POS is new and still its adoption is subject of argument, everything depends on the approach to resolve the issues. What should we do now?
Many cryptocurrencies approached this in their own way to resolve theses issues. I am going to share a few to make you understand the future of cryptocurrencies.
Time to look at first table again and I would like to mention Peercoin (PPC) again.
Peercoin choses an interesting approach to resolve the matter of distribution, they chose to use POW in their initial phase. That means initially they started using POW to confirm transactions and slowly they started shifting to POS.
To take power from the rich Forger they introduced the concept of coin age in which a certain age is assigned to the coin to make sure that everybody will get a chance to be the Forger. After a certain period of time the coin will expire this will take away the power from the rich lad to be the forger. Also after a fixed period it will be renewed automatically.
Creator of Peercoin believed that “Nothing at stake” is only theoretical and can’t be implemented in real world but still they created checkpoints to keep a check on fork formation and no fork formation was allowed deeper than the last known checkpoint.
Ethereum – You can’t ignore me
Interestingly Ethreum is working on POW but ethereum group is planning to shift it to POS. The biggest reason is to make it world wide available economically.
They introduced the concept and called it CASPER which is still subject for argument and late adoption.
Casper the Friendly Finality Gadget (FFG) is the name given to protocol that is going to be implemented over the present POW structure of Ethereum in such a way that every 50th block will be the checkpoint so that the network of validators can check in.
In order to get recruitment as a forger in Ethereum network one has to deposit a certain potion of their digital currency and then place a bet to meet requirements to forge the block. If everything goes according to the rules a forger will get rewards which will be proportionate to the placed bet. If somebody tries to play smart and exploit rules by setting a “Nothing at stake” attack he will get nothing and end up losing the deposited currency.
Ethereum is still planning how to implement project CASPER which would be too vast to include in this article. But I hope these examples might have answered most questions that you might have.
At the end again I would like to bring to your attention that the motive of this article is to blow your mind with this little drop of information in the world of Blockchain and Cryptocurrencies.