0

Bitcoin Core keeps block data as files in the file system and blocks indexes in a LevelDB database to make the search process of transactions and blocks faster. But Bitcoin Core also stores block headers in memory as well, doesn't it? If yes, what is the purpose of having both storage mechanisms together?

1
  • 1
    Bitcoin is just a protocol, and how implementations of that protocol deal with storage is up to them. Your stated assumptions however are correct for versions of Bitcoin Core, and software based on its codebase. Commented Dec 10, 2021 at 19:54

1 Answer 1

3

I think you are confusing what it means to store things "in memory". As you say, indeed, the block index DB and the chainstate DB are both levelDB databases stored on disk. However, while Bitcoin Core is running, parts (or all) of these databases are loaded into memory to speed things up. The "in memory" part isn't a separate database. So there is no redundancy/duplication.

1
  • Then, both index DB and chainstate DB (the UTXO set) are loaded into memory to speed things up. But, what about the block header? And, when these data are loaded into memory? Commented Dec 19, 2021 at 12:21

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.