0

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?

  • 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 Oct 31 at 22:05
  • And both of them are handled by leveldb so we don’t know exactly where they are stored? – kcalvinalvin Nov 1 at 3:00
  • 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 Nov 1 at 3:06
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.