2

The following CLI command:

$ bitcoin-cli getblockcount

Gives the following error message:

error code: -28
error message:
Activating best chain...

Any idea what is error code: -28?

2 Answers 2

10

Error -28 is defined as RPC_IN_WARMUP, see https://github.com/bitcoin/bitcoin/blob/master/src/rpc/protocol.h.

The bitcoind server has just started and is still processing its stored blockchain data to figure out what it has. It can take several minutes. Activating best chain is one stage of this, where the daemon looks at the blocks it knows so far and determines which fork is the best chain. So it cannot yet tell you the number of blocks (in the best chain), because it doesn't yet know what the best chain is.

If you try the call again in a few minutes, it should succeed.

2
  • 2
    Seems like a patch making the bitcoin-cli error message print that text would be helpful. =) Commented Jul 22, 2016 at 16:57
  • You can follow progress by tailing the debug log: tail -f debug.log
    – pors
    Commented Jan 10, 2021 at 18:53
4

This would be normal if you just started your bitcoind service and it is still verifying downloaded blocks.

It can be a result that bitcoind did not had time enough to write changes to disk last time it was used or that it downloaded blocks but didn't prozess them jet.

Just let bitcoind run a bit longer and try the command again.

Here is a similar answer that goes a bit into more detail: What does "Activating Best Chain" mean?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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