Thoughts, stories and ideas.

How does Proof of Work (PoW)...work?

How does Proof of Work (PoW)...work?

Proof of work is the consensus mechanism that happens during the mining process, and that guarantees that the Bitcoin blockchain is really decentralized, p2p, and secure. If you understood this sentence clearly...congratulations, you are way past Bitcoin 101 and can move on to the next sections.

But with this next piece, we want to help the rest of the people know their way around the Bitcoin protocol. Indeed, you don't need to be a watchmaker to read the time, but if you're trusting some of your money and your future to crypto, you're better off knowing about the nuts and bolts of blockchain.

To understand the initial sentence, we need to climb a ladder of concepts: some blockchain basics and an approach to what miners are and what they do, and then a closer look at the block validation process, which is where Proof of Work happens.

Blockchain first! What Satoshi Nakamoto proposed in 2009 was a solution to several long-standing conundrums that had prevented decentralized digital money from happening. All attempts to exchange value over the internet required a central authority -banks, governments...- supervising the process.

Nakamoto solved the problem of digital scarcity and double-spending. Any asset shared digitally creates two copies. For example, think of a pdf sent through email. The receiver gets a copy of the pdf, while the original still exists in the sender's drive. This creates double-spending.

We call double-spending the possibility of spending twice the same money. This is impossible with physical money (you cannot hand out a coin and also keep it). In the case of digital money, it´s the responsibility of banks and payment processors to make money disappear from the sender's account.

In other words, Bitcoin is the first system where a digital file can be transferred without generating copies.

Avoiding double-spending and creating digital scarcity without intermediaries is the single, most revolutionary contribution of blockchain technology to the world. This is achieved through true decentralization. The Bitcoin blockchain is the result of a complex puzzle of technologies and solutions working together to create trust between people who don't know each other.

At its core, a blockchain is nothing more than a database—an uber-Excel spreadsheet where the information of all transactions is recorded. But instead of there being a central authority, a bank, writing down that sheet and keeping a copy safe, it is a community of miners who is in charge of management. Miners are special actors in the system: they are people running the Bitcoin protocol in their computers and keeping a copy of the validated database. Anyone can become a miner if they have the will and the hardware to do it; some stats say there are around 1M people worldwide mining bitcoin. One million copies of the transaction list. Imagine trying to hack that.

Now it's time to see Proof of Work in action. Every time two people make a transaction in bitcoin, this is the process:

Let´s say Abe and Betty want to exchange BTC. Their transaction enters the mempool (comes from Memory pool), a waiting room of sorts where transactions wait to be validated and approved.

Abe and Betty’s transaction meets a lot of friends in the mempool. They all patiently wait to be bundled.

https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F4b768e4b-e67d-4c06-b75a-855aec122802_1291x725.png
Abe and Betty´s transactio meets their friends in the Mempool

Every miner then accesses the mempool, makes a bundle out of many transactions, and proposes this bundle to the community. That block, aka "candidate block," is each miner’s proposal of what the next block in the chain should look like. At this point in the process, hundreds of thousands of candidate blocks could be validated. But, just like in Highlander, "there can only be one."

Each miner makes her own version of the next block in the blockchain with the transactions they decide. Abe and Betty´s transaction waits in some of them.

https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2939ecf-3aa7-466a-941f-f48c91977f02_1297x728.png
Abe and Betty's transaction gets added to some candidate blocks

And here’s when proof of work kicks in.

Bitcoin needed a process to pick one block out from all the possible candidates -to find “the chosen one.” To make validation automatic but also fair, Satoshi Nakamoto decided two things: one, miners who got their candidate block picked would be rewarded in bitcoin to incentivize them to participate; two, to get their block picked, they should prove their interest by putting effort into the process. Miners’ computers have to solve a complex mathematic puzzle that requires consuming computer power and energy.

In other words: when miners bring forth their candidate blocks, a race starts between them, where the first one to solve a super-sudoku and show it to the rest wins. Their block then becomes the chosen one. Finally, it is appended to the official blockchain. The resulting database is then spread across all computers that participate in mining, thus setting it in stone forever and ever, amen. And… the process starts again.

The sudoku competition winner gets her block approved, the rest of the miners applaud, and the block gets added. Abe finally sends 1BTC to Betty.

https://cdn.substack.com/image/fetch/w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F7722fb80-6e03-4ddf-911d-2611e7828815_1293x729.png
Abe and Bett's transaction is in the approved block. The operation is complete now

Satoshi Nakamoto's genius was designing a structure where a huge network of anonymous miners are incentivized to work cooperatively, validating and adding new blocks to the blockchain. And a huge community of miners cooperating is the defensive moat against hacking. Proof of Work is the automatic process where miners agree on what transactions are valid, add them to the database, and update the database copies on their computers.

Proof of work is the consensus mechanism that happens during the mining process, and that guarantees that the Bitcoin blockchain is really decentralized, p2p and secure.

Does the sentence make more sense now?

Proof of Work is the heart that pumps transactions into the Bitcoin protocol. And, as hearts do, it consumes great amounts of energy. Proof of Work requires participants to invest energy (and the money and time tied to it) if they want to participate in Bitcoin as miners. And, as we have seen, energy consumption is one of the most relevant reputational issues in the space. It has caused Elon Musk to back up from his initial pledge of allegiance, it might be behind China’s current hard position on Bitcoin, and it is frequently mentioned in press conferences by relevant political figures as a problem that, as long as it remains unresolved, will be an obstacle for governments to have a more welcoming position towards crypto.