<p>Bitcoin Core has multiple different databases and indexes that it maintains independently of each other since some things are optional.</p>
<p><code>blocks/index</code> contains the LevelDB database for the block index. This contains the information of where every single block is located in the <code>blocks/</code> directory (which blk*.dat file contains it, and the offset within the file). It also has the information of which rev*.dat file has the undo data, and where that undo data is within that file.</p>
<p><code>chainstate/</code> contains the LevelDB database that has the UTXO set.</p>
<p>Both the block index and the chainstate database are necessary for normal operation, and every Bitcoin Core node has them. However, they are separate as they store distinct data, and missing the chainstate database does not mean that the block index is invalid.</p>
<p>If you are missing the chainstate database but have the block index, the chainstate database can be rebuilt much faster than rebuilding both the chainstate and the block index. This is what the <code>-reindex-chainstate</code> option does - it removes the chainstate database but keeps the block index so it only has to rebuild the chainstate. <code>-reindex</code> is a full reindex and removes both databases.</p>
<p>The databasese in <code>indexes/</code> are for the optional indexes - txindex, coinstatsindex, and blockfilterindex. These are maintained separately because they are not necessary for normal operation. The layout of these databases are independent of each other, and since these indexes are built asynchronously, each index has its own database.</p>

CC BY-SA 4.0
2024-06-14T17:39:18.363Z
Perfect answer! Thank you so much!
Pineapple29
CC BY-SA 4.0
2024-06-14T16:51:24.333Z
2024-06-14T16:51:24.333Z
Ava Chow
<p>What's the difference between the 3 index directories I have in Bitcoin Core:</p>
<pre><code>bitcoin/blocks/index/ 129 MB
bitcoin/indexes/ 59 GB
bitcoin/chainstate/ 5 GB
</code></pre>
<p>The size of &quot;bitcoin/blocks/index/&quot; is only 129 MB, with some *.ldb files inside</p>
<p>The size of &quot;bitcoin/indexes&quot; is around 59GB, which has a txindex directory with more *.ldb files in it</p>
<p>What's the difference between those .ldb files in the 2 directories?</p>
<p>The size of &quot;chainstate&quot; is around 5GB</p>
<p>As far as I understand chainstate should store the UTXO index, no? And if so, then why do we need 2 more indexing directories that are so big?</p>

<bitcoin-core><bitcoind><txindex>
What's the difference between the 3 index directories "blocks/index/", "bitcoin/indexes" and "chainstate"?
Pineapple29
# What's the difference between the 3 index directories "blocks/index/", "bitcoin/indexes" and "chainstate"?

(Asked by: username_0 on 2024-06-14)

What's the difference between the 3 index directories I have in Bitcoin Core:

```
bitcoin/blocks/index/ 129 MB
bitcoin/indexes/ 59 GB
bitcoin/chainstate/ 5 GB

```

The size of "bitcoin/blocks/index/" is only 129 MB, with some \*.ldb files inside

The size of "bitcoin/indexes" is around 59GB, which has a txindex directory with more \*.ldb files in it

What's the difference between those .ldb files in the 2 directories?

The size of "chainstate" is around 5GB

As far as I understand chainstate should store the UTXO index, no? And if so, then why do we need 2 more indexing directories that are so big?

**Tags:** bitcoin-core, bitcoind, txindex


---

## 1 answers

### Answer by username_1 on 2024-06-14. Score: 3 | Accepted answer

Bitcoin Core has multiple different databases and indexes that it maintains independently of each other since some things are optional.

`blocks/index` contains the LevelDB database for the block index. This contains the information of where every single block is located in the `blocks/` directory (which blk\*.dat file contains it, and the offset within the file). It also has the information of which rev\*.dat file has the undo data, and where that undo data is within that file.

`chainstate/` contains the LevelDB database that has the UTXO set.

Both the block index and the chainstate database are necessary for normal operation, and every Bitcoin Core node has them. However, they are separate as they store distinct data, and missing the chainstate database does not mean that the block index is invalid.

If you are missing the chainstate database but have the block index, the chainstate database can be rebuilt much faster than rebuilding both the chainstate and the block index. This is what the `-reindex-chainstate` option does - it removes the chainstate database but keeps the block index so it only has to rebuild the chainstate. `-reindex` is a full reindex and removes both databases.

The databasese in `indexes/` are for the optional indexes - txindex, coinstatsindex, and blockfilterindex. These are maintained separately because they are not necessary for normal operation. The layout of these databases are independent of each other, and since these indexes are built asynchronously, each index has its own database.

> **Comments:**
> **username_0**: Perfect answer! Thank you so much!  

---

