<blockquote>
<p>Is there a way to find out which blk*.dat file contains a particular block?</p>
</blockquote>
<p>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.</p>
<p>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.</p>
<p>See <a href="https://bitcoin.stackexchange.com/q/100205/13866">Is every copy of the Blockchain the same?</a></p>
<p>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.</p>

CC BY-SA 4.0
2020-11-29T18:21:49.503Z
2020-11-30T00:44:35.263Z
2020-11-30T00:44:35.263Z
RedGrittyBrick
<p>Is there a way to find out which <code>blk*.dat</code> file contains a particular block?</p>
<p>For example, it would be useful to know which <code>*.dat</code> file contains block <code>478558</code>, which is the point where <code>BCH</code> forked from <code>BTC</code>. 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 <code>-reindex</code> option), rather than having to re-download them all over again.</p>

<block><blockchain-fork><raw-data><bandwidth><reindex>
Which blk*.dat file contains a particular block?
D R
# Which blk*.dat file contains a particular block?

(Asked by: username_0 on 2020-11-28)

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.

**Tags:** block, blockchain-fork, raw-data, bandwidth, reindex


---

## 1 answers

### Answer by username_1 on 2020-11-29. Score: 4 | Accepted answer

> 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?](https://bitcoin.stackexchange.com/q/100205/13866)

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.


---

