3

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 2

4

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.

2
  • I mean, can I do it via 1 rpc request.
    – intosKai
    Commented Jul 31, 2019 at 9:39
  • No, there is no such RPC.
    – vect0r
    Commented Jul 31, 2019 at 11:41
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.