3

Is there a way to find out which blk*.dat file contains a particular block?

For example, it would be useful to know which *.dat file contains block 478558, which is the point where BCH forked from BTC. As both share all the prior blocks, when running the forked node, it would save a lot of bandwith to just copy the block files from BTC to the BCH data directory and reindex them (with the -reindex option), rather than having to re-download them all over again.

3

Is there a way to find out which blk*.dat file contains a particular block?

We can't tell you which of your *.dat files contains block 478558 because there is no requirement that different nodes store their data in the same way.

Two installations of the same software (e.g. Bitcoin core) could have different blocks in a blk*.dat file of the same name. In fact this is probable.

See Is every copy of the Blockchain the same?

So the only way for you to find out is to parse the indexes or search every file until you find the block. I imagine you could probably make an estimate of which file is most likely based on current blockchain height + sought block and start your search in files near your best guess.

Your Answer

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

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