← Back to Glossary

LevelDB

LevelDB is an open source key-value database library written at Google by Jeff Dean and Sanjay Ghemawat and released in 2011. It stores sorted key-value pairs on disk with fast writes and lookups, in a compact embedded package rather than a database server. Bitcoin Core adopted it in version 0.8, released in 2013, to store the UTXO set and block index.

Why it matters

Validating a new block means checking every input against the set of unspent transaction outputs, and doing that quickly requires a database matched to the workload, many small random lookups and batched updates. LevelDB's design fit well, and the 0.8 migration dramatically accelerated block validation and initial sync for every node.

The switch also produced one of Bitcoin's most instructive incidents. In March 2013, nodes still running the previous database rejected a large block that LevelDB nodes accepted, briefly splitting the network into two chains. Developers and mining pools coordinated a rollback to the old rules within hours. The episode established that consensus is defined by the behavior of deployed software, quirks included, and reshaped how carefully changes to Bitcoin's validation path are handled.

How it works

LevelDB is a log-structured merge tree: writes land in an in-memory table and an append-only log, then compact into sorted files on disk in levels. Bitcoin Core keys the database by transaction output, storing each unspent output's amount and script, so spends are deletions and new outputs are insertions, applied atomically per block.

Ready to convert your gold to Bitcoin?

Get Your Free Kit →