Demo client using merkle mountain range (MMR) as an append only vector commitment for events (the same data structure used by opentimestamps in NIP-03) to enable fast verification (only a few events needed for proof of membership in the MMR).
This was briefly sketched here
In a Nostr event, we add tag MMR that includes the prev_event_id and the prev_mmr_root and the prev_event_pos.
Mmr {
prev_event_id: Hash,
prev_mmr_root: Hash,
prev_event_pos: i64,
}The tag is defined here
We forked extracted code from grin MMR (which is monolithic): https://github.com/Pencil-Yao/cloud-mmr/compare/master...nostronaut:cloud-mmr:master and replaced the crypto to bitcoin_hashes
Example of 8 chained events using this demo code:
<-event 0 <-event 1 <-event 2 <-event 3 <-event 4 <-event 5 <-event 6 <-event 7
The encoded MMR encoded in the MMR tag looks like this:
2 111
/ \
1 11 110 1010
/ \ / \ / \
0 1 10 100 101 1000 1001 1011
event e0 e1 e2 e3 e4 e5 e6 e7