Bitcoin Forum
May 12, 2024, 10:23:55 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to detect (with bitcoin-cli) if the blockchain download has been completed  (Read 305 times)
DrakonX (OP)
Jr. Member
*
Offline Offline

Activity: 99
Merit: 4


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?
1715509435
Hero Member
*
Offline Offline

Posts: 1715509435

View Profile Personal Message (Offline)

Ignore
1715509435
Reply with quote  #2

1715509435
Report to moderator
1715509435
Hero Member
*
Offline Offline

Posts: 1715509435

View Profile Personal Message (Offline)

Ignore
1715509435
Reply with quote  #2

1715509435
Report to moderator
1715509435
Hero Member
*
Offline Offline

Posts: 1715509435

View Profile Personal Message (Offline)

Ignore
1715509435
Reply with quote  #2

1715509435
Report to moderator
If you see garbage posts (off-topic, trolling, spam, no point, etc.), use the "report to moderator" links. All reports are investigated, though you will rarely be contacted about your reports.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
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 (OP)
Jr. Member
*
Offline Offline

Activity: 99
Merit: 4


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: 3388
Merit: 6635


Just writing some code


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!