# What is Proof Of Work (Pow) How does i work ?

As the price and interest peaked in 2017, the interest in bitcoin is increasing day by day. There is almost no bit of bitcoin around us. I am sure those who are a bit more introverted with Bitcoin have also heard of Proof of Work (PoW). So what is this Proof of Work? How does it work? Why is it important?

Proof of Work, “Proof of Work” is actually one of the cornerstones of the reliability of blockchain technology. However, before we can understand Proof of Work, we need to know what “Hashcash” is. In order to know Hashcash, we need to understand Cryptographic Hash Functions roughly. So, first we will start with the cryptographic summary function and what Hashcash are and then we will learn Proof of Work.

**Cryptographic Hash Function**

This function takes input of any length and produces a fixed summary. While it is very easy to produce a summary of a given input, it is impossible to find the input of a given summary, and there is no other way than trying the entries one by one. This is because the result of the summary is completely random. The smallest change in input will produce a completely different summary. One of the most important examples is SHA256, and the length of the summary, as the name suggests, is 256 bits. There are many websites on the internet that can calculate this online. For example, let’s make an example

hello -> SHA256 -> 4c6bcdd55f3153e1939669ab1ec039e4059174dc25abdfcb2f58868849b4d61b

merhabb -> SHA256 -> 8775b90bf257388326699cc40f608b3f49cf5d09288ea8f7b1f6acf2f30c0dfb

In the example you see above, a single character change produces another totally irrelevant summary. This makes the summary completely unpredictable and random.

**Hashcash**

In 1997, email users developed an anti-spam mechanism using Adam Back’s cryptographic hash functions. This mechanism worked as follows: Every time the user wants to send an email, the mail server has the user calculate a cryptographic digest function, which he has already calculated and known. Calculating this summary function for a legitimate user takes, for example, around a second, and waiting a second before each email does not bother the legitimate user. But if a malicious user wants to throw a million spam emails, it will wait 1 million times for 1 second and this will take a very long time. With this use, Hashcash is an example of using cryptographic digest functions as evidence of doing a particular job.

In fact, the cryptographic hash function (especially SHA256) and Hashcash were the algorithms that existed before the blockchain or bitcoin was found. The inventor of Bitcoin, Satoshi Nakamoto, used these algorithms to design the Proof of Work (PoW), “Proof of Work” protocol in bitcoin.

**What is Proof of Work (PoW)? How does it work?**

In Bitcoin, Proof of Work based on Hashcash mentioned above is used. This process is also known as “ mining ” and it takes place as follows. In order to find a summary with predetermined features, miners try any input that might be possible by using brute-force. The miner, who first finds the summary that provides the desired format, is entitled to produce the new block on the blockchain. If the incoming transactions (transactions) are suitable, they are approved and rewarded for the work they do. Since the result of the summary function is completely random, all miners have a chance to get the prize, but whoever can test more inputs faster will have a higher chance. Currently, it can find trillions of summary (Hash Rate) that all miners can calculate in one second [3] .

To get the right to generate the blog, the result of the summary function found must be in a certain format. This format is set with a variable called difficulty. The difficulty value is adjusted so that a block can be produced every 10 minutes. As the difficulty level increases, it becomes more difficult to find the summary in the given format. The current difficulty can be easily learned from here

We can understand difficulty more easily as follows. Suppose we gave any input to SHA256, it will produce a 256 bit summary. The first bit of this summary is either 1 or 0. So the probability that the first bit is 0 is 50%, and you can find the input that gives the summary with the first bit zero at most in your second attempt. If we want the first two bits to come to 0, the probability drops to 25%. This way, if someone asks for a summary from the first 10 bits of zero, the number of entries you need to try increases considerably. The variable of difficulty is proportional to the number of zeros required initially, and this is exponentially inversely proportional to the work to be done.

You can look at the latest published blog, the summary corresponding to the blog, the summary of the previous blog, and more information about the block from blockchain.info . For example , let’s look at the current block [5] together.

Summary: 00000000000000000026a5939af2dd003626aaa559452a414b95eb3cb1144ad4

As can be seen, the requested summary is as above and was found by the miner named ViaBTC and the miner has won 12.5 BTC. The successful entry is 508263787.

**Why is it important?**

Blockchain can be thought of as consecutive blocks in the form of a chain, which can be added in one direction only. To protect the queue, each block also contains a summary of the previous block.To understand the importance of PoW, let’s consider the following example. Considering the simple example above, let’s say someone malicious wanted to replace Block 1. The smallest change in Block 1 will completely change the summary of Block 1 and no longer provide the desired difficulty level. The malicious person has to find a new summary that provides the difficulty level, for this he has to repeat the whole PoW process. As soon as he finds the appropriate summary for Block 1, he will have to find it for Block 0, so he will have to find all the appropriate summaries again until the last block.

In summary, as in the example we have described above, the blocks cannot be changed after being published. There is only one way to change it. It is to repeat all the previous mining or digestion processes made until the last blog. This is impossible with today’s technology.

[1] – http://www.xorbin.com/tools/sha256-hash-calculator [2] – http://www.hashcash.org/papers/announce.txt [3] – https://blockexplorer.com/api/status?q=getDifficulty [4] – https://blockchain.info/charts/hash-rate [5] – https://blockchain.info/block/00000000000000000026a5939af2dd003626aaa559452a414b95eb3cb1144ad4