3

I just install the bitcoind and run:

bitcoind -daemon

and when i tried to:

bitcoin-cli getblockhash 195876

i got an message:

error code: -8
error message:
Block height out of range

the command:

bitcoin-cli getblockchaininfo

got me the data -

{
"chain": "main",
"blocks": 195807,
 ......
}

but the current block height is more than 574000 why does bincoind doesnt see all the blocks?

1 Answer 1

5

That's because although the Bitcoin blockchain has a current height of 574080, your full node has synced until 195807 (the output "blocks": 195807 after running getblockchaininfo command). Block 195876, the one that you are querying, has not synced yet on your node. As you said, you have just installed Bitcoin Core. It take many hours (or sometimes days depending on your machine) for the node to reach the tip of the blockchain. It is not the size of the blockchain that makes it take so long time, but because your full node will go through every transaction since the genesis block and make sure that they confine by the consensus protocol.

2
  • I agree that the blocks themselves aren't yet all synchronized in his case but the headers should be, as they are synchronized before synchronizing the blocks. So in theory getblockhash should work as to some extent it only relies on headers and not blocks. As I describe theoretically, are you aware of any way to have getblockhash working without having to synchronize all the blocks but only the headers? Aug 4, 2023 at 13:28
  • @BenjaminLoison good first point. Bitcoin Core doesn't support getblockhash mode only natively, as it's a full node client. You can however verify the blocks and delete them using the prune option. However, you can interact with only block headers using SPV clients like Electrum.
    – Ugam Kamat
    Aug 15, 2023 at 10:16

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.