6

Since 0.8 bitcoind uses LevelDB for the storage of the UTXO set in chainstate/ and the block index in blocks/index/. On github special branch of LevelDB can be found:

https://github.com/bitcoin/leveldb

What reasons made LevelDB the best choice for key-value storage compared to other embedded database solutions? How does bitcoind's own LevelDB fork differ from the official version?

Felix Weis
  • 319
  • 3
  • 10

1 Answers1

7

The fork serves two purposes:

  • Local modifications that are hard to bring upstream:

    • Windows support (which is partially based on the existing Windows port, but needed changes for building in MinGW)
    • Removal of compression support, as it doesn't help, and complicates the build.
  • Strict control over changes. Given the previous experience with the BDB to LevelDB changeover that caused a fork in the network, it is wise to not use system-wide installed versions of the library. Hypothetically, even if a change is a bug fix from the point of view of LevelDB, we may want to maintain the buggy behaviour to prevent a fork in the network, depending on the bug.
Pieter Wuille
  • 98,249
  • 9
  • 183
  • 287