1

I've started the syncing of polkadot node and I want to check how many blocks have synced can anyone tell me how would I do that?

3 Answers 3

0

Similar to Drew's answer...

You should see something like this when syncing:

2022-07-22 19:38:12 [Relaychain] ⚙️  Syncing 91.7 bps, target=#11280082 (50 peers), best: #7467984 (0x2517…6b44), finalized #7467520 (0x7ec6…add8), ⬇ 106.0kiB/s ⬆ 37.1kiB/s 

Notice the target and finalized block numbers.

In my example, I am still far from the target (which is when I am fully synced).

1

Programmatically you can use PolkadotJS or cURL to query that info from the RPC.
For example the last head:

curl -sS -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "chain_getHeader"}' http://localhost:9933/ | jq '.result.number' -r

which prints hex. PolkadotJS is more convenient, see getHeader and getFinalizedHead.

0

On the execution of your chain's node, you should see logs like:

2022-08-30 18:29:22.545  INFO tokio-runtime-worker substrate: 💤 Idle (2 peers), best: #18 (0x43b6…2bc0), finalized #17 (0xcbf3…7bac), ⬇ 0 ⬆ 0

This tells you that you have synced 18 blocks, 17 of which are finalized.

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.