8

I'm using bitcoind on Ubuntu, headless. So there's no GUI to tell me when it's done.

So how do I know?

5

Run bitcoind getinfo in your shell of choice and compare the block count, listed after "blocks", to the block count listed here. If the two numbers are the same, your client is up to date.

5

Here's a script doing just that:

echo `bitcoin-cli getblockcount 2>&1`/`wget -O - https://blockchain.info/q/getblockcount 2>/dev/null`
3

Run bitcoind getblocktemplate. If you're not caught up, then it will come back with an error of -10.

  • I checked this, it's not so. (I checked it on the testnet network though, but should not be different that mainnet in this case.) – Steven Roose Apr 5 '13 at 2:27
  • This is a slight hack, but it more or less works. Great :) – Karel Bílek Apr 5 '13 at 16:21
  • @StevenRoose, what was the problem you found with this method? When did it not work? It seems to be working for me, erroring when I'm in the middle of downloading blocks. – morsecoder Nov 17 '14 at 18:28
  • @StephenM347 it's been more than a year, probably there was an issue back then that has been resolved by now.. – Steven Roose Nov 17 '14 at 20:52
1

The bitcoind command shows different errors now.

The new way to check is with bitcoin-cli getblocktemplate

Scripted use has been posted where I first ran accross this question

How to check if the block chain is up to date using bitcoind or json-rpc?

1

Simplest way is to run

bitcoind -blocknotify myscript.sh %s

On the blocks after bitcoind catches up with the blockchain, your scripts will get called with the new blockhash. You can print a message or do anything else required in this script

0

With only a Web browser, you can visit http://bitcoinwatch.com/ to discover the current Bitcoin Network's block height or count.

Or point your bitcoin-cli to a production Bitcoind server and issue the following command (note, the *.conf file should be the one you use instead):

% ../bin/bitcoin-cli -conf=mainNet-productionServer.conf getblockcount

The easiest way is to query all of your peer connections for numerous details that also includes the "startingheight" for each of them.

% ../bin/bitcoin-cli -conf=mainNet-localServer.conf getpeerinfo

Alternatively, the following libbitcoin-explorer command (bx, serves an analogous role as bitcoin-cli) provides only a single number when the bx client connects to a production bitcoin-server (previously called Obelisk) to query it for the Blockchain's height.

% bx fetch-height

To get the current height of your localServer that is being built try:

% ../bin/bitcoin-cli -conf=mainNet-localServer.conf getblockcount

For contrasting purposes, the following bitcoin-cli help command provides additional details to for your local Blockchain image you are building:

% ../bin/bitcoin-cli -conf=mainNet.conf help gettxoutsetinfo gettxoutsetinfo

Returns statistics about the unspent transaction output set. Note this call may take some time.

Result: { "height":n, (numeric) The current block height (index) "bestblock": "hex", (string) the best block hash hex "transactions": n, (numeric) The number of transactions "txouts": n, (numeric) The number of output transactions "bytes_serialized": n, (numeric) The serialized size "hash_serialized": "hash", (string) The serialized hash "total_amount": x.xxx (numeric) The total amount }

Your blockchain is complete when the two numbers match. This approach will give you a good idea about your current status.

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.