<p>You can do it like this:</p>

<p>1) <code>getblockcount</code> gives you the most recent block you have [call it n]</p>

<p>2) <code>getblockhash n</code> gives you the hash for that block [call it hash]</p>

<p>3) <code>getblock hash</code> 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 <code>(now - blocktime) / 600</code> if the times are in seconds.</p>

CC BY-SA 3.0
2014-02-17T20:03:31.317Z
2014-02-17T20:03:31.317Z
Diego Basch
<p>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.</p>

<client><api><synchronization>
how to get clients sync status via API
fefe
# how to get clients sync status via API

(Asked by: username_0 on 2014-02-17)

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.

**Tags:** client, api, synchronization


---

## 1 answers

### Answer by username_1 on 2014-02-17. Score: 0 | Accepted answer

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.


---

