Proof of Work With Demonstration

Ishita Rastogi
5 min readOct 27, 2020
https://en.bitcoinwiki.org/upload/en/images/thumb/5/55/Ea5b21f014547b4b44cf2dafcd76aad2.jpg/400px-Ea5b21f014547b4b44cf2dafcd76aad2.jpg

Proof of work is consensus algorthim originally proposed by Bitcoin. It is a solution of Byzantine problem.

But wait!!!

What’s that problem?

So, Story Time

Once upon a time there was a group of army generals formulate a plan for attacking a city.The generals must decide only whether to attack or retreat. Some generals may prefer to attack, while others prefer to retreat. The important thing is that every general agrees on a common decision, for a halfhearted attack by a few generals would become a rout, and would be worse than either a coordinated attack or a coordinated retreat.

But the problem became complicated by the presence of disloyal generals.For instance, if nine generals are voting, four of whom support attacking while four others are in favor of retreat, the ninth general may send a vote of retreat to those generals in favor of retreat, and a vote of attack to the rest. Those who received a retreat vote from the ninth general will retreat, while the rest will attack.The problem is complicated further by the generals being physically separated and having to send their votes via messengers who may fail to deliver votes or may forge false votes.

The above dilemma isn’t necessarily limited to just these generals. In a distributed network such as that of Bitcoin’s, all participants and nodes are essentially of equally hierarchy.

So, reliable computer systems must handle malfunctioning components that give conflicting information to different parts of the system.

Now, get back to our first line:

Proof of work is consensus algorthim originally proposed by Bitcoin.

Okay, But now what the heck is consensus ?

Blockchain is formed by groups of block joined together but how new block is added on blockchain? It starts by network agreeing on which transactions are valid. This is done by consensus.

A consensus algorithm is a process in computer science used to achieve agreement on a single data value among distributed processes or systems. Consensus algorithms are designed to achieve reliability in a network involving multiple unreliable nodes.

Originally dated back to 1993, Proof of work is originally designed to prevent denail of service attack.

In 2009 this technique of PoW again came back into picture when Satoshi Nakamoto created Bitcoin.It was used as a consensus algorithm that is used to validate transactions and broadcast new cast to the blockchain.

How does it work?

Miners on the network will compete against each other in solving complex computational puzzles. Mining new coins takes a lot of computing power because of PoW algo. Though they are complex to solve but easy to verify the correct solution. Once aminer has found a correct solution to the puzzle , they will be able to broadcast the block to the network where all the other miners will then verify the solution is correct or not.

In return for their time and resources, they are paid transaction fees thar are come directly from the users making the transaction. They are also rewarded by the networks with bitcoin that are created specifically as a reward for minning a new block.

Miners are trying to find the nonce of every new block

BLOCK + NONCE = HASH VALUE

When creating a hash for a block not just any value will work. The system require a very specific hash value that starts with certain number of Zeroes. These extra constraints make the hash value more difficult to find. To find that value we need to combine all the value of block with the nonce to try and generate the correct hash values. Computer guess the nonce over and over until finally they come up with the value that gives us the hash that meets these constraints.

In order to understand PoW much better let’s understand it with simple demonstration.

You can refer the website provided below to have a better understanding of concept.

https://anders.com/blockchain/block

Through this demonstration you will have better understanding of what nonce is and how it is related to block difficulty.

This will also give you better understanding of proof of work network and how it relates to the speed and security of the network.

You can enter any data of your choice. Basically it reflects your transactions. By entering data we get an unvalidated block that we need to find hash for.

As soon as you entered something into data look at the nonce that is the number. This is the number computer is trying to figure out to solve the problem needed for the PoW algorthim.

Aftering entering your data try to change your nonce by entering random number until the output has one leading zero.

Here output refers to that Hash present in the bottom.

If we need four zero then that can take lot longer. This guessing over and over again become extremely tedious, but it is only way to solve the problem.

The miners computers performs this manual checking and guessing.The more leading zero we need, the longer it will take to find the answers.

The number of leading zero requested is known as block difficulty.

This block difficulty can be changed by updating the algo to ask more and less zeroes. In bitcoin they adjust difficulty automatically to ensure that a new block is created after every 10 minutes.

Having a block after every 10 minutes is a decision made by the developers. It is because if block is created once every hour, the amount of transactions waiting to be verified increase drastically and the network would be too slow.

But if block is made every second then it might allow hacker the oppurtunity to change data before the network could catch the attack.

That’s why 10 minute is considered important. This decision can change for different networks.

Problems with Proof of Work

https://cdn.arstechnica.net/wp-content/uploads/2018/01/2nd-Rig-8-GTX-1070s-Manufactured-1.jpg
  1. High energy consumption.
  2. A monoply of miners leads to concern for decentralization.

--

--