4

For study purposes, I would like to download blocks from a specific period, i.e. January 2017 - June 2017, in blk.dat format (blk00000.dat, blk*.dat).

I downloaded blockchain.core but it makes me download the whole blockchain - correct me if I'm wrong.

Also I tried with blockchain.info but the problem is that I can only get one block at a time and just in Json or Hex format - don't need those.

So, do you know how could I do and with which program or API to use?

I'm a beginner, so please the more details you can give the better it is, even if they seems obvious.

For this work I'm coding in python.

2 Answers 2

4

The data in blk.dat files is stored in binary, and each new block gets appended to the end of the file. Blocks are not downloaded in order always.

So you can write python code to read files, convert to hex, check if it has one of the blocks mined between 446032- 473593 and save the required information.

https://learnmeabitcoin.com/technical/blkdat

I would suggest doing the sync of full node on your machine instead of downloading blocks data from external sources, however there was a related question in past which has few links which may be helpful: Can I download the whole block chain from somewhere?

One blockchain parser in python which might help you solve this problem: https://github.com/ragestack/blockchain-parser

1
  • I have to work on a project already made that wants blk.dat as input so I don't want to convert to Hex, otherwise I don't resolve my problem. also how could I convert to hex since I'm not able to download those blocks? I'm asking where there is some program or api that give blocks in the format I need selecting a specific date. Also I don't want to download the whole ledger. Thanks Commented Sep 25, 2020 at 14:23
4

Bitcoin Core is the only software that saves the blocks in the blk*.dat format. This format is not standardized and internal (i.e. not exposed to users). The contents of, for example, blk2342.dat can differ between multiple instances of Bitcoin Core.

The only option is to run Bitcoin Core yourself, or to find somebody who runs Bitcoin Core and can provide you with these files.

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.