how to get clients sync status via API

0

I try to use the build in API by bitcoin client and I wonder how to get the sync status via API of a runing client.

fefe

Posted 2014-02-17T18:48:14.827

Reputation: 109

Answers

0

You can do it like this:

1) getblockcount gives you the most recent block you have [call it n]

2) getblockhash n gives you the hash for that block [call it hash]

3) getblock hash gives you the block. You can compare the time of that block with the current time, and estimate how many blocks behind you are. It should be approximately (now - blocktime) / 600 if the times are in seconds.

Diego Basch

Posted 2014-02-17T18:48:14.827

Reputation: 326