I would like to have a complete list of the historical mining difficulty of bitcoin. Preferably it would be a text list or csv, but a webpage that displays the data in any text format will do.

I've been searching for several hours over the last couple of days with no progress. I'm quite surprised that this is so hard to find...

3 Answers 3


You can get it for example on blockchain.info. Call up the Difficulty chart, switch the time-frame to "All Time", then use the link labelled "CSV", to download it.

Note that the difficulty only changes every 2016 blocks, which is re-targeted to be about 14 days, in case you wonder why there are so few data points.

  • After having a look at the data, there may be a mistake in the first few data points. As far as I know the difficulty can’t drop below one, so the values given with zero irritate me. I would assume that they were one as well.
    – Murch
    Jan 7, 2016 at 11:13
  • Thank you! This is exactly what I was looking for. Also, I'll adjust the 0 values, as you describe, before using the data.
    – timeSmith
    Jan 7, 2016 at 11:27
  • I don't see any negative data points, but I do see a few 0 points. Bitcoin's difficulty can't go below 1 by consensus rule, I believe, so blockchain.info has some bad data here.
    – morsecoder
    Jan 7, 2016 at 21:30

The data is also stored on the block chain. Query every 2016 blocks to see the difficulty at that time. Here are some samples, can see block 131040 was a re-target.

# bitcoin-cli getblockhash 4032 | xargs bitcoin-cli getblock
    "hash" : "00000000ca4b69045a03d7b20624def97a5366418648d5005e82fd3b345d20d0",
    "time" : 1294031411,
    "difficulty" : 1.00000000,

# bitcoin-cli getblockhash 131039 | xargs bitcoin-cli getblock
    "hash" : "0000000000000e6e98694ccb8247aad63aaa1e2bec5a7be14329407e4cea6223",
    "time" : 1308145551,
    "difficulty" : 567269.53016242,

# bitcoin-cli getblockhash 131040 | xargs bitcoin-cli getblock
    "hash" : "000000000000097aa651b8e19c448924586a8010721c8e7ea282a0272d425987",
    "time" : 1308145774,
    "difficulty" : 876954.49351354,

I needed a trustworthy history of mining difficulty changes and also landed on the blockchain.info chart that clearly has incorrect (averaged) data. So I wrote this script that uses the Esplora API to search for difficulty changes. The logic could be easily ported to run against your own Esplora instance or your own Bitcoin node's RPC API.

Script is here: https://github.com/jlopp/bitcoin-utils/blob/master/generateDifficultyHistoryCSV.php


// This script uses the blockstream explorer API
// It iterates through every block that was minted after a difficulty retarget height
// and if the difficulty changed compared to the previous epoch, will print it in CSV format

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);

$currentBlockHeight = 38304; // one epoch before the first difficulty change (speed up the script by reducing API calls)
$currentBlockHash = NULL;
$currentDifficulty = 1;

// determine where to stop looking for new difficulty epochs
curl_setopt($ch, CURLOPT_URL, "https://blockstream.info/api/blocks/tip/height");
$chainTipHeight = curl_exec($ch);
$maxBlockHeight = $chainTipHeight - ($chainTipHeight % 2016) - 2016;

echo "\nBlock Height,Date,Difficulty\n";
echo "0,2009-01-03,1\n";

while ($currentBlockHeight < $maxBlockHeight) {  // there are more difficulty retargets
    $currentBlockHeight += 2016;
    curl_setopt($ch, CURLOPT_URL, "https://blockstream.info/api/block-height/$currentBlockHeight");
    $currentBlockHash = curl_exec($ch);

    curl_setopt($ch, CURLOPT_URL, "https://blockstream.info/api/block/$currentBlockHash");
    $block = json_decode(curl_exec($ch));
    if ($block->difficulty != $currentDifficulty) {
        echo $block->height . "," . date("Y-m-d", $block->timestamp) . "," . $block->difficulty . "\n";

  • 1
    As it's only 34 lines, you could inline it here (with a note of where the latest version can be found) to avoid future issues with link-rot/404 Sep 14, 2022 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.