1

I send rpc calls to a node through tezos-client and I would like to know the length, or the height, of the blockchain so I can see if it is synced and, if not, how much time is remaining. How do I do that?

2 Answers 2

2

tezos-client rpc get /chains/main/blocks/head. Look for the value of the level key under the header key in the outputted json.

The output data is quite big, so you can use this:

tezos-client rpc get /chains/main/blocks/head | grep level | head -1

1
  • 1
    Since all output of the RPC is JSON, you should look into using jq rather than grep/head. Far more powerful for command-line filtering.
    – utdrmac
    Jul 16, 2020 at 19:01
1

You can also call tezos-client get timestamp repeatedly: it will give you the timestamp of the most recently received block. You'll get an idea on where you're at and how long you have left to synchronize. If you want to synchronize the full state of the blockchain, this might take a long time. Look into snapshots to get into sync faster. You can find snapshots here.

Your Answer

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

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