<p>On the subject of why LevelDB is used, core developer Greg Maxwell stated the following to the <a href="http://bitcoin-development.narkive.com/XAPoxKZU/patch-switching-bitcoin-core-to-sqlite-db" rel="nofollow noreferrer">ref</a>:</p>

<blockquote>
  <p>I think people are falling into a trap of thinking "It's a <code>&lt;database&gt;</code>,
  I know a <code>&lt;black box&gt;</code> for that!"; <strong>but the application and needs are
  very specialized here. . .</strong> It just so happens that on the back of the
  very bitcoin specific cryptographic consensus algorithim there was a
  slot where a pre-existing high performance key-value store fit; and so
  we're using one and saving ourselves some effort...</p>
</blockquote>

CC BY-SA 3.0
2018-01-26T03:43:19.000Z
2018-01-26T13:42:33.250Z
2018-01-26T13:42:33.250Z
Roman Kiselenko
<p>How bad would it be to use MongoDB as a Bitcoin database instead of LevelDB? I know that LevelDB is faster but I've also read that MongoDB is better for doing queries.</p>

<p>It seems cleaner to store the information in JSON. And also easier to query.</p>

<p>Any reason why LevelDB was chosen?</p>

<bitcoin-core-development><database><storage><leveldb>
Bitcoin blockchain in mongodb
Vladislav Zhdanov
# Bitcoin blockchain in mongodb

(Asked by: username_0 on 2018-01-25)

How bad would it be to use MongoDB as a Bitcoin database instead of LevelDB? I know that LevelDB is faster but I've also read that MongoDB is better for doing queries.

It seems cleaner to store the information in JSON. And also easier to query.

Any reason why LevelDB was chosen?

**Tags:** bitcoin-core-development, database, storage, leveldb


---

## 1 answers

### Answer by username_1 on 2018-01-26. Score: 2

On the subject of why LevelDB is used, core developer Greg Maxwell stated the following to the [ref](http://bitcoin-development.narkive.com/XAPoxKZU/patch-switching-bitcoin-core-to-sqlite-db):

> I think people are falling into a trap of thinking "It's a `<database>`,
> I know a `<black box>` for that!"; **but the application and needs are
> very specialized here. . .** It just so happens that on the back of the
> very bitcoin specific cryptographic consensus algorithim there was a
> slot where a pre-existing high performance key-value store fit; and so
> we're using one and saving ourselves some effort...


---

