Libmdbx
★ Fullfast transactional key-value memory-mapped B-Tree storage engine without WAL ★ Widely used by Ethereum, cryptocurrency industry and thousands of other projects ★ Surpasses the legendary LMDB in terms of reliability, features and performance.
Install / Use
/learn @Mithril-mine/LibmdbxREADME
libmdbx
<!-- section-begin overview -->libmdbx is an extremely fast, compact, powerful, embedded, transactional key-value database, with Apache 2.0 license. libmdbx has a specific set of properties and capabilities, focused on creating unique lightweight solutions.
-
Allows a swarm of multi-threaded processes to ACIDly read and update several key-value maps and multimaps in a locally-shared database.
-
Provides extraordinary performance, minimal overhead through Memory-Mapping and
Olog(N)operations costs by virtue of B+tree. -
Requires no maintenance and no crash recovery since it doesn't use WAL, but that might be a caveat for write-intensive workloads with durability requirements.
-
Enforces serializability for writers just by single mutex and affords wait-free for parallel readers without atomic/interlocked operations, while writing and reading transactions do not block each other.
-
Guarantee data integrity after crash unless this was explicitly neglected in favour of write performance.
-
Supports Linux, Windows, MacOS, Harmony, Android, iOS, FreeBSD, DragonFly, Solaris, OpenSolaris, OpenIndiana, NetBSD, OpenBSD and other systems compliant with POSIX.1-2008.
-
Compact and friendly for fully embedding. Just a few flat source code files. Here no internal threads nor server process(es), but implements core part of the Berkeley DB API with many powerful extensions.
Historically, libmdbx is a deeply revised and extended descendant of the legendary Lightning Memory-Mapped Database. libmdbx inherits all benefits from LMDB, but resolves some issues and adds a large set of improvements.
Please refer to the online official libmdbx documentation site with
CAPI description and pay attention to theC++API. Donations are welcome to ETH0xD104d8f8B2dC312aaD74899F83EBf3EEBDC1EA3A, BTCbc1qzvl9uegf2ea6cwlytnanrscyv8snwsvrc0xfsu, SOLFTCTgbHajoLVZGr8aEFWMzx3NDMyS5wXJgfeMTmJznRi. Всё будет хорошо!
Telegram Group archive: 1, 2, 3, 4, 5, 6, 7.
The Turnpoint
in English
To get acquainted with important changes and plans, we recommend reading the compact presentation "libmdbx: successes, obstacles, goals and roadmap", which contains important explanations in the form of embedded comments.
For ease of use and to eliminate potential limitations in both distribution and obstacles in technology development, libmdbx is distributed as an amalgamated source code starting at the end of 2025. The source code of the tests, as well as the internal documentation, will be available only to the team directly involved in the development. The new libmdbx development strategy is presented, the essence of which is the continuous movement towards the MithrilDB. In this regard, some of the information provided below and in other parts of the documentation may be inaccurate or inapplicable. We will try to resolve all discrepancies as quickly as possible.
The libmdbx code will forever remain open and with high-quality free support, as far as the life circumstances of the project participants allow. However, support will be provided only for officially published versions of the code. As an identity criterion, the git tree hash must match the signed commit in the libmdbx public repository. For all other cases, paid support will be offered. We will also insist and enforce that all derivative versions comply with the license requirements, including the explicit presence of a notice stating that such derivative modified code originates from libdmbx, but is no longer original and supported, and is not subject to any quality guarantees from libmdbx.
на Русском (мой родной язык)
Для знакомства с важными изменениями и планами, рекомендуем посмотреть компактную презентацию "libmdbx: успехи, препятствия, цели и план развития", в которой важные пояснения даны в виде встроенных комментариев.
Для удобства использования и устранения потенциальных ограничений как в распространении, так и препятствий в разработке технологий, начиная с конца 2025 года libmdbx распространяется в виде амальгамированного исходного кода. Исходный код тестов, как и внутренняя документация будет доступна только команде непосредственно занимающейся разработкой. Также представлена новая стратегия развития libmdbx, суть которой в непрерывном движении к MithrilDB. В связи с этим часть информации изложенной ниже и в других частях документации может быть неточной или неприменимой. Мы постараемся устранить все несоответствия по-быстрее.
Код libmdbx навсегда останется открытым и с качественной бесплатной поддержкой, насколько это позволят жизненные обстоятельства участников проекта. Однако, поддержка будет оказываться только для официально публикуемых версий кода. В качестве критерия идентичности требуется совпадение git tree hash с подписанным коммитом в публичном репозитории libmdbx. Для всех остальных случаев будет предлагаться платная поддержка. Также мы будем настаивать и добиваться выполнения всеми производными версиями требований лицензии, включая явное присутствие уведомления о том, что такой производный модифицированный код происходит от libdmbx, но уже не является оригинальным и поддерживаемым, и на него не распространяются какие-либо гарантии качества libmdbx.
MithrilDB and Future
<!-- section-begin mithril -->The next version is under non-public development and will be released as MithrilDB and libmithrildb for libraries & packages. Admittedly mythical Mithril is resembling silver but being stronger and lighter than steel. Therefore MithrilDB is a rightly relevant name.
MithrilDB is radically different from libmdbx by the new database format and API based on C++20. The goal of this revolution is to provide a clearer and robust API, add more features and new valuable properties of the database. All fundamental architectural problems of libmdbx/LMDB have been solved there, but now the active development has been suspended for top-three reasons:
- For now libmdbx mostly enough and I’m busy for scalability.
- Waiting for fresh Elbrus CPU of e2k architecture, especially with hardware acceleration of Streebog and Kuznyechik, which are required for Merkle tree, etc.
- The expectation of needs and opportunities due to the wide use of NVDIMM (aka persistent memory), modern NVMe and Ангара.
However, MithrilDB will not be available for countries unfriendly to Russia (i.e. acceded the sanctions, devil adepts and/or NATO). But it is not yet known whether such restriction will be implemented only through a license and support, either the source code will not be open at all. Basically I am not inclined to allow my work to contribute to the profit that goes to weapons that kill my relatives and friends. NO OPTIONS.
Nonetheless, I try not to make any promises regarding MithrilDB until release.
Contrary to MithrilDB, libmdbx will forever free and open source. Moreover with high-quality support whenever possible. Tu deviens responsable pour toujours de ce que tu as apprivois. So I will continue to comply with the original open license and the principles of constructive cooperation, in spite of outright Github sabotage and sanctions. I will also try to keep (not drop) Windows support, despite it is an unused obsolete technology for us.
<!-- section-end -->$ objdump -f -h -j .text libmdbx.so
libmdbx.so: формат файла elf64-e2k
архитектура: elbrus-v6:64, флаги 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
начальный адрес 0x00000000??????00
Разделы:
Idx Name Разм VMA LMA Фа смещ. Выр. Флаги
10 .text 000e7460 0000000000025c00 0000000000025c00 00025c00 2**10 CONTENTS, ALLOC, LOAD, READONLY, CODE
$ cc --version

