<p>You probably need to read: 
<a href="https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list" rel="nofollow">https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list</a></p>

<p>You'll probably like the methods getblockcount and getblocknumber.</p>

<p>I don't think the API can give you the latest blocknumber until it's been updated, but you can find it on <a href="http://bitcoinwatch.com/" rel="nofollow">http://bitcoinwatch.com/</a> -> blocks -> count.</p>

CC BY-SA 3.0
2012-03-09T11:45:17.947Z
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
CC BY-SA 3.0
2012-03-09T11:47:19.737Z
so your best guess will probably be to get the latest block number from a trusted provider ( bitcoinwatch.com is just an example)
neofutur
CC BY-SA 3.0
2012-03-09T11:51:35.320Z
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
CC BY-SA 3.0
2012-03-09T12:26:19.110Z
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
CC BY-SA 3.0
2012-03-09T12:28:32.773Z
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 https://github.com/bitcoin/bitcoin and send a pull request to share your good idea with others !
neofutur
CC BY-SA 3.0
2012-03-09T11:32:47.007Z
2012-03-10T02:04:42.760Z
2012-03-10T02:04:42.760Z
neofutur
<p>I need to get some values to find how updated my bitcoind client is.</p>

<p>For example, I would like the GUI to tell me:</p>

<ol>
<li>If it is up to date.  If not, show blocks/total blocks</li>
<li>How many blocks have been downloaded</li>
<li>The time that the last received block was generated.</li>
</ol>

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

<p>Regards</p>

CC BY-SA 3.0
2012-03-09T12:37:42.907Z
I was under the impression that version 5+ of the client (bitcoin-qt) offers all these capabilities. Am I wrong?
ripper234
CC BY-SA 3.0
2012-03-10T05:44:27.663Z
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.)
David Schwartz
CC BY-SA 3.0
2012-10-28T14:39:26.763Z
How does Bitcoin-QR know it is "out of sync"? And it also says something like ~24 block(s) remaining.
kermit
<bitcoind><block><api>
Bitcoind statistics
lbo
# Bitcoind statistics

(Asked by: username_0 on 2012-03-09)

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

**Tags:** bitcoind, block, api

> **Comments:**
> **username_1**: I was under the impression that version 5+ of the client (bitcoin-qt) offers all these capabilities. Am I wrong?  
> **username_2**: 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.)  
> **username_3**: How does Bitcoin-QR know it is "out of sync"? And it also says something like ~24 block(s) remaining.  

---

## 1 answers

### Answer by username_4 on 2012-03-09. Score: 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.

> **Comments:**
> **username_4**: 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.  
> **username_4**: so your best guess will probably be to get the latest block number from a trusted provider ( bitcoinwatch.com is just an example)  
> **username_0**: 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.  
> **username_4**: 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.  
> **username_4**: 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 https://github.com/bitcoin/bitcoin and send a pull request to share your good idea with others !  

---

