0

I try to use the build in API by bitcoin client and I wonder how to get the sync status via API of a runing client.

0

You can do it like this:

1) getblockcount gives you the most recent block you have [call it n]

2) getblockhash n gives you the hash for that block [call it hash]

3) getblock hash gives you the block. You can compare the time of that block with the current time, and estimate how many blocks behind you are. It should be approximately (now - blocktime) / 600 if the times are in seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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