Swimming into the Shores of Bitcoin: Proof of Work(PoW)
#bitcoin #oss #bitcoinopensourcing
Swimming into the Shores of Bitcoin: Proof of Work(PoW)
As a systems/devops engineer, I have been looking to start a hobby since the beginning of the year, swimming for instance or even tennis.
But somehow, I have found myself swimming into the shores of Bitcoin open sourcing. Over the next few months, I will be digging around the technologies in Bitcoin and around Bitcoin.
One of the first things that caught my attention when I started going through the Bitcoin material was Proof of Work. I had heard the term before, and I understood it at a high level, but I don't think I had really stopped to think about what it means to use work as a form of proof.
That made me step back from Bitcoin for a moment and ask a much simpler question:
What does it actually mean to prove something?
We Are Always Proving Things
In our everyday lives, we are constantly asked to prove things.
If I say I paid for something, I can show a receipt.
If I say I am a particular person, I can show an ID.
If I say I know something, perhaps I can demonstrate it by answering questions or taking an examination.
The interesting thing is that these are all proofs, but they work in very different ways.
An ID works because there is an authority that issued and recognizes it. A receipt works because there is a record of a transaction. In each case, there is some underlying reason why another person should accept the evidence.
That got me thinking about Bitcoin.
Bitcoin was designed to operate without requiring a trusted third party to keep the final record of who owns what. But if there is no central body, how does everyone agree on what happened?
This is where the idea of Proof of Work starts to become interesting.
Proof That Does Not Depend on Who You Are
Imagine two people making competing claims. One person says: "I did the work.", the other person says: "No, I did it."
If there is an authority in the middle, then the authority may decide who is telling the truth.
But what happens when there is no authority? Then you will need to present evidence or a form of it that both parties can independently verify.
This is one of the things I find powerful about Proof of Work.
Bitcoin does not require the network to know who a miner is or to trust the miner's word about how much effort they put into creating a block.
Instead, the miner has to produce a result that satisfies a condition defined by the protocol.
The interesting part is that producing that result requires computational effort, while verifying that the result is valid is comparatively easy.
The miner does not get to say: "Trust me, I spent enough time computing.". The network can simply check the proof.
Turning Work Into Something Verifiable
This is where the word work becomes important.
Bitcoin uses a cryptographic hash function, SHA-256, and miners repeatedly perform calculations while changing values in the block header until they find a hash that satisfies the network's requirement.
In the original Bitcoin whitepaper, Satoshi described this as finding a value such that the hash of the block begins with a required number of zero bits. In practice, the miner changes values in the block header, particularly the nonce, and keeps hashing until they find a result that satisfies the current difficulty.
There is no practical way to know beforehand which nonce will produce a valid result. The miner therefore has to keep trying:
Hash(BlockHeader)→required number of leading zero bits
The more restrictive the requirement, the fewer possible hashes will satisfy it, and the more attempts a miner will generally need to make.
Modern Bitcoin expresses this requirement using a numerical target. The rule can be represented as:
SHA256(SHA256(BlockHeader)) < Target
Since SHA-256 produces a 256-bit output, there are (2256) possible hash values. The probability of any single hash being below the target can therefore be approximated as the target divided by (2256).
This also helped me understand something important about Bitcoin's difficulty. Increasing the difficulty does not make SHA-256 itself slower or more complicated. Instead, it makes the acceptable range of hashes smaller, meaning miners need more attempts on average before finding a valid one.
The important part is not that the miner is doing something useful in the traditional sense. The work is valuable to the Bitcoin protocol because it creates a computational cost that can be independently verified.
This gives Proof of Work an interesting asymmetry:
It is expensive to produce but relatively cheap to verify.
A miner may have to perform an enormous number of attempts before finding a valid result, but another participant does not need to repeat all of that work to confirm the solution. They can simply hash the block and check whether the resulting value satisfies the required target.
That sounds simple, but I think it is a very powerful property when you consider the problem Bitcoin is trying to solve.
Why Make It Expensive?
This was one of the questions I found myself asking.
Why should Bitcoin require anyone to spend computational resources just to add a block?
The answer starts to make more sense when thinking about what happens if producing blocks is essentially free.
If anyone could create competing versions of the blockchain at almost no cost, it would be much easier to create conflicting histories.
Proof of Work introduces a cost.
To produce a valid block, a miner must perform the required work. To rewrite a block that already has subsequent blocks built on top of it, an attacker would need to redo the work and then catch up with the chain being extended by the rest of the network.
The blockchain therefore accumulates something that is more than just a list of transactions.
It accumulates proof of computational work.
The further back you go in the chain, the more work is sitting on top of that history.
Proof of Work as a Form of Commitment
This is probably where Proof of Work became more interesting to me.
In real life, when someone puts effort into something, that effort can create a form of commitment.
If I spend hours building something, I have invested something that I cannot simply get back.
Proof of Work introduces a similar concept into a digital system, although the resource being committed is computational effort and the associated cost.
A miner spends resources attempting to produce a valid block.
Once the block is accepted and more blocks are built on top of it, changing that history requires repeating the work.
So computational work becomes more than just computation. It becomes a cost attached to a particular version of history.
That is a very interesting idea for a decentralized system.
From Trusting People to Verifying Evidence
Going back to the examples from everyday life, most of the proofs we use depend on something. An ID depends on an issuing authority. A certificate depends on an institution.
Proof of Work takes a different approach.
It does not ask me to trust the identity or reputation of the person who produced the proof.
I can verify whether the proof satisfies the rules.
That does not mean Bitcoin eliminates trust completely. There are still assumptions involved in Bitcoin's security model, including assumptions about the network, the distribution of computational power and the ability of nodes to independently verify the rules.
But the important shift is that the protocol tries to replace certain forms of interpersonal or institutional trust with something objectively verifiable.
And I think that is a fascinating idea.
What Proof of Work Means to Me
Before this fellowship, I mostly thought of Proof of Work as the mechanism that makes Bitcoin mining difficult.
Now I see it differently.
To me, Proof of Work is an example of turning a physical-world resource, in this case computational effort and the costs associated with it, into something that can be represented and verified in a digital system.
The idea is simple enough to explain, but its consequences are much bigger.
A network of participants who may not know or trust one another can use a publicly verifiable proof of computational work as part of the process of agreeing on a shared history.
That is a very different way of thinking about proof.
And perhaps that is what makes Bitcoin so interesting to me.
I started this year looking for a hobby.
I thought it might be swimming.
Instead, I somehow ended up swimming into the shores of Bitcoin open source, and now I am finding myself asking questions about what it means to prove something, how computers can create that proof, and how something as ordinary as computational effort can become part of the security model of a global decentralized network.
This is only Week One.
There is clearly a lot more swimming to do.