Proof-of-Work (PoW)

Bitcoin, as well as most other cryptocurrency networks, is what is called a permissionless system. This means that anyone can become an active part of the network and, for example, propose new blocks. No participant needs to register anywhere or ask for permission. Between the lines, this means that we don't really know who is responsible for the messages that fly through the network. It also means that it's hard to do something like voting. We have a problem if we want to decide democratically what should be the correct next block, for example. There is no way to enforce that each participant gets one vote, or even a limited number of votes.

Bitcoin's solution is to tie block creation to work. The underlying assumption is that the ability to do work is more or less evenly distributed. But let's take a closer look at the problem first...

Naive example: blocks for free

In the example below, the top nodes are competitors, each tries to convince the third node that its chain is the correct one. The example uses a simpler version of Bitcoin's longest chain rule: The bottom node will assume that the longest chain it knows about is the correct one, and in case of a tie it will assume that the chain it learned about first is the correct one. The problem is that creating new blocks is really easy in this example... Try it! Then try confusing the bottom node!

The blockchain, as seen by noden3309Genesisblock
The blockchain, as seen by noden2619Genesisblock
The blockchain, as seen by noden4405Genesisblock

As you may have noticed, it's easy to arrive in a situation where honest nodes have to continuously revise their opinion about what the "true" history is (the blockchain is basically a logbook). This is not great - imagine the coin balance in your wallet fluctuating all the time because the system can't make up its mind about what happened.

We'll have to work then...

This is where Proof-of-Work (PoW) comes in. PoW means that a node needs to prove that it worked really hard on that new block. Only then is it allowed to add that block to the chain.

What is work? Unfortunately it can't be anything that is intrinsically valuable... In the context of Bitcoin's PoW, work is essentially: solving puzzles.

(This puzzle-solving is also known as mining. Nodes get to create new coins in each block they create, i.e., for each puzzle they solve. They are mining these coins...)

But what kind of puzzles are we talking about? Depending on how you explored this website, you might have already come across our page about cryptographic hash functions. What we didn't tell you there is that they are not only used for securing the integrity of the blockchain - they are also used for building the puzzles that ensure that nodes are working hard.

And the puzzles look like this: Given all the data that you want to include in a block, including the hash of the previous block, find some extra data to add to that block (the so called nonce) so that the hash of the resulting block starts with a certain number of zero bits. (It's actually a tiny bit more complicated than "starts with a number of zero bits", but this is a good enough approximation.) The number of zero bits describes the difficulty target - the more they are, the harder it gets. It's basically impossible to guess how many leading zero bits a cryptographic hash will have, so the only way to solve this puzzle is to try out many, many nonces... Each nonce is like a lottery ticket, nodes check it by calculating a hash with it, and if that hash has enough leading zero bits - then the ticket was a winning ticket!

Enough theory. Why don't you try it yourself? The example below is similar to the one above. But now you only control one of the nodes and you are only allowed to publish a block if you have solved the puzzle. You need to find a value (in the "Type anything" field) that leads to a hash with enough leading zero bits. We set the difficulty target to a mere 8 zero bits. That shouldn't be too hard, right? Oh and by the way that other node... it's also puzzle-solving...

The blockchain, as seen by noden3419Genesisblock
11111111 00111110 01010101 00000010
The blockchain, as seen by noden0589Genesisblock
This node is puzzle-solving (AKA mining)...
The blockchain, as seen by noden1064Genesisblock

And these are the very basics behind Proof-of-Work as it is used by Bitcoin and comparable blockchain systems. What we didn't cover, among other things, is that the difficulty of creating new blocks is adapted over time. We also didn't discuss the many criticisms that can be voiced against PoW-based systems, for example that their energy consumption is HUGE. You might find pointers for further study in the "Beyond" section.