4

Times at which a block is initially announced to the network aren't recorded in the block. Does bitcoind record at least the local time each block was seen the first time? Does anyone have any suggestions about how to record these times?

I'd like to be able to use local data rather than hammer someone else's servers.

4

The creation time is recorded in the block:

https://en.bitcoin.it/wiki/Protocol_specification#block

And since there's no benign benefit in deferring announcing it, it would seem likely creation time and announcement time would be pretty close. But I accept there are variations, and pretty close may not be good enough.

However there is another approach.

You can use the bitcoind/bitcoin-qt -blocknotify option, described here:

github.com/bitcoin/bitcoin/pull/743

To record the time of new best blocks (which seems to be the like what you want.)

I used

blocknotify=echo date", %s" >> /home/userid/.bitcoin/blocknotify.log 

And got:

Sun Jun 23 20:14:15 NZST 2013, 0000000000000069a26870e6f6693d733e32d57174bebb7d21f0fac1212fd83b 
Sun Jun 23 20:33:04 NZST 2013, 000000000000003359dff8a8bd1033b02a52c6c2ff3ebb2f8dbffd171c97e83c 
Sun Jun 23 20:43:11 NZST 2013, 000000000000004ec1559bd7e955ce8914a29a04b378bbcc34adf5bea077f73d

To clarify, that example of blocknotify was in bitcoind.conf, but it works on the command line too, with appropriate quoting of shell significant characters.

8
  • The timestamp on the block isn't always correct - plenty of examples where sequential blocks do not have sequential timestamps. The times the blocks are announced to the network are more accurate. Sometimes they can be significantly wrong. I'd like to summarise and try to model the error distribution, and for that I need the timestamps and the first time the block was announced. – organofcorti Jun 20 '13 at 6:25
  • True, but then you're going to encounter variability in "the time announced" as that will differ at different points in the network. As there's unlikely to be an historical record of announced times, perhaps there's something in the bitcoind log that would at least tell you about local arrival times. – Hamish MacEwan Jun 20 '13 at 7:25
  • Blockchain.info records the times they receive the block announcement, but then I'd have to use them every time I wanted to update. A local bitcoind running constantly would do it if there's something in the debug log I can regex. I thought there was last time I looked but I'm not sure if it's the received time or not. I'll have to look at the log again. – organofcorti Jun 20 '13 at 7:41
  • You can use the -blocknotify option, described here: github.com/bitcoin/bitcoin/pull/743 To record the time of new best blocks (which seems to be the like what you want.) I used blocknotify=echo date", %s" >> /home/userid/.bitcoin/blocknotify.log And got: Sun Jun 23 20:14:15 NZST 2013, 0000000000000069a26870e6f6693d733e32d57174bebb7d21f0fac1212fd83b Sun Jun 23 20:33:04 NZST 2013, 000000000000003359dff8a8bd1033b02a52c6c2ff3ebb2f8dbffd171c97e83c Sun Jun 23 20:43:11 NZST 2013, 000000000000004ec1559bd7e955ce8914a29a04b378bbcc34adf5bea077f73d – Hamish MacEwan Jun 23 '13 at 9:07
  • Apologies for the shambles above, editing times out after five minutes and I wasn't familiar with the markdown approach for new lines. To clarify, that example of blocknotify was in bitcoind.conf, but it works on the command line too, with appropriate quoting of shell significant characters. – Hamish MacEwan Jun 23 '13 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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