How to download Bitcoin block headers from Blockchain.info and save to file?

1

I am just developing and testing Bitcoin mining application in plain Javascript (slow but can be run off-line).

To test it to work correctly I need to download Bitcoin block headers from Blockchain.info , 6 input parameters .

Are you aware how to call Blockchain API https://blockchain.info/api/blockchain_api

I don't use Bitcoin address, no other mining app, just need to download a number block headers from hashed blocks.

Any idea, demo, example or csv file coming with 6 input parameters as described in Bitcoin hashing algorithm

https://en.bitcoin.it/wiki/Block_hashing_algorithm

darius

Posted 2014-01-27T16:21:37.073

Reputation: 11

1ever thought of using testnet?T9b 2014-01-28T16:25:20.297

It might be easier to test (and more profitable to run) should you target an alt-coin rather than BitcoinJoe Pineda 2014-03-12T13:43:25.433

Answers

2

You can download the blockchain headers from here. The data is binary packed, but can be deserialized easily enough. You seem to be trying to solo mine, which is a bad idea at the best of times, let alone with JavaScript. You also seems to be trying to build a SPV client. An easier way would just be to use https://blockchain.info/latestblock to get the lastblock hash and use that.

Bardi Harborow

Posted 2014-01-27T16:21:37.073

Reputation: 241

1Anyone have writeups on how to ingest the binary packed electrum data, or at least more info on what it is, exactly?David Manheim 2015-12-30T20:55:59.603

The data is the "block header" struct exactly -- https://en.bitcoin.it/wiki/Protocol_documentation#Block_Headers has the documentation. It's a fixed-length binary struct described there.

user295691 2017-08-01T16:40:51.260