I'm building a hobby project with bitcoin-style data storage: I'm going to write block data into one large file. I need to decide how to represent the file in app's memory. Bitcoin uses key-value storage to associate entity hashes with places in data files where they are stored. If I want to do the same, are there any serious performance differences between key-value and relational databases for such a use-case?

  • bitcoin stores the data of blockchain not in a database "key-value", but in raw file data. However, Bitcoin uses the levelbd (and in the last update it could be supported also SQLite) to store the information about the mempool a.k.a chainstate directory. Commented Mar 22, 2021 at 9:50
  • and maybe this post answer at your question bitcoin.stackexchange.com/q/85864/91194 Commented Mar 22, 2021 at 9:53
  • Unfortunately, your link is not enough for me. I will rephrase my question for you: why bitcoin still uses level-db to store the chain-state and not SQLite from the start? Did developers had performance or personal convenience considerations in mind? Thanks for a fast response. Commented Mar 23, 2021 at 8:08
  • I'm not a Bitcoin core developer (unfortunately) but I think that the main motivation is related to history. However, the chain state contains only small information regarding the UTXO and nothings else. All the information is stored on the disk because it is impossible (in my knowledge) to store in a faster way the information in any type of database. Commented Mar 23, 2021 at 11:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.