In order to ensure bitcoin blocks are discovered roughly every 10 minutes, an automatic system is in place that adjusts the difficulty depending on how many miners are competing to discover blocks at any given time. As the name implies, bitcoin mining difficulty refers to the degree of difficulty involved in discovering new bitcoin blocks through mining.
Because the Bitcoin network is completely decentralized and not run by any single overarching authority, an algorithm hard-coded into the source code by Bitcoin’s creator(s) Satoshi Nakamoto is used. This algorithm constantly readjusts the difficulty of the mining process in line with how many miners are operating in the network to ensure that blocks are discovered at a steady pace.
In this guide, we will explore this concept extensively, highlight its importance and detail the method used to determine and adjust bitcoin mining difficulty.
The bitcoin mining process is central to the security and validity of the entire network and its native cryptocurrency – bitcoin (BTC). Mining lies at the core of Bitcoin’s consensus system – that is, the system of agreement used by bitcoin to ensure all distributed participants reach consensus on new data entering the blockchain. The network relies entirely on a decentralized transaction validation process whereby anyone in the world can take up the responsibility of validating new transactions and adding them chronologically into the blockchain via new blocks.
As simple as this sounds, the whole process – known as proof-of-work – involves a computer-intensive effort that requires the would-be validators to use their machines to generate a winning fixed-length code before anyone else does.
By forcing validators to expend some form of energy to discover new blocks, the idea is it dissuades potential bad actors from participating in the network and attempting to corrupt the blockchain with invalid transactions.
To increase their odds of winning, miners over the years have switched over to using specialized computing equipment called application-specific integrated circuit (ASIC) miners that are capable of generating over one quintillion random codes a second; an exponentially higher number of guesses than any regular laptop is capable of producing per second.
The Bitcoin difficulty algorithm is programmed to keep the entire system stable by maintaining a 10-minute duration for finding new blocks. In essence, it takes roughly 10 minutes for one miner out of the entire network to generate a winning code and win the right to propose a new block of bitcoin transactions to be added to the blockchain.
To maintain this frequency, the algorithm steps in and increases or decreases the difficulty of mining bitcoin. Whenever there’s an influx of miners or mining rigs, it ramps up the difficulty of mining bitcoin. If the reverse is the case (that is, if there is a drop in the number of miners competing to find new blocks), the protocol reduces the mining difficulty to make it easier for the remaining miners to discover blocs. The mining difficulty of the bitcoin network is altered by adding or reducing the zeros at the front of the target hash. The target hash is the name given to the specific hash (fixed-length code) that all miners are trying to beat. Whoever generates a random code that happens to have an equal or higher number of zeros at the front than the target hash first is selected as the winner.
Without such a system in place, blocks would likely be discovered faster and faster as more miners joined the network with increasingly sophisticated equipment. This would result in new bitcoin entering circulation at an unpredictable rate and would likely have the knock-on effect of inhibiting it’s rise in value. It’s important to note, a huge part of bitcoin’s appeal is its steady, predictable rate of inflation compared to the unpredictable and rampant inflation of fiat currencies caused by excessive quantitative easing. The fact that the circulating supply is capped at a maximum of 21 million coins also means it’s a truly finite asset with a relatively scarce maximum supply. Both of these factors should, in theory, help support bitcoin’s price over time – assuming demand remains high.
Bitcoin’s mining difficulty is updated every 2,016 blocks (or roughly every two weeks). This is why each 2,016 block interval is called the difficulty epoch, as the network determines whether the activities of miners for the last two weeks have reduced or increased the time it takes to mine a new block. If the time it takes is below 10 minutes, the mining difficulty will be increased. The opposite occurs when the block time is above 10 minutes.
Mining difficulty adjustments are made by comparing the standard time it should take to find 2,016 blocks of transactions on the Bitcoin network to the time it took to find the last 2,016 blocks. Keep in mind that the accepted block time is 10 minutes. Therefore, the expected time for mining 2016 blocks is 20,160 minutes (that is, 2016 X 10 minutes).
The network calculates the total time it takes to mine the last 2,016 blocks. The ratio of the standard 20,160 minutes (10 minutes x 2,016 blocks) to the time it took to scale the last difficulty epoch is then multiplied by the most recent difficulty level. The calculation yields a result that will determine the required percentage change in the mining difficulty that will bring the block time to the desired 10 minutes. That said, an error in the original Bitcoin protocol makes difficulty level adjustments based on the previous 2,015 blocks instead of the theorized 2,016 blocks.
While a 10-minute block time is the goal, the mining difficulty cannot be altered above or below four times the current difficulty level. The upper limit for each difficulty epoch is a +300% change, while the lower is a -75% alteration. This rule is put in place to eliminate any abrupt changes in mining difficulty.