Bitcoin Forum
October 16, 2018, 06:00:22 PM *
News: Make sure you are not using versions of Bitcoin Core other than 0.17.0 [Torrent], 0.16.3, 0.15.2, or 0.14.3. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How to detect (with bitcoin-cli) if the blockchain download has been completed  (Read 192 times)
DrakonX
Newbie
*
Offline Offline

Activity: 78
Merit: 0


View Profile
November 25, 2017, 04:46:44 PM
 #1

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?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
onnz423
Hero Member
*****
Offline Offline

Activity: 840
Merit: 508


Make winning bets on sports with Sportsbet.io!


View Profile
November 25, 2017, 06:10:39 PM
 #2

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?

   ▄▄██████▄▄
  ████████████
███▄▄
 ██████████████▀▀▀██▄
████████████████   ▀██▄
████████████████     ▀██
██████████████       ██▌
██████████████        ▐██
██▌▀▀██████▀▀         ▐██
▐██                   ██▌
 ██▄                 ▄██
  ▀██▄             ▄██▀
    ▀██▄▄▄     ▄▄▄██▀
      ▀▀█████████▀▀





███████████████████████████
████████▀▀       ▀▀████████
█████▀   ▄ ▀███▀ ▄   ▀█████
████  ▄████▄ ▀ ▄████▄  ████
███  ▄ ▀███▀ ▄ ▀███▀ ▄  ███
██  ▄██ ▀▀ ▄███▄ ▀▀ ██▄  ██
██  █▀ ▄█ ███████ █▄ ▀█  ██
██   ▄███▄ █████ ▄███▄   ██
███  ████▀ ▄▄▄▄▄ ▀████  ███
████  ▀ ▄ ▀█████▀ ▄ ▀  ████
█████▄  ▀▀▄ ███ ▄▀▀  ▄█████
████████▄▄       ▄▄████████
███████████████████████████





█▀▀











█▄▄
▀▀█











▄▄█
█▀▀











█▄▄
▀▀█











▄▄█
DrakonX
Newbie
*
Offline Offline

Activity: 78
Merit: 0


View Profile
November 25, 2017, 11:42:46 PM
 #3

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.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 1554
Merit: 1701


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
November 26, 2017, 12:47:01 AM
 #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.
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.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!