#merkle-tree #leave #substrate #binary #hash #proof #leaf

no-std beefy-merkle-tree

A no-std/Substrate compatible library to construct binary merkle tree

8 major breaking releases

12.0.0 Feb 1, 2023
11.0.0 Jan 22, 2023
10.0.0 Jan 16, 2023
9.0.0 Jan 10, 2023
0.0.0 Nov 21, 2022

#18 in #leaf

38 downloads per month

Apache-2.0

83KB
1.5K SLoC

beefy-merkle-tree

Auto-generated README.md for publishing to crates.io


lib.rs:

This crate implements a simple binary Merkle Tree utilities required for inter-op with Ethereum bridge & Solidity contract.

The implementation is optimised for usage within Substrate Runtime and supports no-std compilation targets.

Merkle Tree is constructed from arbitrary-length leaves, that are initially hashed using the same hasher as the inner nodes. Inner nodes are created by concatenating child hashes and hashing again. The implementation sorts each pair of hashes before every hash operation. This makes proof verification more efficient by removing the need to track which side each intermediate hash is concatenated on.

If the number of leaves is not even, last leaf (hash of) is promoted to the upper layer.

Dependencies

~8–27MB
~364K SLoC