Well, we see a lot of some online forums requesting an “explain-like-I’m-five” articles for Proof of Work and Proof of Stake. So this is my stab on it.
Proof of work
So suppose there are bunch of kids in a kindergarten, they are maintaining stacks of wooden blocks toys, and they all have duplicates of the same stack, and they want to make sure all the blocks are same kept in the same order.
Someone want to add a new wooden block on top of the stack, that wooden block is sent to all the kids, along with a math problem. All the kids try to solve the math problem (mining). Solving the problem also verifies that the block is valid. However, the only way to solve the puzzle is brute force and luck. The first person to solve it receives one candy (fee for mining). Once the math puzzle is solved, it is easy to verify that the solution is correct. If more than 50% of the kids verify it is correct, then they all add that block to the top of their blocks. Thus making sure the only agreed upon blocks are added (Consensus).
If a bad kid wants to insert bad block (or replace a good block) into the stack, he’d have to convince/bribe more than 51% of the kids to follow along, AND redo all the math puzzles for each of the block on top of the block, which can be very costly. Proof of work prevents the bad actors from tempering with the blockchain.
Proof of stake
In proof of work above, a downside is that whenever a new block needs to be added, all the kids are working very hard hoping to be lucky enough to be the first one to solve it. Most of the kids just wasted time and energy since the work is just throw away if they aren’t the first one to solve it.
In proof of stake, when someone wants to add a new wooden block and everyone doing the work to validate, everyone picks one kid to be the “validator”, and that validator decides if the block is valid or not, and if valid, everyone adds to the top of their wooden stacks.
So how are validator chosen? Every kid who wants to be the validator deposits candy into a commonly shared pool. This is called their stakes. The group chooses the validator at random, but the probability of being is higher for kids who put in more candy as their stake. Suppose Bob puts in 10 candies, Alice only puts in 5 candy, then Bob is more likely to be chosen. (Depends on the implementation, other factors may influence probability, such as how long Bob had those candy vs Charles who also put in 10 candies.)
If Bob is chosen as the validator, he validates the new block successfully, and he will get additional candy as a fee (this usually has to less than the deposit). After sometime, after no bad activity is detected, his stake (or deposit) will be returned to him.
How do we prevent bad kids from inserting bad blocks (or replace a good one), or how do we even trust Bob who is the validator from approving bad blocks? During that window if Bob is discovered by approved bad block, his deposit of 10 candies will be taken away.
Moesif is the most advanced API Analytics platform, supporting Web3 JSON-RPC, GraphQL, REST and more. Thousands of API developers process billions of API calls through Moesif for debugging, monitoring and discovering insights.