4

I am looking for a website that allows me to retrieve the time at which each difficulty change happened. The time doesn't need to be accurate so a time stamp from the block will do. I want to fetch this information automatically every now and then, but I can't seem to find a webpage that provides an API for this.

1 Answer 1

3

http://blockexplorer.com/q/nethash/2016 provides the necessary information and shouldn't be too hard to parse. Every row corresponds to the first block at a given difficulty.

7
  • 1
    You can also use blockexplorer.com/q/nethash/2015
    – theymos
    Nov 30, 2011 at 21:00
  • This should probably be blockexplorer.com/q/nethash/2016 . The interval between successive retargets is 2016 blocks, and this also gives the correct offset - every row is the first block of every difficulty. I've edited the answer to use this improvement. Dec 1, 2011 at 6:52
  • Actually, I think that the last block of each difficulty is at 2015. This means that blockexplorer.com/q/nethash/2015 has the correct timestamp, but I have to use the difficulty of the following block. It's a little tricky...
    – nmat
    Dec 1, 2011 at 9:06
  • /2015 isn't good because it's not the right interval. If you want the last block of every difficulty you need 2015, 4031, 6047... But /2015 will give you 2015, 4030, 6045... . Unless there's a parameter for nethash to control the offset (or theymos is willing to add one) it can't be used for this. But you can query each block separately with e.g. blockexplorer.com/b/155231 . Anyway, why do you want the timestamp of the last block of a difficulty rather than the first block of the next difficulty? Dec 1, 2011 at 13:48
  • 1
    @nmat: This makes sense, you do want the block at the -1 offset. But you still need a 2016 interval, which /nethash/2015 doesn't provide. If you don't need it very accurate you can just use /2016, and to gain a bit more accuracy you could subtract 10 minutes which is the average difference between this block and the previous one. Dec 1, 2011 at 18:58

Your Answer

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

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