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
You can also use http://blockexplorer.com/q/nethash/2015
– theymos – 2011-11-30T21:00:37.210This should probably be http://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.
– Meni Rosenfeld – 2011-12-01T06:52:17.070Actually, I think that the last block of each difficulty is at 2015. This means that http://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 – 2011-12-01T09:06:57.157/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. http://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?
Hum.. I thought that difficulty actually changed when block 2015 came out because the next block will be mined with the new difficulty. No? Anyway, it's probably a 10min difference so it isn't worth the trouble. Thanks for the help. – nmat – 2011-12-01T16:42:12.700
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. – Meni Rosenfeld – 2011-12-01T18:58:42.823