<p>Using the <code>getblockchaininfo</code> RPC command :</p>

<ul>
<li>if <code>initialblockdownload</code> is <code>true</code>, your node is currently syncing with the network for the first time.</li>
<li>else :

<ul>
<li>if the <code>headers</code> field number is superior to the <code>blocks</code> field number, your node is catching up with the current state (likely after having been restarted)</li>
<li>else if the <code>headers</code> field number is equal to the <code>blocks</code> field number, your node is synced ! </li>
</ul></li>
</ul>

<p>Here is the current output of the command for me :</p>

<pre><code>$ bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 634379,
  "headers": 634379,
  "bestblockhash": "000000000000000000136f1b78deeebc33a9b7b33d25c2e37f5446cb33b586fd",
  "difficulty": 13732352106018.34,
  "mediantime": 1591963775,
  "verificationprogress": 0.9999999385944023,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000104a35fae53a5b470d8e9524",
--snip--
}
</code></pre>

CC BY-SA 4.0
2020-06-12T13:00:07.810Z
2020-06-12T13:05:20.070Z
2020-06-12T13:05:20.070Z
Antoine Poinsot
<p>I have full bitcoin node available through jsonrpc interface. How my app can detect if this node  is in sync with the network?</p>

<bitcoin-core><synchronization>
How to detect that full node is in sync (using jsonrpc)?
warchantua
# How to detect that full node is in sync (using jsonrpc)?

(Asked by: username_0 on 2020-06-12)

I have full bitcoin node available through jsonrpc interface. How my app can detect if this node is in sync with the network?

**Tags:** bitcoin-core, synchronization


---

## 1 answers

### Answer by username_1 on 2020-06-12. Score: 5 | Accepted answer

Using the `getblockchaininfo` RPC command :

* if `initialblockdownload` is `true`, your node is currently syncing with the network for the first time.
* else :
  + if the `headers` field number is superior to the `blocks` field number, your node is catching up with the current state (likely after having been restarted)
  + else if the `headers` field number is equal to the `blocks` field number, your node is synced !

Here is the current output of the command for me :

```
$ bitcoin-cli getblockchaininfo
{
  "chain": "main",
  "blocks": 634379,
  "headers": 634379,
  "bestblockhash": "000000000000000000136f1b78deeebc33a9b7b33d25c2e37f5446cb33b586fd",
  "difficulty": 13732352106018.34,
  "mediantime": 1591963775,
  "verificationprogress": 0.9999999385944023,
  "initialblockdownload": false,
  "chainwork": "0000000000000000000000000000000000000000104a35fae53a5b470d8e9524",
--snip--
}

```


---

