Author

Topic: How to detect (with bitcoin-cli) if the blockchain download has been completed (Read 322 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
Thanks for your reply. I'm not sure. I mean, there must be a way to check if the blockchain loading is complete without checking how many blocks do currently exist first and then compare this number with the number of loaded block.

I have something in minde like "bitcoin-cli -proof-completeness" and getting "yes" or "no" as a result. I just want to know when the system is ready to spend any funds.
This is not possible. Bitcoind does not and cannot know when the blockchain is actually fully synced until it is fully synced (and even then it technically doesn't know it is synced). The best you can do is check the blockchain height.

There is a variable called IsInitialBlockDownload and in the next major release of Bitcoin Core, that variable will be included in the getblockchaininfo output. That is what tells the GUI to show whether it is in syncing mode or not, but IBD can be set to false before it is actually fully synced.
jr. member
Activity: 99
Merit: 4
Thanks for your reply. I'm not sure. I mean, there must be a way to check if the blockchain loading is complete without checking how many blocks do currently exist first and then compare this number with the number of loaded block.

I have something in minde like "bitcoin-cli -proof-completeness" and getting "yes" or "no" as a result. I just want to know when the system is ready to spend any funds.
hero member
Activity: 840
Merit: 508
Make winning bets on sports with Sportsbet.io!
You'll have to have the bitcoind running as a daemon on the background, as well as rpc user and password set for it. From bitcoin-cli if there are rpc details, you can check the amount of blocks synced by this command: bitcoin-cli getblockcount or ./bitcoin-cli getblockcount if running from the same directory. Is this the answer that you were looking for?
jr. member
Activity: 99
Merit: 4
When running Bitcoin Core on Windows, I have a GUI that tells me when the blockchain has been completely downloaded. But how do I check that with bitcoin-cli on the command line of linux?
Jump to: