Userspace files

Bitcoin Core stores a number of files in its data directory ($DATADIR) at runtime.

Block and undo files

$DATADIR/blocks/blk*.dat

Stores raw network-format block data in order received.

$DATADIR/blocks/rev*.dat

Stores block "undo" data in order processed.

You can see blocks as 'patches' to the chain state (they consume some unspent outputs, and produce new ones), and see the undo data as reverse patches. They are necessary for rolling back the chainstate, which is necessary in case of reorganisations.

— Pieter Wuille
stackexchange

Indexes

With data from the raw block* and rev* files, various LevelDB indexes can be built. These indexes enable fast lookup of data without having to rescan the entire block chain on disk.

Some of these databases are mandatory and some of them are optional and can be enabled using run-time configuration flags.

Block Index

Filesystem location of blocks + some metadata

Chainstate Index

All current UTXOs + some metadata

Tx Index

Filesystem location of all transactions by txid

Block Filter Index

BIP157 filters, hashes and headers

Coinstats Index

UTXO set statistics

Name Location Optional Class

Block Index

$DATADIR/blocks/index

No

BlockIndex

Chainstate Index

$DATADIR/chainstate

No

Chainstate

Tx Index

$DATADIR/indexes/txindex

Yes

TxIndex

Block Filter Index

$DATADIR/indexes/blockfilter/<filter name>

Yes

BlockFilterIndex

Coinstats Index

$DATADIR/indexes/coinstats

Yes

CoinstatsIndex