dfinity-radix-tree: A generic data integrity layer.
This library allows you to construct a Merkle tree on top of any underlying key–value database. It works by organizing your key–value pairs into a binary radix tree, which is well suited for storing large dictionaries of fairly random keys, and is optimized for storing keys of the same length.
Define your database as an instance of the RadixDatabase type class. An instance for LevelDB is already provided.
Create a RadixTree that is parameterized by your database. If you want to make things more explicit, then you can define a simple type alias and wrapper function.
-> Maybe RadixRoot -- State root.
Using the definitions above, you can create a radix tree, perform some basic operations on it, and see that its contents is uniquely defined by its RadixRoot.
Running the program above should produce the following result.
Feel free to join in. All are welcome. Open an issue!