<p>It depends on your specific data directory. Bitcoin Core uses a LevelDB database for the index and LevelDB handles the exact storage format and files of the database. This can be different for every data directory. There is no particular file that that record is stored in that Bitcoin Core knows.</p>

CC BY-SA 4.0
2019-10-31T21:39:14.303Z
2019-10-31T21:39:14.303Z
Ava Chow
<p>My understanding is that Bitcoin Core stores where it left off(DB_LAST_BLOCK) in $DATADIR/blocks/index.</p>

<p>But which is the actual file bitcoin core stores it at?</p>

CC BY-SA 4.0
2019-10-31T22:05:28.443Z
DB_LAST_BLOCK is just the highest index blk*.dat file number that's in use. To know what the tip of the currently validated chain is, look for DB_BEST_BLOCK.
Pieter Wuille
CC BY-SA 4.0
2019-11-01T03:00:17.197Z
And both of them are handled by leveldb so we don’t know exactly where they are stored?
kcalvinalvin
CC BY-SA 4.0
2019-11-01T03:06:54.580Z
They're stored in LevelDB. How LevelDB chooses to format that in files is not something we care about. You need a LevelDB library to read it, but generally you really shouldn't (it's also impossible while Bitcoin Core is running, as LevelDB is only designed for single-process access). If you need to know up to where Bitcoin Core is synchronized, use the `getblockchaininfo` RPC call.
Pieter Wuille
<bitcoin-core><bitcoind><bitcoin-core-development>
Where does Bitcoin Core store DB_LAST_BLOCK?
kcalvinalvin
# Where does Bitcoin Core store DB_LAST_BLOCK?

(Asked by: username_0 on 2019-10-31)

My understanding is that Bitcoin Core stores where it left off(DB\_LAST\_BLOCK) in $DATADIR/blocks/index.

But which is the actual file bitcoin core stores it at?

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

> **Comments:**
> **username_1**: DB_LAST_BLOCK is just the highest index blk*.dat file number that's in use. To know what the tip of the currently validated chain is, look for DB_BEST_BLOCK.  
> **username_0**: And both of them are handled by leveldb so we don’t know exactly where they are stored?  
> **username_1**: They're stored in LevelDB. How LevelDB chooses to format that in files is not something we care about. You need a LevelDB library to read it, but generally you really shouldn't (it's also impossible while Bitcoin Core is running, as LevelDB is only designed for single-process access). If you need to know up to where Bitcoin Core is synchronized, use the `getblockchaininfo` RPC call.  

---

## 1 answers

### Answer by username_2 on 2019-10-31. Score: 2 | Accepted answer

It depends on your specific data directory. Bitcoin Core uses a LevelDB database for the index and LevelDB handles the exact storage format and files of the database. This can be different for every data directory. There is no particular file that that record is stored in that Bitcoin Core knows.


---

