← Mining difficulty

Compare versions

Version 1 → Version 3 (current). Removed · Added. This shows the entry's text as it is written, including its formatting marks.

Version 1 · Version 3 (current) · Version history

Side by side · Together

Mining difficulty is the number that sets how hard it is for a Bitcoin miner to find a valid block; the network recalculates it every 2,016 blocks so that blocks keep arriving about ten minutes apart, whatever the total mining power.[3][5] ## What difficulty measures Bitcoin's proof of work (see [Proof of work](/t/3595/proof-of-work)) asks miners to scan for a value that, when the block is hashed with SHA-256, gives a hash that falls below a threshold. The whitepaper describes it as a hash that "begins with a number of zero bits", where the average work needed grows exponentially with the number of zero bits and any node can check the result with a single hash.[1] The threshold is called the **target**: the lower the target, the fewer hashes qualify and the more attempts a miner needs on average. A block must hash to a value that does not exceed the target the consensus rules expect.[5] **Difficulty** is the same quantity expressed the other way round. The Bitcoin Wiki defines it as the "difficulty_1_target" divided by the current target, where difficulty 1 traditionally stands for a hash whose leading 32 bits are zero.[6] Bitcoin Core measures the work a block represents as 2^256 divided by (target + 1), so a lower target means more expected work.[4] The genesis block, with a timestamp of 1231006505 (3 January 2009, 18:15 UTC), carries the compact target encoding `0x1d00ffff`.[3] Difficulty was 1 at the genesis block, according to the block-by-block record kept by the mempool.space service.[7] The same wiki page gives a rule of thumb for turning difficulty into an estimate of the network's total hash rate: difficulty × 2^32 ÷ 600, where 600 is the target number of seconds per block.[6] It is an estimate, not a measurement, because the network's real hash rate is never observed directly. ## How the adjustment works Satoshi Nakamoto's whitepaper says the difficulty "is determined by a moving average targeting an average number of blocks per hour", and that if blocks are produced too fast, the difficulty increases.[1] The rule actually implemented in Bitcoin Core is simpler than a moving average. The mainnet parameters set the target spacing at 10 × 60 seconds and the target timespan at 14 × 24 × 60 × 60 seconds, two weeks.[3] Two weeks is 1,209,600 seconds, which is 2,016 blocks of 600 seconds each.[5] Difficulty changes only when the next block's height is a multiple of 2,016; every other block simply inherits its parent's target.[2] At such a boundary, the software measures how many seconds passed between the first and last block of the period, and scales the target in proportion: new target = old target × actual timespan ÷ target timespan.[2] If the period ran long, the target rises and mining gets easier; if it ran short, the target falls and mining gets harder.[2] Two limits apply. The measured timespan is clamped to between one quarter and four times the target timespan, so a single adjustment can raise difficulty by at most a factor of four, or cut it to at most a quarter of its former level (the developer guide describes this as an increase of up to 300% or a decrease of up to 75%).[2][5] The new target also may not exceed the proof-of-work limit, the easiest target the network allows, which for mainnet begins with 32 zero bits.[2][3] The developer guide records a known quirk: an off-by-one error in the original implementation means the timestamps used cover 2,015 block intervals, not 2,016, which produces a slight skew.[5] The code reflects this, since it counts back 2,015 blocks from the last block of the period to find the first.[2] Test networks can relax the rule. On a network that allows minimum-difficulty blocks, a block that arrives more than twice the target spacing after its parent (more than 20 minutes) may use the minimum difficulty.[2] ## Difficulty in practice The adjustment record shows how the rule has played out. The first change came at height 32,256, in a block timestamped 30 December 2009, and took difficulty to about 1.18.[7] As of 27 November 2026, the most recent adjustment took place at height 977,760, in a block with timestamp 05:17 UTC, and set difficulty at about 145.09 trillion (145,088,938,867,954.3), up 7.6% from the previous period's 134.82 trillion.[7] Using the rule of thumb above, a difficulty of 145.09 trillion corresponds to roughly 145.09 × 10^12 × 2^32 ÷ 600 ≈ 1.04 × 10^21 hashes per second, or about 1,039 exahashes per second.[6][7] That figure is an estimate derived from the formula, not a reported measurement. In the record kept by mempool.space, the largest single decrease was at height 689,472, in a block timestamped 3 July 2021, when difficulty fell by about 27.9% (to a ratio of 0.7206 of the previous level). The largest increase, a factor of 4, came at height 68,544, in a block timestamped 16 July 2010, which is exactly the upper clamp described above.[2][7] ## Large falls in difficulty Difficulty follows mining power with a delay, so a sudden loss of miners shows up as a large fall only at the next adjustment. The clearest case in the record is the one in 2021: in the mempool.space record, the adjustment at height 689,472 on 3 July 2021 cut difficulty by about 27.9%, the largest decrease in the history of the chain.[7] The Block described it as a drop of "nearly 28%" and the largest ever, and tied it to China's crackdown on Bitcoin mining, which it dated to 21 May 2021.[9] By 19 July 2021 difficulty had fallen in four adjustments in a row since the crackdown began, to 13.67 trillion, 45% below the 25.05 trillion peak held from 13 to 30 May.[9] The same report says Chinese miners had been moving overseas, to places including Russia, Kazakhstan and North America.[9] A later fall of about 7.5% came at height 903,168 in June 2025, from 126.41 trillion to 116.96 trillion, which The Block called the largest negative adjustment in nearly four years. The outlet said it was likely driven by miners in the United States, particularly in Texas, cutting back during early-summer heatwaves; that attribution is the outlet's reading, not a measurement.[10] ![Rows of specialised computers used for Bitcoin mining.](/m/2026/11/5B0aTWtN-vfBucpx.jpg) *Via Wikimedia Commons: [Avalon-An ASIC base bitcoin machine](https://commons.wikimedia.org/wiki/File:Avalon-An_ASIC_base_bitcoin_machine.jpg) by 张楠赓, [CC0](http://creativecommons.org/publicdomain/zero/1.0/deed.en).* ## The timewarp weakness and BIP 54 Because the adjustment reads only the timestamps of the first and last blocks of a period, and miners choose those timestamps within consensus limits, the rule has a known weakness called the timewarp attack. BIP 54, "Consensus Cleanup", describes it as a bug that lets an attacker with a majority of the mining power arbitrarily lower difficulty and so raise the block rate; in the worst case, the BIP says, difficulty could be brought down to its minimum within 38 days of the attack starting.[8] The BIP adds that the bug makes it harder to reason about miners' incentives, because speeding up the block rate would let an attacker take block subsidy from future miners.[8] The BIP proposes a soft fork (a tightening of the rules that older nodes still accept) with two timestamp rules. The first block of each 2,016-block period must carry a timestamp no earlier than that of the previous block minus 7,200 seconds, and the last block of a period must carry a timestamp no earlier than that of the first block of the same period.[8] The first rule closes the timewarp attack; the second closes a related theoretical problem, which the authors call the Murch-Zawy attack, by ensuring that a period never has a negative length.[8] The authors chose a two-hour grace period rather than ten minutes, noting that the choice only slightly worsens the block rate under attack, and that a ten-minute grace period had already been adopted for testnet4, a test network.[8] The Bitcoin Core code carries a matching special case: when the testnet4 rule (BIP 94) is enforced, the new target is computed from the first block of the period, so the real difficulty is kept in a block that cannot use the minimum-difficulty exception.[2] BIP 54 also covers three other weaknesses (the cost of validating specially crafted blocks, a Merkle tree ambiguity, and duplicate coinbase transactions), which have nothing to do with difficulty.[8] As of 28 November 2026, the BIP's own header lists its status as "Complete" and its changelog dates version 1.0.0 to 22 May 2026; that status describes the document, and this entry does not report whether the rules have been activated on the network.[8] See also [Bitcoin halving](/t/3482/bitcoin-halving) and [Bitcoin](/t/1497/bitcoin). ## Sources 1. Satoshi Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System", October 2008, section 4 "Proof-of-Work": https://bitcoin.org/bitcoin.pdf 2. Bitcoin Core, `src/pow.cpp` (functions GetNextWorkRequired and CalculateNextWorkRequired), read from the master branch on 28 November 2026: https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp 3. Bitcoin Core, `src/kernel/chainparams.cpp` (mainnet parameters and genesis block), read from the master branch on 28 November 2026: https://github.com/bitcoin/bitcoin/blob/master/src/kernel/chainparams.cpp 4. Bitcoin Core, `src/chain.cpp` (function GetBitsProof), read from the master branch on 28 November 2026: https://github.com/bitcoin/bitcoin/blob/master/src/chain.cpp 5. Bitcoin Project, "Block Chain", Bitcoin Developer Guide: https://developer.bitcoin.org/devguide/block_chain.html 6. Bitcoin Wiki, "Difficulty", read 28 November 2026: https://en.bitcoin.it/wiki/Difficulty 7. mempool.space, difficulty adjustment history API (`/api/v1/mining/difficulty-adjustments`) and difficulty adjustment endpoint, retrieved 28 November 2026: https://mempool.space/api/v1/mining/difficulty-adjustments 8. Antoine Poinsot and Matt Corallo, "BIP 54: Consensus Cleanup", Bitcoin Improvement Proposals, version 1.0.0 dated 22 May 2026, read 28 November 2026: https://github.com/bitcoin/bips/blob/master/bip-0054.md 9. The Block, "It hasn't been this easy to mine bitcoin since January 2020", 19 July 2021: https://www.theblock.co/news/ecosystems/2021-07-19-bitcoin-mining-difficulty-lowest-january-2020-111816 10. The Block, "Bitcoin mining difficulty sees biggest drop since 2021 China ban amid hashrate slump", 30 June 2025: https://www.theblock.co/post/360320/bitcoin-mining-difficulty-sees-biggest-drop-since-2021-china-ban-hashrate-slump