0

How do I get Bitcoin block header data with nonce?

There are tens of so called blockchain explorer websites, tens more offering on-line Bitcoin blockchain parsing.

But all I need are historic Bitcoin blockchain header data only for off-line mode study.

In theory I can set up blockchain parser on my own but I need to download full blockchain first and set up parser.

Since I live on wireless Internet 3G, it's not feasible to download 500GB data, so I would prefer an option just to buy historic Bitcoin blockchain header only data, no overheads, no transaction data.

If you know such place or can offer such download, let me know your terms.

1
  • I believe that bitcoin-core will sync all the headers first before syncing the block chain. Perhaps it would be enough to pause/stop syncing after that point?
    –  mynt
    Jan 29, 2018 at 0:50

1 Answer 1

3

There is no need to buy any data, and if someone is offering to sell you block headers, then you are being scammed.

The Bitcoin network protocol supports transmitting just block headers. So you can just use or create a software which can speak the Bitcoin network protocol and download just the block headers. The getheaders message is what you need in order to request the headers from a node, in addition to the normal network protocol stuff. Since block headers are just 80 bytes, the entire download will be 80*506612 = 40528960 bytes = 40.528960 MB.

Instead of writing such a software, you can also use Electrum. Electrum is a SPV wallet, but it downloads all of the block headers. If you create an Electrum wallet and let it sync (syncs very quickly), you will find a file in the Electrum data directory named blockchain_headers. This file contains all of the block headers in raw form (so just as bytes). You can then parse that as per the block header format.

6
  • Thank you Andrew for your excellent answer. 40MB download looks better than 500GB download.Just downloaded Electrum wallet from electrum.org/#download and installed another one by installer but it is not supported by Windows XP 32bit. What is an exact name of block headers file in blockchain_headers Electrum directory? Maybe there is an option to download this file from the Internet directly.
    – darius
    Jan 29, 2018 at 13:47
  • Just downloaded blockchain_headers from headers.electrum.org/blockchain_headers . Size of a file is 36.4 MB vs. 40.528950 MB not sure if the file is last updated.
    – darius
    Jan 29, 2018 at 14:13
  • The file you downloaded is probably out of date.
    – Andrew Chow
    Jan 29, 2018 at 15:29
  • Thank you Andrew for your best answer. I would prefer Electrum wallet based solution due to limits set on getheaders: The getheaders message is nearly identical to the getblocks message, with one minor difference: the inv reply to the getblocks message will include no more than 500 block header hashes; the headers reply to the getheaders message will include as many as 2,000 block headers. BTW Could you put blockchain_headers file for download ?
    – darius
    Jan 29, 2018 at 23:48
  • Here's the file from my Electrum. It's up to block 506732. drive.google.com/file/d/160fTtPS1eIv1QVH4RL785sMCCkt3Crbx/…
    – Andrew Chow
    Jan 30, 2018 at 0:03

Your Answer

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

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