I'd like to download all the blockheaders for the blockchain directly from the network (not an external API) ... what is the best way to do this?

I don't actually care about the transaction data and have no need for it, specifically, I need the difficulty level at each block, along with the timestamp. I know there are API's etc. to get this information but I specifically do not want to do that for my use case. I would not like to run the entire bitcoind service locally (there is too much overhead downloading the whole chain, verifying it etc.)

1 Answer 1


You can make it with getheaders p2p message, will return headers of blocks in a range.
Remember of handshaking and setting tx-relay to false.

  • Thanks! This is what I'm looking for. Is there a C++ library that could handle sending/receiving the data?
    – user491880
    Jan 16, 2022 at 23:47

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.