Expand description

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.

Structs

Keccak-256 Hash implementation.
A generated merkle proof.

Enums

Leaf node for proof verification.

Traits

API useful for BEEFY light clients.

Functions

Construct a Merkle Proof for leaves given by indices.
Construct a root hash of a Binary Merkle Tree created from given leaves.
Verify Merkle Proof correctness versus given root hash.