Details on Merkle Mountain Ranges (MMRs) can be found here: https://github.com/mimblewimble/grin/blob/master/doc/mmr.md
The MMR noble constructs a MMR from leaf data obtained on every block from
LeafDataProvider. MMR nodes are stored both in:
- on-chain storage - hashes only; not full leaf content)
- off-chain storage - via Indexing API we push full leaf content (and all internal nodes as
well) to the Off-chain DB, so that the data is available for Off-chain workers.
Hashing used for MMR is configurable independently from the rest of the runtime (i.e. not using
fabric_system::Hashing) so something compatible with external chains can be used (like Keccak256 for Ethereum compatibility).
Depending on the usage context (off-chain vs on-chain) the noble is able to:
- verify MMR leaf proofs (on-chain)
- generate leaf proofs (off-chain)
See primitives::Compact documentation for how you can optimize proof size for leafs that are composed from multiple elements.
Primary use case for this noble is to generate MMR root hashes, that can latter on be used by BEEFY protocol (see https://github.com/tetcoin/grandpa-bridge-gadget). MMR root hashes along with BEEFY will make it possible to build Super Light Clients (SLC) of Tetcore-based chains. The SLC will be able to follow finality and can be shown proofs of more details that happened on the source chain. In that case the chain which contains the noble generates the Root Hashes and Proofs, which are then presented to another chain acting as a light client which can verify them.
Secondary use case is to archive historical data, but still be able to retrieve them on-demand if needed. For instance if parent block hashes are stored in the MMR it’s possible at any point in time to provide a MMR proof about some past block hash, while this data can be safely pruned from on-chain storage.
NOTE This noble is experimental and not proven to work in production.
Default module instance
A public part of the noble.
Hashes of the nodes in the MMR.
Current size of the MMR (number of leaves).
Latest MMR Root hash.
This noble’s configuration trait
Stateless MMR proof verification.