Mining difficulty is the degree that determines how hard it is for miners in terms of hashing power (and thus also time) to find an eligible hash aka signature for their block (a block of transactions needs an eligible hash to be verified and added to the blockchain). On the Bitcoin blockchain, miners try to find an eligible hash by hashing random numbers. Let’s briefly zoom in on this process.

Mining aka Hashing — a quick refreshment

Let’s quickly go over this again. If you read my article “how mining works and transactions are processed”, you know that a block of transactions will only be accepted by the rest of the network if it has a signature (hash) that meets certain requirements (in example of Bitcoin, the signature needs to start with a certain number of zeroes). In order to find this signature, miners are spending computational power (hashing power) to perform a set of pre-determined operations on random numbers untill they find a number that leads to an output number that meets the requirements. Finding an output that starts with only one zero is much easier (generally more common) than finding an output number that starts with five consecutive zeroes (this is pretty rare so it would take much more time to find a number that leads to such output).

Eligible signature (hash) — aka mining difficulty

So the amount of zeroes that a signature requires to start with consecutively determines how hard it is for miners (how much hashing power or time it takes on average) to find it. This is the mining difficulty. The more zeroes required, the harder it is to find an eligible signature (= higher difficulty). But what determines the mining difficulty?

What determines the mining difficulty?

The mining difficulty is adjusted automatically on the network every two weeks based on the block production rate. When more miners join the network to mine Bitcoin, the total hashing power increases and therefore it can be assumed that the network altogether will find eligible signatures faster, meaning they will add blocks to the blockchain faster. Here is an example:

Assume that all miners in this example have the same computational power (hash rate). On average, it takes a miner 1 hour to find an eligible hash. One miner finds 1 eligible hash per hour, but ten miners find 10 eligible hashes per hour. The block production rate for 1 miner is 1 block per hour, but for ten miners it is 10 blocks per hour, which is much faster!

The mining difficulty on the Bitcoin blockchain is adjusted every two weeks so that the total hashing power on the network on average produces 1 block per 10 minutes. If a lot of miners join the Bitcoin blockchain and the cumulative hashing power goes up, then the block production rate could increase from 1 block per 10 minutes to 1 block per 9 minutes. After a while, this would trigger the mining difficulty to go up as well, so that even with this extra hashing power, the block production rate will maintain a steady pace of 1 block per 10 minutes. The same applies to the opposite, when miners stop mining on a blockchain and the cumulative hashing rate goes down, the mining difficulty would also go down. The big question is: why 1 block per 10 minutes?

But why only one block per ten minutes?!

You may not instantly realise it, but this really is a very good question. I personally had to spent a lot of time to figure this out, and apparently I was not the only one.

But why should the mining difficulty increase at all? This requires more electricity to process the same amount of transactions. Why not just lower the mining difficulty and speed up the block production rate? This would also mean that Bitcoin transactions are processed much faster.

For a long time I couldn’t exactly wrap my head around this question, but after some time someone on Reddit finally came up with the answer. Satoshi Nakamoto (inventor of Bitcoin) himself decided that the block production rate should maintain a steady average pace of 1 block per 10 minutes, because: a blockchain will estimately need 10 minutes to propagate the latest block(s) to all nodes globally, in order for the blockchain to stay properly synchronized. If blocks are produced at a faster pace, some nodes on the other side of the globe might not be able to catch up fast enough with the lates transaction data, and this may cause nodes to be no longer correctly aligned, leading to “uncle blocks” (chain splits), which is basically something a blockchain must avoid as much as possible in order to stay secure. A rather simple answer indeed, but it makes sense.

So — block difficulty

So, to summarize; the block difficulty is based on the total hashing power of the network, and is adjusted every two weeks to maintain a steady block production rate of 1 block per 10 minutes. This gives the network time to synchronize and update the blockchain ledger globally, and is crucial to maintain security on the ledger (uncle blocks reduce the security rate of the network because they can become invalid even after they are validated).

The more miners join the network, the more cumulative computational power is being spent to find eligible signatures, and the faster blocks are added to the blockchain if the difficulty does not change. The difficulty therefore goes up when the hashing power goes up, and the difficulty goes down when the hashing power goes down. As you can see below, the cumulative hashing power (hash rate) is currently at 51 billion GH/s. The higher the hash rate, the higher the block difficulty.

As you can see below, block 100 (back in 2009) only required a signature that started with eight consecutive zeroes, whereas the last block today (block 542865) needed a signature that started with at least 18 consecutive zeroes. The amount of zeroes is what reflects the difficulty level. Finding an output with so many consecutive zeroes requires either much more time or much more hashing power, and it is so much higher today because there is so much more hashing power (more miners) being spent on the Bitcoin blockchain.

Block 100 had a difficulty of 8 consecutive zeroes.

Block 542864 had a difficulty of 18 consecutive zeroes.

As you can see, the cumulative hashing power on the Bitcoin blockchain in 2018 is many, many times more than it used to be back in 2009. A little sidenote: the graph below shows an only ever increasing Bitcoin mining difficulty up until March 2018, but it has been dropping since October 2018 as miners were forced to stop mining because their operational costs were starting to exceed mining profits as Bitcoin prices were dropping fast.