#merkle-tree #tree-structure #state #append #linear #leave

bridgetree

A space-efficient Merkle tree designed for linear appends with witnessing of marked leaves, checkpointing & state restoration

5 releases (breaking)

0.6.0 Sep 25, 2024
0.5.0 Aug 12, 2024
0.4.0 Sep 8, 2023
0.3.0 Jun 6, 2023
0.1.0 Jul 22, 2022

#98 in Data structures

Download history 1583/week @ 2024-08-07 1075/week @ 2024-08-14 1818/week @ 2024-08-21 1204/week @ 2024-08-28 832/week @ 2024-09-04 647/week @ 2024-09-11 761/week @ 2024-09-18 1874/week @ 2024-09-25 1680/week @ 2024-10-02 1348/week @ 2024-10-09 1030/week @ 2024-10-16 1530/week @ 2024-10-23 1026/week @ 2024-10-30 1127/week @ 2024-11-06 1840/week @ 2024-11-13 1008/week @ 2024-11-20

5,183 downloads per month
Used in 13 crates (3 directly)

MIT/Apache

135KB
2.5K SLoC

bridgetree

This is a Rust crate that provides an implementation of an append-only Merkle tree structure. Individual leaves of the merkle tree may be marked such that witnesses will be maintained for the marked leaves as additional nodes are appended to the tree, but leaf and node data not specifically required to maintain these witnesses is not retained, for space efficiency. The data structure also supports checkpointing of the tree state such that the tree may be reset to a previously checkpointed state, up to a fixed number of checkpoints.

The crate also supports using "bridges" containing the minimal possible amount of data to advance witnesses for marked leaves data up to recent checkpoints or the the latest state of the tree without having to append each intermediate leaf individually, given a bridge between the desired states computed by an outside source. The state of the tree is internally represented as a set of such bridges, and the data structure supports fusing and splitting of bridges.

Documentation

License

Licensed under either of

at your option.

Contribution

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

Dependencies

~32–670KB
~12K SLoC