Crate nmt_rs

source ·
Expand description

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.

Re-exports

Modules

  • Adds “namespacing” semantics to proofs for the simple merkle tree, enabling consumers to check that
  • Implements a simple RFC 6962 compatible merkle tree over an in-memory data store which maps preimages to hashes.

Structs

Enums

  • Indicates whether the proof includes all leaves from every namespace it covers.

Constants

Traits

  • An extension of MerkleHash indicating the the hasher is namespace aware. This allows for the creation of namespaced merkle trees and namespaced merkle proofs.

Type Aliases

  • A namespaced merkle tree as used in Celestia. Uses a sha256 hasher and 29 byte namespace IDs.
  • The default hasher. Currently sha256