|0.24.0||Jul 2, 2021|
A generic implementation of the Base-16 Modified Merkle Tree ("Trie") data structure, provided under the Apache2 license.
The implementation comes in two formats:
- Trie DB (
trie-dbcrate) which can be combined with a backend database to provide a persistent trie structure whose contents can be modified and whose root hash is recalculated efficiently.
- Trie Root (
trie-rootcrate) which provides a closed-form function that accepts a enumeration of keys and values and provides a root calculated entirely in-memory and closed form.
Trie Hash alone is able to be used in
no_std builds by disabling its (default)
In addition to these, several support crates are provided:
hash-dbcrate, used to provide
Hasher(trait for all things that can make cryptographic hashes) and
HashDB(trait for databases that can have byte slices pushed into them and allow for them to be retrieved based on their hash). Suitable for
no_std, though in this case will only provide
MemoryDB, an implementation of a
HashDBusing only in in-memory map.
hash256-std-hashercrate, an implementation of a
std::hash::Hasherfor 32-byte keys that have already been hashed. Useful to build the backing
There are also three crates used only for testing:
keccak-hashercrate, an implementation of
Hasherbased on the Keccak-256 algorithm.
reference-triecrate, an implementation of a simple trie format; this provides both a
TrieStreamimplementation making it suitable for both Trie DB and Trie Root.
trie-standardmapcrate, a key/value generation tool for creating large test datasets to specific qualities.
trie-benchcrate, a comprehensive standard benchmarking tool for trie format implementations. Works using the
criterionproject so benchmarking can be done with the stable rustc branch.
In the spirit of all things Rust, this aims to be reliable, secure, and high performance.
Used in the Substrate project. If you use this crate and would your project listed here, please contact us.
Building is done through cargo, as you'd expect.
cargo build --all
cargo test --all
cargo bench --all
cargo build --no-default-features