I realize that LMDB is very different from your typical SQL database, but is there a query language, or scripting language interface, that can be used to query the blockchain's database?

I am aware of this question on displaying the output histogram via a feature of monerod. Although, when trying that my daemon crashed. I would like to do something similar from a script.

  • Please file a bug on github about the crash, including what you did exactly, testnet or not, any stack trace and/or error message.
    – user36303
    Commented Oct 10, 2016 at 23:01
  • Well, technically the daemon didn't crash. It just got stuck somehow. I'll follow-up in the other question, as it is kind of off-topic here.
    – dpzz
    Commented Oct 11, 2016 at 23:09

2 Answers 2


I don't think there is an equivalent of the mysql or psql commands for lmdb, therefore to make custom queries to the database you must write a program that accesses it directly.

There are some examples at github.com/moneroexamples:

  • Thank you for these example project links, they look like good starting points. Could you please make the links clickable (for convenience)?
    – dpzz
    Commented Oct 12, 2016 at 0:01

If you're using python, the py-lmdb module includes a basic CLI. http://lmdb.readthedocs.io/en/release/

Keep in mind that you'll be getting raw data back, not anything in a human-readable format.

  • Thank you for this. I also found LMDB wrappers here. I suppose these are also good ways to interact with the blockchain database?
    – dpzz
    Commented Oct 11, 2016 at 23:51
  • 1
    Sure, use whatever language you're comfortable with. Note that all of those are 3rd party projects; I know next to nothing about most of them. I'm familiar with the python module since that author stays in contact with the LMDB project.
    – hyc
    Commented Oct 12, 2016 at 17:39
  • @hyc: I've never been able to get py-lmdb to work with the monero lmdb database. Tried something like github.com/Gingeropolous/LMDBExplorer/blob/master/… and get the error "MDB_VERSION_MISMATCH: Database environment version mismatch". No amount of googling has helped. Any ideas? Commented Nov 16, 2016 at 23:04
  • You have to do a custom build of py-lmdb using the version of LMDB in the monero source tree. Monero uses a LMDB 1.0 pre-release, while the rest of the world uses LMDB 0.9.
    – hyc
    Commented Nov 17, 2016 at 1:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.