TECHNICAL_DOC // BLOCK / BLK-DAT
BLK.DAT
The blk.dat files are bitcoin-core/">Bitcoin Core's on-disk storage for raw block data.
Located in the
blocks/ directory of the Bitcoin data folder, they store
the complete serialized block data in the order blocks were received — not necessarily
by height. Each file holds up to 128 MB of blocks, identified by a magic number prefix
and size field before each block.
FILE_FORMAT
BLK.DAT BINARY FORMAT
File: blocks/blk00000.dat, blk00001.dat, ...
Max size per file: 128 MB (134,217,728 bytes)
Each block entry:
[4 bytes] magic number = 0xF9BEB4D9 (mainnet)
= 0x0B110907 (testnet)
[4 bytes] block size (LE) number of bytes in block data
[N bytes] raw block data serialized block (header + txs)
Block data format:
[80 bytes] block header
[varint] tx count
[...] serialized transactions
Blocks appear in write order (receive order), NOT height order.
The index is in blocks/index/ (LevelDB) mapping height → file+offset
Directory Structure
BITCOIN CORE
Bitcoin Core's data directory contains several subdirectories for block storage, indexes, and wallet data.
~/.bitcoin/ (Linux/Mac)
%APPDATA%\Bitcoin\ (Windows)
├── blocks/
│ ├── blk00000.dat ← raw block data (128 MB chunks)
│ ├── blk00001.dat
│ ├── ...
│ ├── rev00000.dat ← undo data (for reorgs)
│ ├── rev00001.dat
│ └── index/ ← LevelDB: block position index
│ ├── CURRENT
│ ├── MANIFEST-...
│ └── *.ldb
├── chainstate/ ← LevelDB: UTXO set
├── mempool.dat ← persisted mempool (optional)
├── peers.dat ← known peer addresses
└── bitcoin.conf ← configuration
Total disk: ~650 GB for full archival node (2025)
rev.dat — Undo Files
REORG SUPPORT
Alongside each blk.dat file is a corresponding rev.dat file containing undo data — the information needed to reverse a block if a chain reorganization occurs.
rev00000.dat contains undo records for blk00000.dat.
Undo record per block:
For each input spent in the block:
- Previous output value (satoshis)
- Previous scriptPubKey
Purpose: when a reorg removes a block, the UTXO set
must be restored to its pre-block state.
Without undo data: reorg would require replaying all
transactions from genesis to rebuild the UTXO set.
TERMINOLOGY_INDEX
blk.dat
Raw block storage files used by Bitcoin Core. Named blk00000.dat, blk00001.dat, etc. Up to 128 MB each.
Magic Number
0xF9BEB4D9 — a 4-byte identifier preceding each block in blk.dat, confirming mainnet data.
rev.dat
Undo files paired with blk.dat. Store data needed to reverse blocks during chain reorganizations.
Block Index
LevelDB database in blocks/index/ mapping block hashes to their location in blk.dat files.
Pruned Node
A node that deletes old blk.dat files, keeping only the UTXO set and recent blocks (~550 MB minimum).