In-Depth Report: Bitcoin Mining — VegaX Research Report
As the saying goes “Bear markets are for building.” Throughout this year’s market downturn, the VegaX Research team has been doing just that: we have committed to providing our clients and readers with high-quality educational materials that we hope will help to understand the complex crypto ecosystem. This report will pick up on the threads initially touched upon in our first bitcoin-centric installment, and then expanded upon further in a later installment; this time, we will take a deeper dive into the world of bitcoin mining.
The structure of the article will be as follows:
- We will discuss Proof of Work in a philosophical sense, and then introduce the bitcoin network’s PoW protocol from a technical point of view.
- We will address some commonly held misconceptions about bitcoin mining as an individual practice, and as an industry.
- We will walk through the end-to-end process of mining, taking time to explain concepts, details, and terms that are sometimes glazed over.
- We will conclude with reasons why Proof of Work is necessary for the continued functioning of the bitcoin network.
Proof of Work
Investopedia succinctly defines Proof of work as “a system that requires a not-insignificant but feasible amount of effort in order to deter frivolous or malicious uses of computing power, such as sending spam emails or launching denial of service attacks.” The definition makes reference to frivolous uses of computing power, and this is a very important point. When constructing systems, especially digital systems, the engineer must assume that all frivolous use cases for that system will be exploited for some actor or entity’s benefit. Proof of work reduces the tendency for the system to be abused by adding an economic cost to the utilization of the network.
The idea was first implemented by cryptographer and early member of the cypherpunk movement, Dr. Adam Back in his “Hash Cash” protocol. Hash Cash was designed as a system to help combat email spam and Denial of Service attacks. In its most simplistic, email-specific form, the protocol involves the sender of an email message generating a cryptographic “stamp”, with which the recipient can verify with relatively little computational effort. The idea here is that a spammer’s business model relies on being able to send messages at zero cost, if the cost were to increase even modestly, they would cease to be profitable and abandon the pursuit.
While Dr. Back likely did not intend to create a building block for the bitcoin network nearly a decade before its inception, his Hash Cash proof of work implementation is the proof of concept and basis upon which the security of the bitcoin network is derived. Recall that the bitcoin network is a network of nodes (computing devices) that are running a version of the bitcoin software; that software has rules that qualify whether a transaction or block of transactions is valid or not. Bitcoin’s particular implementation of proof of work secures the network and enables nodes to reach consensus on the longest chain of blocks because, as we will expand upon in the next section, a non-trivial amount of processing power is required to have a chance at creating the next block in the chain.
Setting the Record Straight
Among the most often repeated misconceptions about bitcoin mining is that the miners who participate in block construction are doing so by “solving complex math problems.” This is not the case; while there is competition, bitcoin’s proof of work algorithm is more akin to a lottery than a de-facto competition.
The bitcoin network proof of work algorithm is based upon the SHA-256 hashing function. Fundamentally, hashing is a data compression method that converts an input of arbitrary length into an encrypted output of fixed length — 256 bits, in the case of bitcoin. Additionally, hashing is a one-way function, meaning that an output cannot be “reverse-engineered” in order to discover the input. One thing to note in this regard is that if the inputs are identical, so too will the output hashes. Further, hashing functions are subject to the so-called “avalanche effect,” meaning that one tiny change in an input creates an entirely different output.
Proof of work in the bitcoin network is centered around the mining target — a predetermined number (hash value) that a miner’s proposed block must be equal to or smaller in value in order for the proof to be satisfactory. We will go into greater detail in subsequent sections, but for the purposes of introducing the concept, note that the only way to find a proposed block hash that is beneath the target value is to “brute force” the algorithm, or in other words, embark on a frantic game of guess-and-check.
When a miner is constructing a proposed block, they create a block header — the actual input that is passed through the SHA-256 hashing function. One can think of a block header as the metadata for the block; it contains a time field so that the block can be chronologically ordered on the chain, a merkle root — the output of hashing each transaction within the block together — and, among a few others, the nonce field. Nonce stands for number used once and is used in the guess-and-check mining process.
Recall earlier that hashing functions are subject to the “avalanche effect,” the nonce field is the variable field that miners manipulate — trillions of times per second — to find a suitable hash value beneath the target. To call back an earlier metaphor, proof of work hashing resembles a lottery in that there is no formula or trick to finding a suitable block hash (hash of the block header), each miner must adjust the nonce until they find a proof. However, it must be stated that having more processing power than other miners is a competitive advantage that will pay off as time goes on.
Bitcoin protocol developer Greg Walker summarizes proof of work in the following way:
“The term “proof-of-work” just refers to the fact that it takes work to get a block hash below a target value, and once you do anyone else can check that hashes below the target too.”
In the next section, we will walk through the process of mining a new block step-by-step, taking time to expand upon concepts or terminology that are commonly used in mining parlance.
Tick Tock, Next Block
Before we get deep into the bitcoin mining process — a few points are worth repeating. First, when we say “node” in bitcoin parlance, we mean a computer that is running a version of the bitcoin network software. Second, there are two types of nodes, generally speaking: mining-specific and “conventional” nodes. Third, miners do not validate transactions; mining nodes’ focus is to create proposed, new blocks and search for hash values that are equal to or below the mining target. Finally, Conventional nodes are responsible for validating transactions, assessing the current mining target, and the current issuance of bitcoin on the network — nodes serve as a user’s interface with the network. Each newly mined block is broadcast across the network, but each node independently verifies it before adding it to its locally maintained copy of the bitcoin blockchain.
The mining process begins with a mining node creating a candidate block, composed of transactions from that mining node’s memory pool. The next step is to construct a block header, which we discussed in the previous section. Importantly, the block header also includes a reference to the previous block (upon which the candidate block will be built if successfully mined) in the form of the previous block’s block hash. It is at this point that the “mining” process begins: the candidate’s block header (with an initial nonce value) is run through the SHA-256 hash function twice in the hopes that the value is beneath the target.
If the value of the block header’s hash output is not below the target, the miner can keep trying to mine by incrementing the nonce field in the header and re-running the SHA-256 algorithm. Thus, the process of mining essentially comes down to which miner can hash their candidate block’s header over and over again (changing the nonce each time) in the fastest manner possible. Once a block is successfully mined below the target value, it is broadcast throughout the network, where nodes independently verify it. Competing mining nodes then work to construct a new candidate block with fresh transactions from their memory pools and start trying to build upon the latest block.
Miners are incentivized to attempt to mine new blocks by the so-called block reward subsidy. This mechanism both rewards miners for their machines’ efforts, and regulates the issuance of new bitcoin into the network. When miners construct candidate blocks, they also include a coinbase transaction — this blank input transaction is effectively the address to which a successful miner will receive their block reward, plus any additional transaction fees associated with the mined block. Note that, as a rule, funds earned via a coinbase transaction are unable to be spent until the mined block is 100 blocks deep into the chain.
At the time of writing this piece, the block reward sits at a hefty 6.25 BTC (~$130k) — even at depressed price levels, the financial incentive to mine bitcoin remains intact. However, this financial incentive has tended to geographically centralize global network hashrate. While technically any node on the network can attempt to mine a block, the days of GPU mining being at all profitable are long gone. Large, publicly traded mining companies run warehouses of ASIC (application-specific integrated circuit) machines whose sole job is to hash candidate block headers trillions of times per second. All that said, hashrate tends to centralize around those firms or individuals with available capital, in jurisdictions with favorable regulatory environments, cheap electricity — or a combination of both factors.
A Closed-Loop System
Among the most attractive aspects of the bitcoin network is its truly open-source, decentralized structure. Any network participant that runs their own full node is able to independently verify blocks of transactions, individual transactions, the total issuance of bitcoin (as of a specific block height), and even the current epoch’s mining difficulty level.
Before proceeding any further on this subject, let us first clarify a few points. Bitcoin mining difficulty is a measure of how difficult it is for a miner to produce a valid block hash below a given 256-bit number determined by the network, in order to meet the initial target value. Difficulty levels and target values are intimately related: in order to calculate the difficulty level, a node would divide the initial target value (bitcoin’s first target value) by that of the current target.
Bitcoin mining exists in a series of “epochs” — 2016 blocks constitute one epoch, and if we assume that all 2016 blocks come in at an average time of 10 minutes per new block, each epoch is approximately 14 days long. To expand on this, bitcoin’s mining difficulty is automatically adjusted at the beginning of each new epoch. The reason is to maintain a steady new block issuance every 10 minutes, on average. A steady issuance of new blocks also implies a steady issuance of new bitcoin — 6.25 per block, at present.
This “difficulty adjustment” is in fact processed individually by each node on the network, and the calculation for the adjustment is relatively straightforward: divide the expected amount of time to process 2016 blocks (20,160 minutes) by the actual or observed amount of time.
For example, let us assume that the actual time for this hypothetical epoch was 20,000 minutes. In this case, our difficulty adjustment would be 1.008 — thus the network would increase the difficulty level and multiply the current value by 1.008. Note that difficulty levels are inversely correlated with target values, meaning that as the mining difficulty increases, the target value decreases — both of these movements indicate that successfully producing a block hash underneath the target value has become more difficult.
The reasoning behind the system of periodically adjusting the bitcoin mining difficulty circles back to the fact that bitcoin is an open, voluntary network where participants are free to come and go at any time. This is the case for node operators, miners, and those who chose to do neither: the system was designed to have as little friction as possible with regard to joining and leaving.
Incentives are Everything
While it is true that the proof of work mining protocol that bitcoin is based upon “secures” the network by preventing would-be nefarious actors from trying to manipulate past transactions, the decision of whether or not to mine comes down to incentives, rather than altruism. Miners are incentivized to direct their machine’s processing power at attempting to mine the next block because of the economic incentive, the block reward. As discussed in the previous section, difficulty for a particular miner to mine the next block is a non-static target, which means that the profitability of a miner’s operation is subject to factors that may or may not be in their control.
It is possible to negotiate favorable arrangements with utility companies to get cheap, reliable power. An operator may also have a network that provides access to high-quality hosting facilities. But something that is categorically uncontrollable for the individual miner is how many other miners have made the decision to power their machines on at any given time. Generally speaking, the more miners that are powered on, the higher the network’s hashrate. The higher the hashrate in a given 2016 block epoch, the more likely it is that difficulty will be adjusted upward (target downward) and thus make the next epoch more difficult to mine in.
Since miners are competing for the chance to mine the next block, the more of them hashing at the same time, the harder it is for any individual to successfully mine the next block faster than their counterparties. Hashprice (or Sats mined per Terrahash per day) is a measure of miner profitability commonly discussed in the space, and as shown in the below image, hashprice and mining difficulty are inversely correlated.
It is worth pointing out that the massive decline in mining difficulty — and simultaneous explosion of hashprice — in July of 2021 was likely caused by the Chinese government’s ban on mining. In that case, a significant portion of global hashrate was abruptly taken offline, thereby creating a massive opportunity for miners in other, more favorable regulatory jurisdictions.
Ultimately, a mining operator’s decision of whether or not to run their machines comes down to economic incentives, as opposed to altruistic notions of securing a global ledger — the latter is simply a byproduct of bitcoin’s proof of work implementation. Factors like global hashrate, current hashprice, BTC’s price, electricity and facility costs, regulatory environment and more are all considered in the operator’s “yes or no” decision. For more than 13 years now, economic incentives have proven to be more robust than relying on network participant’s goodwill toward the protocol; when dealing with something as complex as a network of humans interacting with each other, appealing to greed is more effective than appealing to emotions.
Proof of Work as Homeostasis
Much in the same way that all living systems possess internal mechanisms that help to regulate balance, proof of work acts as a sort of immune system for the bitcoin network. To reiterate a point made in an earlier section, proof of work (as adapted to the bitcoin network from Dr. Adam Back’s HashCash) ensures that funds are not spent twice on the network. This is due to the fact that block headers are timestamped at the point at which the block was successfully mined. Because of the timestamp, nodes can order transactions chronologically and better determine if a nefarious actor is indeed attempting to “double spend” funds.
The primary reason that bitcoin uses the particular implementation of proof of work mining is because it allows computers (nodes) across a global network to resolve conflicts, without the need for a centralized entity to mediate disputes. Let us consider an example: bitcoin is running on thousands of devices across the planet, and it is conceivable that two conflicting transactions (sending the same funds to different places) could be delivered to the memory pools from different nodes on the network simultaneously. Certain nodes will receive txa first and some will receive txb first. Eventually some miner will successfully mine a block containing one of those conflicting transactions and broadcast the block to the network. Once other nodes receive the new block (with txa or txb), they will add it to their chain and remove any conflicting transactions (loser of txa or txb) from their memory pool.
Therefore, the process of mining acts as a transaction-sorting mechanism across the network where mined blocks have final say as to what transactions belong on the blockchain. And because it is technically possible for any node on the network to mine a block, a complete monopoly on the mining process is unlikely — though hashrate centralization in specific regions is a real concern for the network.
Mining is a fundamental aspect of the bitcoin network: it provides transactional immutability, reliable issuance of new bitcoin (and block confirmation times), self-correcting economic incentives, unbiased dispute resolutions, and even a means by which to enhance profitability of stranded energy assets, which could usher in a new era of truly sustainable power generation.
The core of bitcoin’s proof of work protocol is simple enough: run machines that process the SHA-256 hashing function up until the point that a hash value beneath the target is found. The more profound aspect of this system is the distributed, decentralized nature of the system’s ability to self-correct. There is no central computer that tells nodes what the latest epoch’s target, or difficulty levels are — those parameters are independently calculated and agreed upon by each node on the network.
Our mission on the VegaX Research Team, is to provide our readers with high-quality content about crypto and the broader economic landscape. In-depth reports like this are meant to elevate readers’ understanding of the industry and allow them to build their own, nuanced opinions. We sincerely hope that you have found this piece valuable, and very much appreciate you reading it!
🚀Better Indexes, Better Returns — VegaX
Questions? 👉🏼 email@example.com
🎯Follow, Message, Tweet, Clap, & Join Us Here:
As we continue to expand our digital footprint, here is where you can find us:
VegaX Site | VegaX Twitter | VegaX FB | VegaX LinkedIn | VegaX IG
VegaX Holdings creates next-generation indices and financial products that are needed to support the growth of the cryptocurrency industry and improve returns for investors worldwide. Learn how to get better returns today: www.VegaXHoldings.com