2

Is there a command to get the DateTime of when bitcoind last received a block?

1
  • This question was just pushed back to the frontpage. I've tried to rework it to make it as clear as possible and added some more tags. Please feel free to further edit or improve the post, or revert my changes if it isn't asking what you were interested in anymore. If it already has been answered to your satisfaction it would be helpful if you accepted an answer, so that it doesn't show up as "unanswered" anymore.
    – Murch
    Nov 8, 2015 at 16:37

4 Answers 4

1

No, there isn't. getblockcount can only get the number of blocks in the best chain, but not the last received block.

You might need to write a new rpc to get the last received block.

First, add a new data structure in main.cpp and record blocks received order in ProcessBlock().

Second, write a rpc to print out that data structure.

1

I think people look at the bitcoind log files to see the received times. Possibly a grep on the log file might be what you need?

1

What you probably want to do is set up a -blocknotify= script when you start your daemon. For example, you could echo the block hash with the %s formatter, and echo the time it was received, directing the output to a file:

./bitcoind -daemon -server -blocknotify="echo %s; date"
0

If you mean the number of blocks in the entire chain, getblockcount gives you that.

The commands getinfo and getblockchaininfo also both contain "blocks" in their reply. The latter also includes "headers", which should show you a higher number than "blocks" when bitcoind has not caught up yet but has heard about a newer block.

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.