Urkel – authenticated key-value store written in C
github.com
github.com
Likewise, I’ve done testing with SMT and we were hitting the same bottlenecks. It will be interesting to test this implementation.
We recently published a research paper where we propose a use of dynamic B+ Tree with efficient proof sizes.
Dynamic Merkle B-Tree with Efficient Proofs: https://arxiv.org/abs/2006.01994
If I understand correctly, liburkel does even fewer hashes in the case of common prefixes which is pretty sweet.
If you're looking for more SMT implementations, we've got a home-grown one at Blockstack. We built a "merklized adaptive-radix forest" (MARF) to represent blockchain state as an authenticated key/value store, where you can query a key's value at any block height (and get a proof). I think the high-level differences between it an an Urkel tree are:
* No delete operation -- we need to be able to service key lookups from any previous committed root hash, since a major use-case for the MARF is in allowing Blockstack smart contracts to cheaply query historic chain state in the same fork.
* Key insertion order affects the root hash (but this is more of an artifact of the implementation than a deliberate design decision).
* Variable-radix nodes, in order to minimize the number of nodes that would need to be loaded on a key lookup. Ours is based on adaptive-radix trees [1].
* Proof size is bigger, and has a different structure. The proof is meant to show a key's value, as well as its place in the blockchain history.
* Implemented in Rust, as an index within a Sqlite database -- we rely in Sqlite to provide crash-consistency.
Anyway, the technical documentation is here [2] and the code is here [3] if you want to take a look!
[1] https://15721.courses.cs.cmu.edu/spring2016/papers/leis-icde...
[2] https://github.com/blockstack/stacks-blockchain/blob/master/...
[3] https://github.com/blockstack/stacks-blockchain/tree/master/...