Thank you I’ll give it a shot.
Is there a command that shows the sync progress compared to the current block height? Or just one which gives you the current block height?
Use zcash-cli getblockchaininfo
which will return this:
{
"chain": "main",
"blocks": 309572,
"headers": 309572,
"bestblockhash": "000000000bf222f68d1c21a9671a8da6c289a60bb98d847cbd7408cf5d096151",
"difficulty": 8605010.589854863,
"verificationprogress": 0.9999989940411195,
"chainwork": "0000000000000000000000000000000000000000000000000024e15280fb9306",
"pruned": false,
"commitments": 946868,
"valuePools": [
{
"id": "sprout",
"monitored": true,
"chainValue": 260391.43430996,
"chainValueZat": 26039143430996
}
],
...
zcash-cli getblockcount
will return the number of blocks only.
These commands indeed return the synced block height and header height. But is there a command that asks the network for the current block height (best currently known by other nodes)? Or something that estimates it based on system time, so that you don’t have to turn to an external tool to gauge the current up-to-date block height?
Doesn’t it sync block headers first so you know latest block based on the headers field of the getblockchaininfo
RPC call?
Yes, it does sync the headers first, and obviously that’s a faster process. But it doesn’t tell you what is the most recent block on the network. Syncing headers also takes considerable time.
I’m looking for the most recent block height in order to tell where I am in syncing percentage-wise. Of course I could go to a block explorer website, but that’s even less trustless.
You could try getpeerinfo
and parse through it but not sure you are going to get anything more helpful than what exists in getblockchaininfo
.
That’s a step closer. It doesn’t tell the most recent block height, but it tells you the most recent block height of a connected node at the time when you connected to it, which can be basis for approximation.