5 releases

0.2.3 Sep 10, 2024
0.2.2 Aug 12, 2024
0.2.1 Jul 24, 2024
0.2.0 Jul 1, 2024
0.1.0 Nov 14, 2023

#11 in #merkle-proof

Download history 3527/week @ 2024-07-30 2970/week @ 2024-08-06 4499/week @ 2024-08-13 3823/week @ 2024-08-20 3784/week @ 2024-08-27 5061/week @ 2024-09-03 4848/week @ 2024-09-10 3738/week @ 2024-09-17 4730/week @ 2024-09-24 4590/week @ 2024-10-01 4505/week @ 2024-10-08 4596/week @ 2024-10-15 3904/week @ 2024-10-22 8413/week @ 2024-10-29 6310/week @ 2024-11-05 5747/week @ 2024-11-12

25,272 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

105KB
2K SLoC

codecov

NMT

An implementation of a namespaced merkle tree in Rust.

Warning

This code has not been audited, and may contain critical vulnerabilities. Do not attempt to use in production.

Functionality

  • Compute merkle root

  • Create index-based range proofs

  • Verify index-based range proofs

  • Create namespace range proofs

  • Verify namespace range proofs

  • Narrow namespace range proofs: supply part of the range to generate a proof for the remaining sub-range

License

Licensed under the Apache License, Version 2.0.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repository by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.


lib.rs:

This crate implements a Namespaced Merkle Tree compatible with https://github.com/celestiaorg/nmt. To quote from their documentation:

A Namespaced Merkle Tree is an ordered Merkle tree that uses a modified hash function so that each node in the tree includes the range of namespaces of the messages in all of the descendants of each node. The leafs in the tree are ordered by the namespace identifiers of the messages. In a namespaced Merkle tree, each non-leaf node in the tree contains the lowest and highest namespace identifiers found in all the leaf nodes that are descendants of the non-leaf node, in addition to the hash of the concatenation of the children of the node. This enables Merkle inclusion proofs to be created that prove to a verifier that all the elements of the tree for a specific namespace have been included in a Merkle inclusion proof.

The concept was first introduced by @musalbas in the LazyLedger academic paper.

This implementation was developed independently by Sovereign Labs, and is not endorsed by the Celestia foundation.

Dependencies

~0.5–1MB
~21K SLoC