#merkle-tree #tree #merkle #hash-tree #proof #hash #multiproof

no-std rs_merkle

The most advanced Merkle Tree library for Rust. Supports creating and verifying proofs, multi-proofs, as well as advanced features, such as tree diffs, transactional changes, and rollbacks

11 releases (7 stable)

1.4.2 Jan 11, 2024
1.4.1 May 22, 2023
1.3.0 Mar 14, 2023
1.2.0 Mar 28, 2022
0.1.0 Sep 27, 2021

#1143 in Magic Beans

Download history 1213/week @ 2023-12-07 1207/week @ 2023-12-14 1002/week @ 2023-12-21 702/week @ 2023-12-28 1177/week @ 2024-01-04 1471/week @ 2024-01-11 1458/week @ 2024-01-18 1676/week @ 2024-01-25 1648/week @ 2024-02-01 1366/week @ 2024-02-08 1472/week @ 2024-02-15 1078/week @ 2024-02-22 1463/week @ 2024-02-29 1839/week @ 2024-03-07 2092/week @ 2024-03-14 1547/week @ 2024-03-21

7,115 downloads per month
Used in 44 crates (16 directly)

Apache-2.0/MIT

76KB
682 lines

rs-merkle

Rayon crate Rayon documentation Build and test

rs-merkle is the most advanced Merkle tree library for Rust. Basic features include building a Merkle tree, creation, and verification of Merkle proofs for single and several elements, i.e. multi-proofs. Advanced features include making transactional changes to the tree and rolling back to any previously committed tree state, similarly to Git.

The library is highly customizable. Hashing function and the way how the tree is built can be easily configured through a special trait.

rs-merkle is available on crates.io, and API Documentation is available on docs.rs.

About Merkle trees

Merkle trees, also known as hash trees, are used to verify that two or more parties have the same data without exchanging the entire data collection.

Merkle trees are used in Git, Mercurial, ZFS, IPFS, Bitcoin, Ethereum, Cassandra, and many more. In Git, for example, Merkle trees are used to find a delta between the local and remote repository states to transfer only the difference between them over the network. In Bitcoin, Merkle trees are used to verify that a transaction was included in the block without downloading the whole block contents. ZFS uses Merkle trees to quickly verify data integrity, offering protection from silent data corruption caused by phantom writes, bugs in disk firmware, power surges, and other causes.

Usage

Add the following to your Cargo.toml:

[dependencies]
rs_merkle = "1.4"

This crate also can be used on the no-std targets. To use as a dependency in a project that requires no-std, disable default features:

[dependencies]
rs_merkle = { version = "1.4", default-features = false }

Documentation

Documentation is available on docs.rs.

Contributing

Everyone is welcome to contribute in any way or form! For further details, please read CONTRIBUTING.md

Authors

Also, see the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Dependencies

~430KB
~10K SLoC