Boom Boom PoW, Proof-of-Work

Seokjoong Yoon
DSRV
Published in
10 min readJun 13, 2022

DSRV Research publishes in-depth blockchain-related content with the aim of safely onboarding more people to Web3.

Disclaimer: This article is for informational purposes only and should not be taken as financial advice. No information contained within this article is a recommendation to invest in any of the assets mentioned. All investors are advised to thoroughly conduct their own research before making any financial decisions.

Proof-of-Work: What Does it Mean?

[Consensus Algorithm Series]

  1. Boom Boom PoW, Proof-of-Work
  2. Show Me What You Got, Proof-of-Stake

We’re living in an era where you can mine Bitcoin or Ethereum from the comfort of your own home. But what exactly comes to mind when we talk about mining? And if this is something anyone can do, how does it retain value?

While there are many answers as to why Bitcoin has real value, a major one is its underlying mechanism known as Proof-of-Work (PoW). Miners play a key role in this process, by providing the labor necessary to allow value to be transferred between individuals (peer-to-peer) without relying on a middleman. This infrastructure also provides a solid foundation for applications built on the blockchain. Ultimately, the work that miners do can be understood as the fundamental source of value for Bitcoin or Ethereum.

So let’s have a closer look at Proof-of-Work, one of the first building blocks on your journey to understanding blockchain.

So What is Proof-of-Work? (ft. Bitcoin)

The first proposal of Proof-of-Work: Bitcoin Whitepaper

TL;DR:

PoW uses computers to solve a problem that can only be solved via trial and error, i.e. repeatedly inputting different values. Miners are incentivized to participate honestly and earn block rewards in the form of cryptocurrency awarded to the first miner that solves the problem. Cheating the system, on the other hand, becomes prohibitively expensive and highly unlikely the longer the chain gets.

Proof-of-Work, as we know it, was first proposed in a paper published by anonymous developer Satoshi Nakamoto, titled “Bitcoin: A Peer-to-Peer Electronic Cash System”(a.k.a. the Bitcoin Whitepaper) [1]. The paper also references Adam Back’s HashCash, an anti-spam tool requiring senders to perform a simple computation in order to send an email, thereby drastically reducing the number of spam mails [2]. So, why exactly did Nakamoto propose Proof-of-Work? He introduced it as a solution to the double-spending problem– a critical issue in digital payment systems where the same assets are used more than once.

Traditional finance (digital or not) circumvents this problem because its ledger is managed by a centralized entity. This simply requires that we trust our bank, card, or insurance company. But in a decentralized network like Bitcoin, whom should we trust? According to Nakamoto: the first person to solve the problem we’re all trying to crack.

Proof-of-Work From a Miner’s Perspective: Difficulty and Nonces

When most of us (who know a thing or two about Bitcoin) think of mining, we think of a room jam-packed with overheated computers and their frantic cooling fan counterparts. This means Bitcoin or Ethereum is currently being mined, but what exactly must miners do in order to participate?

In a nutshell, Proof-of-Work is how we produce a new block in a blockchain. The first miner to solve a specific mathematical problem set by the protocol wins the right to produce the next block. Let’s take a closer look at this process.

A miner will first create a temporary block on their computer. This block is not shared with others throughout the network yet, and is known as a candidate block. There can therefore be several candidate blocks at once. All bitcoin transactions are temporarily stored in a space called the mempool, where they wait to be chosen by miners and included in the next candidate block. In order to receive the block reward, the miner must broadcast their candidate block to the network and, if accepted, all other miners will update their blockchains accordingly with the new block.

Of course, it’s a bit more complicated than that. For starters, not every candidate block can be added to the blockchain. For a candidate block to be valid, the miner in question must produce the correct answer to the mathematical problem mentioned earlier. This is achieved by trying out different random values, known as nonces (short for number only used once), and hashing them along with the transaction data until the desired answer is found. Let’s break that down by looking at an example.

Bitcoin block information. Source: Blockstream Explorer

The above image gives us information on the 722,383rd block of the Bitcoin blockchain. The value in the red box 000000000000000000082462175c36ccc2a2ed2f67f38b4b400e02f9b16fb2a6is known as the block hash. The block hash is the output of hashing all the values marked by an orange box (TIMESTAMP,VERSION, MERKLE ROOT, BITS, NONCE) together with the previous block hash.

Terminology: What is a cryptographic hash function?

A cryptographic hash function is a function that converts or “maps” an arbitrary length of data into a fixed-sized, compressed value known as a hash value. It is known as a one-way function, as it is virtually impossible to guess the input from the output. If we modify a single character or number of the input, the resulting hash value changes completely. To reiterate, the block hash in the image above is the output of Hash(PREVIOUS_BLOCK_HASH, TIMESTAMP, VERSION, MERKLE_ROOT, BITS, NONCE).

Here, every value except the NONCE is static, meaning that they are fixed values and do not change. The only value that miners can modify is therefore the NONCE, which they must guess at repeatedly in order to find the unique value that generates the desired output. This is effectively the ‘work’ that Proof-of-Work refers to.

Referring to the above image once more, we can see that the block hash of Block 722,383 begins with 19 zeros. We can therefore assume that one of the prerequisites for this block was to find a nonce value that, when passed through a hash function, generates an output that starts with 19 zeros. Since the input cannot be inferred from the output, miners have no choice but to randomly plug nonce values into the function until a block hash that satisfies this condition is found. This consumes a considerable amount of computing power, referred to as hash power (and explains why mining rigs need cooling fans!).

Let’s look at a couple more terms. The target hash refers to the value that a block hash must be less than or equal to, in order for the block to be added to the blockchain. The more zeros at the start of the block hash, the lower the value. The difficulty of finding a block hash value that is less than the target is called difficulty. Bitcoin is programmed to maintain a block production rate of one block every 10 minutes. If it takes under 10 minutes to find a block hash that satisfies the specific condition, the difficulty is increased by adding more zeros at the start of the target hash. The greater the difficulty, the greater the number of operations miners will have to execute to solve the problem.

Bitcoin Difficulty chart: Source: Coinwarz

In June 2021 (marked above in the red box), there was an incident in which 90% of Bitcoin mining in China was halted due to tightened regulations. As you can see, if the number of Bitcoin miners decreases, the hash power of the entire Bitcoin network decreases as well; and as it takes more time to find the nonce value, the difficulty is therefore reduced in order to maintain the 10-minute block production cycle.

As a result, difficulty closely correlates with hashrate, which is the sum of all the hash power (computing resources) used in mining. The higher the hashrate, the greater the security of the chain, since attacking the network would incur incredibly high computational costs.

The Missing Puzzle Piece: Solving The Double-Spending Problem

One of the reasons Bitcoin is considered to be so innovative is that it offered a new solution to the double-spending problem in peer-to-peer (P2P) networks. As we briefly touched on earlier, double-spending refers to when the same token is used more than once. A centralized fintech company like Paypal can avoid this as it only has to manage a single database, and can restrict user access to data. However, in a decentralized P2P network, each node operates its own database and anyone can access this data. So how did Bitcoin get around this?

In order to prevent double-spending, confirming the order of transactions is imperative. Let’s assume that A’s balance is 1 BTC, and A is trying to send B and C 1 BTC each. If there is no consensus on which transaction occurred first, i.e. if the transactions occurred almost simultaneously, then it is possible to double-spend. But if either transaction is confirmed to have occurred first, double-spending becomes impossible. Simply because if A has already sent their 1 BTC to B, they will no longer have any BTC to send to C.

In the Bitcoin Whitepaper, this mechanism to determine the order of transactions is called the Timestamp Server. The block hash, which is the output of Hash(PREVIOUS_BLOCK_HASH, TIMESTAMP, VERSION, MERKLE_ROOT, BITS, NONCE) is at the core of the Timestamp Server mechanism. The element to focus on here is PREVIOUS_BLOCK_HASH. As the previous block hash is used to calculate the block hash of the current block, if the former is altered, the current block hash also changes completely. In other words, if the nth block is modified, so are n+1, n+2, and so forth. The blockchain is therefore designed to make it exceedingly difficult to modify a past block, since every new block after it would have to be redone as well.

In this way, each new block is linked to the previous one to form a chain. A linear chain can therefore be understood as both a continuous ledger that ensures the order of transactions and the cumulative result of miners’ computing resources. The more blocks that are added after a block with a given transaction, the greater the hash power required to modify that block, and the less likely it is to be tampered with.

💡 ONE STEP FURTHER: Can two transactions attempting a double-spend be included in the same block?[3]

Since each node that participates in the network must validate all the transactions in the proposed block, any blocks containing invalid transactions (like those that attempting to double-spend) are ignored. To be precise, each node will validate the block through the following process:

1. Verify whether the PREVIOUS_BLOCK_HASH of a proposed block is equivalent to the actual block hash of the previous block.
2. Confirm whether the chronological order of the blocks is correct by checking whether the TIMESTAMP of the proposed block is greater than the TIMESTAMP of the previous block. 3. Check the nonce and block hash values to verify whether the Proof-of-Work was properly performed.4. Set S[0] to the last state of the previous block. 5. Assume that TX is a list of n transactions in the proposed block. For i from 0 to n-1, execute the following: S[i+1] = APPLY(S[i], TX[i]), and if an error occurs, reject the block.

The process of verifying whether all transactions are valid occurs in Steps 4 and 5.

Wrap-Up

Bitcoin and Ethereum, the two legacy PoW blockchains, not only account for around 60% of the total cryptocurrency market cap, but also support a core philosophy within crypto discourse. And although Ethereum is gradually making its transition to Proof-of-Stake (PoS), Proof-of-Work remains one of the fundamental elements behind the spirit of the industry today.

What we are referring to specifically are the cypherpunk roots of crypto.[4] Centralized computer systems are inherently restricted and siloed in order to minimize security risks, and they also require personal user data to efficiently maintain a multi-database system across different institutions.[5] Seeking to push back against institutional and government monopoly, surveillance, and user behavior analytics, the Cypherpunks introduced a new decentralized system made possible by cryptography. Satoshi Nakamoto’s Proof-of-Work is a crucial element within Cypherpunk philosophy because it enabled decentralized P2P transactions without the need for a centralized third party.

So far, we’ve looked at why Proof-of-Work came about, the important problems it solved, and how it’s structured on a technological level. Of course, the debate about whether Bitcoin is just a piece of code or a new monetary system with real intrinsic value will go on. But that’s a story for another day. For now, we hope this provides the starting point you need to continue learning about this space. Welcome to the jungle.

We got everything you want —

Written by
Seokjoong Yoon, DSRV Research Associate (Twitter @imlearning_eth)

Reviewed by
Owen Hwang, DSRV Research Manager (Twitter @journeywith_eth)
Youngbin Park
, DSRV Research Associate (Twitter @bin0_0bin)

Translated by
Domitille Colin, Communications Manager (Twitter @domitille_marie)

Illustrations by
Heeyoung Moon, Brand Designer

💊 Key Takeaways

  1. The process of finding a nonce that satisfies the specific condition of the block hash is what constitutes the ‘work’ in Proof-of-Work.
  2. This work involves determining the order of transactions and preventing double-spends.
  3. The more a computer engages in this process, the greater the difficulty of mining, and the more secure the network becomes overall.

References
[1] Bitcoin Whitepaper
[2] HashCash Whitepaper
[3] Ethereum Whitepaper — Mining
[4] nakamoto.com — The Cypherpunks
[5] Security Without Identification: Transaction Systems To Make Big Brother Obsolete by David Chaum

--

--

Seokjoong Yoon
DSRV
Writer for

Blockchain Researcher @DSRV. Twitter @imlearning_eth