What the heck is PoW (Proof of Work)?

So you want to know what is the Proof of Work? Ok, here we go!

Mikko Mielonen
The Capital
Published in
5 min readMay 16, 2020

--

The concept was first presented by Cynthia Dwork and Moni Naor in an article in 1993. The name for it was first formalized in a 1999 paper by Markus Jakobsson and Ari Juels. That is all for the history lesson part.

How does it work then?

The first key element of the PoW system is that it must be an asymmetric problem, which means that it is at least moderately hard to solve but very easy to check the right answer.

One kind of PoW that you must have run into is a CAPTCHA. It is easy and simple for a human to solve, but not so much for a computer. Also, it is very easy to check if you were able to click the right pictures.

It is effortless for a human to find the pictures with parking meters here. But it will need quite a computational power for a computer to do the same. This is exactly what an asymmetric problem might be for a computer to solve, but it will be an easy check since the CAPTCHA already knows which pictures must be selected.

But how does this relate to blockchains? It doesn’t really.

Now let’s have another kind of problem. This is a mathematical problem and it will bring us closer to how this works in Bitcoin, for example. Let’s talk about integer factorization. It sounds hard but it actually just means how to present a number as a multiplication of two other numbers. So I will give you a problem to solve and better understand the premise:

The numbers we want to use in this are the natural numbers (1,2,3… and so on) in these examples and also you can not use the number 1 (so you can’t just have 1 * 15 = 15). So there are 2 numbers X and Y which multiplied will give the following result: 15.

X * Y = 15

So that was an easy problem and yes you are right it is 3 and 5. It took you a second, maybe a few to find the solution. Let’s try one that is a little harder.

X * Y = 69 (nice)

So this was a little harder but still a quick problem. It might take only a few seconds to find out the solution but it was definitely harder than the first problem. So let’s try one more just for the fun of it.

X * Y = 221

This is even harder to do in your head. It might take you quite a long time so let’s reveal the answers 3 * 23 = 69 and 13 * 17 = 221. What does this mean and how is this relevant information?

So you might have noticed something weird about the numbers I have selected to present X and Y (3,5,13,17,23). Those are all prime numbers! When you multiply with two prime numbers there will only be one solution to that problem. So I knew what solutions you would end up with if you didn’t fail with math. This is very important because had I told you that the solution is only prime numbers it would have been easier to solve the problems, especially the last one.

Now, this is easy with such small numbers but it gets very hard with large numbers. And the best part is that there are no shortcuts; you will have to brute force it (try out each and every smaller prime number to find the solution).

Evolving

There are many different kinds of PoW systems or protocols. This just means how the problems are set up and how the problems are solved.

As an example, Bitcoin uses a hashcash PoW system. There is nothing too fancy about it. The same one is used for example to limit spam email. This is why it takes you a small amount of time to send an email; besides actually sending the contents of said email. This is how an email works:

Your computer solves a small hash out of your written email (it is the timestamp when you sent it and your email address) and sends both the solution and the email. Now the receiving computer can easily check the solution and if it matches the received email, accept the email.

Now, this is barely noticeable with modern computers but if you want to send thousands of emails at a time it will start to add up solving all the hashes.

Here is an example of it with SHA1 (Secure Hash Algorithm 1) which is used by email:

SHA1(“The quick brown fox jumps over the lazy dog”) gives hexadecimal: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12

gives Base64 binary to ASCII text encoding: L9ThxnotKPzthJ7hu3bnORuT6xI=

Compare it with this sentence:

SHA1(“The quick brown fox jumps over the lazy cog”) gives hexadecimal: de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3

gives Base64 binary to ASCII text encoding: 3p8sf9JeGzr60+haC9F9mxANtLM=

Kudos to https://en.wikipedia.org/wiki/SHA-1

So only by changing one letter by mistyping the word “dog”, you have a completely different hash and that is the beauty of it. It is completely deterministic (it will always result in the exact same solution. You can’t change anything on your message without scrambling the whole hash.

So now the receiving computer can easily check if this was done before sending and if it wants to accept the email. Note that this is a simplification on what actually happens behind your monitor but the basics are there.

Now the Bitcoin network uses SHA256 (Secure Hash Algorithm 2) 256 bits long version of NSA developed cryptographic hash function. This is more secure and time-consuming to solve than the SHA1. If you want to know more about the specific algorithm you should visit the Wiki page https://en.wikipedia.org/wiki/SHA-2.

So in the Bitcoin network, a dumbed-down version would be something like this:

  1. Gather data
  • A part of the hash of the previous block
  • Some initial data of the new block
  • Transactions you want to have inside this block

2. Start solving the hash of this new block with all the data inside. The Bitcoin network will decide how accurate the solution you need to find to verify the new block.

3. When a solution is found the block gets verified by the network.

4. Repeat.

What does this all mean?

So what did we learn so far?

You will have to solve a problem that is at least moderately hard but easy to check if you solved it right.

The harder the problem you are solving the more energy and time you need to solve it.

Solving these problems is completely deterministic. The same data will always result in the same hash when using the same algorithm. Just change one letter or number and the hash will be completely different.

Those just happen to be the basic principles of the PoW system.

Now go do what you want with this information!

Photo by Ben White on Unsplash

--

--

Mikko Mielonen
The Capital

Entrepreneurial engineer. I am interested in writing and sharing my ideas and train of thought. I hope some of it makes sense.