Skip to main content

Crate emt

Crate emt 

Source
Expand description

emt — the Epoch Merkle Tree (polydigest(cmt)) instantiated at k=2, no prefix.

This is the L4 instantiation: it fixes the proof-spine arity to 2 and pairs the EMT — the polydigest combinator over the mutable cmt tree — with a concrete unprefixed SHA-256 hasher, so an application gets a ready mutable tree in a few lines. Paired with the append-only eml log it composes a single principal tree (a mutable outer tree with an embedded append-only commit log, joined by the spine’s opaque embedding) — that composition lives at the application layer, not here; this crate only supplies the outer mutable tree.

use emt::Emt;

let mut tree = Emt::new();
tree.set(0, b"genesis".to_vec()).unwrap();
tree.set(1, b"second".to_vec()).unwrap();
let root = tree.root().expect("a non-empty tree has a root");
assert_eq!(tree.get(0), Some(b"genesis".as_slice()));

Structs§

Emt
A mutable tree at k=2 over unprefixed SHA-256.
ProofStep
A single level in a Merkle proof path.
Sealed
The combinator’s frozen multi-algorithm snapshot: a structural Seal bound to a committed epoch timeline, deriving the binding root.

Enums§

Error
A CMT construction or mutation error.

Type Aliases§

Result
A specialized Result for the mutable tree.