How can I get an actual level of block-chain from not synced node (via RPC). i.e how get how many blocks left for synchronization my node?
2 Answers
You can request the current head of your node using ./tezos-client rpc get /chains/main/blocks/head
(and look for the level
and hash
information). Then, use your favorite block explorer to know the level of the current head.
Alternatively, the ./tezos-client bootstrapped
command aims to hang and return only when the node is synchronized.
Here's my goto command.
tezos-client rpc get /chains/main/blocks/head/ | jq -r '.header.level, .header.timestamp';date --iso-8601=seconds
The output will look something like:
544640
2019-07-31T10:53:57Z
2019-07-31T10:54:10+00:00
Which is the node's block level, the last block timestamp and your system's timestamp.
Run it a few times, waiting 10 - 20 seconds in between, to get an estimate on the time remaining to catch up.