3

I need to get some values to find how updated my bitcoind client is.

For example, I would like the GUI to tell me:

  1. If it is up to date. If not, show blocks/total blocks
  2. How many blocks have been downloaded
  3. The time that the last received block was generated.

Are there commands available in the JSON API to get this information? Or how else can I achieve this?

Regards

3
  • I was under the impression that version 5+ of the client (bitcoin-qt) offers all these capabilities. Am I wrong?
    – ripper234
    Mar 9, 2012 at 12:37
  • The client can't possibly tell if it's up to date in terms of blocks. The only way the client can know a block exists is to validate it. The only way to validate a block is to have it already. The client has no other mechanism to become convinced that it's not already current. (The exception would be if there was a checkpoint ahead of it.) Mar 10, 2012 at 5:44
  • How does Bitcoin-QR know it is "out of sync"? And it also says something like ~24 block(s) remaining.
    – kermit
    Oct 28, 2012 at 14:39

1 Answer 1

1

You probably need to read: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

You'll probably like the methods getblockcount and getblocknumber.

I don't think the API can give you the latest blocknumber until it's been updated, but you can find it on http://bitcoinwatch.com/ -> blocks -> count.

5
  • more details ( from #bitcoin-dev on IRC, thanks to sturles ) : the client can't know for sure until all the blocks are verified, but it can report what other clients claim they have. A malicious client can report arbitrary numbers to your client, so the bitcoin client can not be sure until the last block is verified. It can also make a guesstimate based on the current time and the age of the last verified block.
    – neofutur
    Mar 9, 2012 at 11:45
  • so your best guess will probably be to get the latest block number from a trusted provider ( bitcoinwatch.com is just an example)
    – neofutur
    Mar 9, 2012 at 11:47
  • Thanks for your reply. I read that API command list but it is pretty vague. The whole idea of doing this was to avoid using any 3rd party :( How can I make a guestimate? How can I get the last verified block? Cheers.
    – lbo
    Mar 9, 2012 at 11:51
  • you have no way to be sure of it until your local client have verifieds all the blocks; other clients can lie to you, but having a look at the client code and debug.log, you could find that other nodes are sending you messages like "version message: version 32300,blocks=170346", they tell you their version and blockcount, you can ignore old version clients and decide that all the latest version ones should have the latest block.
    – neofutur
    Mar 9, 2012 at 12:26
  • 2
    having this option ( downloaded XXX/YYYY blocks ) could really be useful for bitcoin users, if you can implement it as an API call, please fork github.com/bitcoin/bitcoin and send a pull request to share your good idea with others !
    – neofutur
    Mar 9, 2012 at 12:28

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.