<p>The <code>getblockchaininfo</code> RPC will tell you have many blocks and headers you have. When the number of headers is larger, you're still synchronizing.</p>

CC BY-SA 4.0
2020-01-14T23:40:51.340Z
I'm not asking about whether `bitcoind` is syncing blocks or not. I'm talking about the header-first sync. I want to know the progress of that.
M.K. Safi
CC BY-SA 4.0
2020-01-15T00:27:17.090Z
Oh, I misread. In that case the answer is even easier: you can't know.
Pieter Wuille
CC BY-SA 4.0
2020-01-28T18:44:37.993Z
Pieter, what about comparing `startingheight` from the `getpeerinfo` response with the `header` field from the `getblockchaininfo` response?
M.K. Safi
CC BY-SA 4.0
2020-01-28T18:45:13.573Z
Your peers can trivially lie in that field.
Pieter Wuille
CC BY-SA 4.0
2020-01-28T18:49:43.687Z
Yes, but should be good enough for providing sync progress status to the end-user, no?
M.K. Safi
CC BY-SA 4.0
2020-01-28T19:20:38.220Z
If an approximate answer is enough, you can just look at the timestamp of the last header. That's more accurate than relying on startingheight (which will be outdated for long lived connections).
Pieter Wuille
CC BY-SA 4.0
2020-01-28T19:22:19.447Z
The point I'm trying to make is that there is no exact answer to this question: your node is *always* syncing headers, and is never "done". There may be a block that was just mined, but you haven't learned about, so you can never be sure you're caught up.
Pieter Wuille
CC BY-SA 4.0
2020-01-14T23:31:20.093Z
2020-01-14T23:31:20.093Z
Pieter Wuille
<p>Is there a way to know from <code>bitcoind</code> RPC if it's syncing headers or blocks? And is there a way to know the header sync progress?</p>

<p>Even if not directly available, is it possible to derive header sync progress from other information through RPC?</p>

<p>I tried to get this information from the debug log, but the problem there is that occasionally, the last header sync log message looks like this</p>

<pre><code>Synchronizing blockheaders, height: 1660930 (~95.02%)
</code></pre>

<p>It never logs out whether it reached 100% or not, and that's a problem for the software that I'm working on.</p>

<bitcoin-core><bitcoind><json-rpc>
`bitcoind` RPC: ask if syncing headers or blocks
M.K. Safi
# `bitcoind` RPC: ask if syncing headers or blocks

(Asked by: username_0 on 2020-01-14)

Is there a way to know from bitcoind RPC if it's syncing headers or blocks? And is there a way to know the header sync progress?
Even if not directly available, is it possible to derive header sync progress from other information through RPC?
I tried to get this information from the debug log, but the problem there is that occasionally, the last header sync log message looks like this
Synchronizing blockheaders, height: 1660930 (~95.02%)

It never logs out whether it reached 100% or not, and that's a problem for the software that I'm working on.

**Tags:** bitcoin-core, bitcoind, json-rpc


---

## 1 answers

### Answer by username_1 on 2020-01-14. Score: 2

The `getblockchaininfo` RPC will tell you have many blocks and headers you have. When the number of headers is larger, you're still synchronizing.

> **Comments:**
> **username_0**: I'm not asking about whether `bitcoind` is syncing blocks or not. I'm talking about the header-first sync. I want to know the progress of that.  
> **username_1**: Oh, I misread. In that case the answer is even easier: you can't know.  
> **username_0**: Pieter, what about comparing `startingheight` from the `getpeerinfo` response with the `header` field from the `getblockchaininfo` response?  
> **username_1**: Your peers can trivially lie in that field.  
> **username_0**: Yes, but should be good enough for providing sync progress status to the end-user, no?  
> **username_1**: If an approximate answer is enough, you can just look at the timestamp of the last header. That's more accurate than relying on startingheight (which will be outdated for long lived connections).  
> **username_1**: The point I'm trying to make is that there is no exact answer to this question: your node is *always* syncing headers, and is never "done". There may be a block that was just mined, but you haven't learned about, so you can never be sure you're caught up.  

---

