How Are Bitcoin’s Hash Rate, Difficulty, Fees & Mempool Related?

Learning how Bitcoin works using on-chain data visualizations

Bitcoin’s difficulty adjustment mechanism is of its most important aspects, but learning how it works can be a daunting task. This article leverages on-chain data to visualize how this mechanism works and how it relates to hash rate, block intervals, transaction fees and the mempool. After reading this article, you will have a better understanding of why at certain times using Bitcoin may appear to be relatively slow and expensive, but also how Bitcoin fixes this and why this process is so essential to ensure Bitcoin’s monetary properties.

Bitcoin’s supply issuance schedule

If you’ve heard of Bitcoin, you have probably heard that its supply is hard capped at 21 million units (BTC), making it a perfectly scarce asset and thus the ultimate ‘hard money’.

When Bitcoin was created, miners received 50 BTC for each new block as a reward for their work. The software has a built-in rule that after every 210.000 blocks that are mined (~4 years if the block interval is 10 minutes), this ‘block subsidy’ is cut in half during an event called ‘the halving’. During this first ‘reward era’ that ended on November 28th, 2012, 10.5 million BTC were mined — half of its maximum supply. During the second reward era, half of that amount (10.5M / 2 = 5.25M) was issued, followed by half of that (5.25M / 2 = 2.625M) during the third reward era — and so forth. After 32 halvings, the block subsidy equals the smallest unit in Bitcoin (0.00000001 BTC = 1 sat) and cannot be split after, which means the block subsidy falls away completely after that (~2140 if block intervals were 10 minutes during its entire existence). The first 14 reward eras of Bitcoin’s issuance schedule are visualized in figure 1.

Figure 1: The first 14 reward eras of Bitcoin’s supply issuance schedule (source)

The careful reader will have noticed that in the previous paragraph, we mentioned twice that the actual calendar dates on which these halving events occur depend on the block intervals and that we assumed 10 minutes here. Why it is important that this supply issuance schedule is predictable in regular calendar-times in the first place?

The importance of relatively stable block intervals

Let’s consider what it would look like if Bitcoin didn’t have a built-in difficulty adjustment mechanism, but simply had a fixed mining difficulty.

If that fixed difficulty had been set relatively high, early mining would have been very expensive and blocks would have come in at a very slow pace early on. Clearly, that wouldn’t have been ideal to bootstrap a new network and could have meant that it never succeeded in the first place.

On the other extreme, if the difficulty would have been set relatively low to incentivize early network participants to join, block intervals would get smaller as more miners are joining the network and blocks would come in at an increasing pace. It would quickly run through its entire supply issuance schedule and likely wouldn’t have had enough time to develop a block space market that is needed to incentivize miners to keep mining blocks in order to process transactions and secure the network after the block subsidy runs out.

To summarize, relatively stable block intervals are needed to spread out Bitcoin’s supply issuance over time, which in turn is needed to incentivize miners to keep joining the network over a relatively long bootstrapping period, as well as to gradually develop a block space market that will be able to keep the lights on after the block subsidy runs out.

To guarantee that block intervals will remain relatively stable over a multi decade period, Bitcoin has a difficulty adjustment mechanism. As can be seen in figure 2, even with this built-in difficulty mechanism, its block intervals not very stable and on average much longer than 10 minutes per block during its first year of existence. The block intervals became more stable after Bitcoin set its first market price, and have been relatively stable at just under 10 minutes for roughly six years now — works like a charm.

Figure 2: The 14-day moving average of Bitcoin’s mean block interval over time (source)

Bitcoin’s difficulty adjustment mechanism

To mine bitcoin, miners use highly specialized computers to basically guess a certain number (slightly simplified). When a miner finds the number that the network is currently looking for, it earns the rights to create a new block on the Bitcoin blockchain, take its block subsidy, choose which transactions to include in that block and collect the fees of those transactions. At the time of writing, all miners that are active on the Bitcoin network are estimated have a total capacity (‘hash rate’) of 170 Exahashes per second (EH/s), which is 170,000,000,000,000,000,000 hashes per second.

In Bitcoin’s first year in existence (2009), it was still possibly to mine Bitcoin on the CPU (‘Central Processing Unit’; which is basically the central chip in a computer that takes care of lots of things) an average consumer computer, as the network’s hash rate was just a few million hashes per second. Over time, more computers joined the network and eventually chips that were better at heavy number crunching (GPU or ‘Graphics Processing Unit’; the chip in a computer that is applied for graphical tasks and linear algebra) or even hardware that is custom made for Bitcoin mining (an ASIC, or ‘Application Specific Integrated Circuit’) was used.

As you can imagine, as the network’s hash rate increased by a multi-trillion-fold from that first year until now, it was necessary to make it a lot harder to guess that certain number to ensure relatively stable block intervals.

In Bitcoin, ‘difficulty’ is the measure for how hard it is to find that number that the network is looking for. Every 2016 blocks (14 days if block intervals are 10 minutes), the Bitcoin software basically calculates the block intervals during that period and adjusts the difficulty so that at current capacity, the average block interval will be roughly 10 minutes again.

The interplay between Bitcoin’s difficulty, (the 14-day moving average of the) hash rate and block intervals over the last three months is visualized in figure 3. During the first visualized difficulty adjustment period (the red column on the left), the hash rate was declining (downtrend in black line). As network capacity decreased, block intervals increased (uptrend in blue line), making it necessary to decrease the difficulty (small drop in orange line after this period).

In three difficulty adjustment periods after (first green column in figure 3), the hashrate was increasing again, blocks came in faster than planned and difficulty adjusted upwards three times. Mid-April (right red column), there was a large power outage in China that caused a massive drop in Bitcoin’s hash rate, slowing down blocks a lot and making a huge downwards difficulty adjustment necessary after the period. After this happened (right green column), the power outage itself was solved and the downwards difficulty adjustment made it much easier for miners to create blocks again. As a result, some miners with less efficient hardware and/or more expensive energy could earn a profit mining again, actually overcompensating the previous loss of hash rate, actually sending it to new all-time highs.

Figure 3: Bitcoin’s difficulty adjustments (orange) and a 14-day moving average of the hash rate (black) and block interval (blue) (source)

This latest hash rate drop and recovery is a good example of why miners leaving the network does not have a cascading effect of miners leaving the network (sometimes called the ‘mining death spiral’ by critics), but the software simply increases the remaining miners’ profit margins, incentivizing other miners to (re)join the network.

Transaction fees

A side effect of this mechanism that we all feel is its impact on transaction fees. During times when the hash rate increases and blocks are coming in faster than planned (green columns in figure 4), transactions can relatively easily be included in blocks. Since this means that there are less transactions queued up in line (in Bitcoin called the ‘mempool’) to be included in upcoming blocks, transaction fees can be relatively low.

The opposite is true during periods where hash rate drops and block intervals increase (red column in figure 4). When blocks are coming in slowly, the queue of transactions waiting to get included gets crowded, and people need to bid up their transaction fees to basically jump the line. As such, transaction fees spike especially when the network capacity decreases (hash rate drops) and is waiting to be bailed out by the next difficulty adjustment.

Figure 4: A 14-day moving average of the Bitcoin hash rate (black), median block interval (blue) and median transaction fees (orange) (source)

In this paragraph, we discussed the fees of transactions that were included in blocks. For anyone that is looking to transact on the Bitcoin network, it is even more relevant to get a feel for what transactions that are still waiting in line to be included in future blocks are bidding for their needed block space.

Mempool

As briefly mentioned above, the Bitcoin mempool can be interpreted as the total of all transactions that were broadcasted on the network but are still waiting in line to be included in a future block. Technically, each of the thousands of Bitcoin nodes on the network has its own mempool, but since they are mostly well interconnected, visualizing them as a single waiting line is alright for didactive purposes.

Mempool.space is a popular and respected website that gives anyone not running their own node or simply looking to get a quick look at the mempool all the relevant data. Examples are the total size of the waiting line (mempool size), how many transactions are joining the queue (incoming transactions), if blocks are coming in faster or slower than expected (estimated difficulty adjustment) and estimations of how high the transaction fee of a new transaction needs to be to be included at low, medium or high priority.

Figure 5 visualizes the mempool of the last three months. As you would expect, the patterns described in figure 4 can also be seen here. Between late February and early April, when the amount of hash rate on the Bitcoin network increased and more blocks than planned were created, the mempool size (the size of the waiting line) decreased and transaction fees decreased. After the mid-April hash rate drop, the mempool quickly increased and transaction fees skyrocketed, but both declined extra fast after the April 30th difficulty adjustment and subsequent hash rate growth to all-time highs.

Figure 5: The Bitcoin mempool according to mempool.space (source)

The future block space market

As briefly mentioned at an earlier point in this article, Bitcoin’s block subsidy is designed to decay over time, and the development of a healthy block space market where transaction fees become the primary source of revenue for miners is essential to incentivize miners to keep processing transactions and securing the network in the long-run.

This is possibly the most important test that awaits Bitcoin in the future, and is the subject of my previous Bitcoin Magazine article titled “An ode and forthcoming obituary to Bitcoin’s four-year cycle”, which is a recommended follow-up read. Finally, if you have any questions on the topics discussed in this article, feel free to send me a message on Twitter.

This article was originally published on Bitcoin Magazine on May 15th, 2021.

Dilution-proof on Medium or Twitter to be notified of future updates.

Disclaimer: This article was written for educational, informational and entertainment purposes only and should not be taken as investment advice.

Fascinated by #Bitcoin’s on-chain data, 4-year cycle & potential as the base-layer of an optimistic, sound future. Focus on the signal, ignore the noise.