<p>No. <code>blk*.dat</code> files are limited by actual size on disk, not number of transactions. Blocks are added to them until they reach a maximum size, not whether they exceed a block or transaction count. As transaction sizes are variable, it is not possible to know how many transactions are in a <code>blk*.dat</code> file without having parsed it first.</p>
<p>However, as Bitcoin Core has already done that parsing for you, you can use the LevelDB database that it creates which contains that information. This <a href="https://bitcoin.stackexchange.com/a/67569/48884">answer</a> provides an explanation of the format of the LevelDB records in the block index (the database stored in <code>blocks/index</code>).</p>

CC BY-SA 4.0
2022-09-05T08:02:56.147Z
Oh so two differently speced systems would have different blk files ?
Rohan Maheshwari
CC BY-SA 4.0
2022-09-05T08:46:52.643Z
The size of BLK files is 128MB max on any system regardless of specification. However even two identically specified systems would have  BLK files whose contents differ due to receiving data in different order and due to differing stale blocks. Early BLK files contain many blocks, each with few transactions. Recent: the reverse
RedGrittyBrick
CC BY-SA 4.0
2022-09-05T04:50:09.323Z
2022-09-05T04:50:09.323Z
Ava Chow
<p>I am working on a parser for the <code>blk.dat</code> files being returned by the Bitcoin Core node. It seems to slow down considerably after a point and I am pretty sure it's because the number of transactions is increasing in the files. My question is, how many transactions do these files contain and is there any way to figure out how many there are without parsing?</p>

<block><leveldb>
Number of transactions per blk.dat files
Rohan Maheshwari
# Number of transactions per blk.dat files

(Asked by: username_0 on 2022-09-05)

I am working on a parser for the `blk.dat` files being returned by the Bitcoin Core node. It seems to slow down considerably after a point and I am pretty sure it's because the number of transactions is increasing in the files. My question is, how many transactions do these files contain and is there any way to figure out how many there are without parsing?

**Tags:** block, leveldb


---

## 1 answers

### Answer by username_1 on 2022-09-05. Score: 4 | Accepted answer

No. `blk*.dat` files are limited by actual size on disk, not number of transactions. Blocks are added to them until they reach a maximum size, not whether they exceed a block or transaction count. As transaction sizes are variable, it is not possible to know how many transactions are in a `blk*.dat` file without having parsed it first.

However, as Bitcoin Core has already done that parsing for you, you can use the LevelDB database that it creates which contains that information. This [answer](https://bitcoin.stackexchange.com/a/67569/48884) provides an explanation of the format of the LevelDB records in the block index (the database stored in `blocks/index`).

> **Comments:**
> **username_0**: Oh so two differently speced systems would have different blk files ?  
> **username_2**: The size of BLK files is 128MB max on any system regardless of specification. However even two identically specified systems would have  BLK files whose contents differ due to receiving data in different order and due to differing stale blocks. Early BLK files contain many blocks, each with few transactions. Recent: the reverse  

---

