Questions tagged [leveldb]

LevelDB is an embedded key-value storage developed by Google that is used in Bitcoin Core for block index storage and quick access to the UTXO set (unspent transaction outputs).

62 questions
39
votes
4 answers

What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

I am wondering if I can use node.js and levelup to access a copy of the blockchain database directly. But from what I can see, I need to know the name of the key(s) before I can get any data, as this is used in the get method of levelup. However, I…
T9b
  • 1,334
  • 1
  • 11
  • 16
22
votes
1 answer

Migration from Berkeley DB to LevelDB

In 2013 a new bitcoin core was released and one of the supposed improvement was migrating from Berkeley DB to LevelDB. According to the release notes at bitcoin.org: LevelDB, a fast, open-source, non-relational database from Google, is now used…
22
votes
1 answer

How does Bitcoin read from/write to LevelDB

I know that Bitcoin Core uses LevelDB since 0.8 version. However, I couldn't find detailed explanation about how Bitcoin stores and retrieves from LevelDB. E.g. If B transaction uses an output from previous transaction A as input, how does Bitcoin…
Yangrui
  • 627
  • 1
  • 5
  • 12
11
votes
1 answer

Why is Bitcoin Core using LevelDB instead of Redis or SQLite?

Why did Core move from BDB to LevelDB? Why don't they use SQLite or move to Redis now? Is there a technical reason for this choice?
Etherkimist
  • 135
  • 1
  • 5
8
votes
3 answers

How to access Bitcoin's transaction database?

I want to process the Bitcoin network's transactions. As I understand it, the Bitcoin-Qt client downloads and stores all that information locally. Since version 0.8 LevelDB has been used to access this data. I found two databases, in blocks/index…
msteiger
  • 211
  • 1
  • 2
  • 5
6
votes
1 answer

Why does bitcoind use a fork of LevelDB for key-value storage?

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…
Felix Weis
  • 319
  • 3
  • 10
6
votes
1 answer

When the UTXO in the cache is full, what strategy is used to replace one UTXO with another in the cache?

The UTXO set is stored on the disk, but some UTXOs are also stored in the cache. When validating a transaction, you need to query the UTXO pointed to by the input of the transaction. First, you go to the cache to find it, if it's not found, you need…
GoneV
  • 175
  • 8
4
votes
3 answers

Format of a block key's contents in bitcoind's LevelDB?

I am trying to use bitcoind's LevelDB block index files (that are stored in blocks/index) to find the file (e.g. blk00029.dat) and byte position of specfic blocks. Thanks to questions What is the database for? and What are the keys used in the…
Arjen
  • 143
  • 5
4
votes
1 answer

In which order does the leveldb iterator iterate over utxos?

I would like to know in which order the leveldb iterator iterates over the chainstate entries. I aim to serialize the chainstate and have to make sure that every node can calculate exactly the same serialization (to compare its hash afterwards).
user50317
4
votes
1 answer

mysql instead of leveldb for bitcoin core

Is it possible to use db other than leveldb for bitcoin core? I'd like to make queries on running node and make views with decoded data
Igor Barinov
  • 546
  • 1
  • 4
  • 17
3
votes
1 answer

What is in the Bitcoin Core LevelDB dbcache? Is it full records or metadata?

What is in the Bitcoin Core LevelDB dbcache? Is it full records or metadata? This question was asked on IRC by Anonymous.
3
votes
1 answer

Does the chainstate leveldb only contain "addresses" for P2PKH and P2SH?

I'm writing a small script that will dump the utxo database to a text file. As far as I'm aware, these are the most common script patterns indicated by the type field inside each value: e.g. value: …
inersha
  • 2,928
  • 1
  • 17
  • 41
3
votes
2 answers

Why was Bitcoin Core in need of a fork of LevelDB?

Why did Bitcoin Core fork LevelDB? What special needs does Bitcoin Core have, which require a specialized version of LevelDB?
MCCCS
  • 10,097
  • 5
  • 27
  • 55
3
votes
1 answer

Chainstate LevelDB corruption after reading from the database

I've been working with the LevelDB for a few weeks, coding some tools to access the database and parse the data to be human readable. However, every single time I read from the chainstate the data gets corrupted (ask me to rebuild it when running…
sr_gi
  • 3,087
  • 1
  • 11
  • 36
3
votes
2 answers

CVarint serialization format

Recently I started analyzing the UTXO set data that every full node stores in chainstate folder (a LevelDB database). By looking into the code you can learn more or less how the data entries are formatted. However, to save as much space as possible,…
sr_gi
  • 3,087
  • 1
  • 11
  • 36
1
2 3 4 5