0

Currently, my node is syncing blocks and tip(height) is 230000.

At this point, if I use command bitcoin-cli getblockhash 230000, the return information will be successful but, if I use bitcoin-cli getblockhash 240000, it returns error due to out of current range.

Yes, I know that the query that I request is definitely out of range in my chain. but I want to query even if the data is not in my chain. I think that it will be possible by asking my peers. so what is the command for my purpose?

Sorry for my English.

  • I don't think is possible, the RPC framework work only on your copy of blockchain (for when i know). – vincenzopalazzo Nov 22 '19 at 18:18
  • oh.. really? so what should I do when I want to specific query to my peer? is there alternative tool or method instead bitcoin-cli? – Hyunsoo Nov 22 '19 at 18:32
  • 3
    The Bitcoin protocol literally has no way to ask for a header at a given height. It would be pointless information as it cannot be validated. If you want to know, wait until your own node is in sync, and ask it locally. – Pieter Wuille Nov 22 '19 at 18:50
  • 1
    @Hyunsoo Nodes can request blocks and headers based on the blocks before it, allowing them to synchronize that information. But there is no "give me the block hash at height X". If you need blockchain information, you at least need fo ask for all the headers. – Pieter Wuille Nov 23 '19 at 6:38
  • 1
    Synchronization does not happen by height, but by hash. One node says "I have blocks up to the one with hash X, what comes after?", the other responds with a bunch of hashes or headers. Once those are processed, the first one asks for more. The reason synchronization does not work by height js because there may be multiple blocks with the same height when there is a fork – Pieter Wuille Nov 23 '19 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.