0

I am using below code to create Merkle Root.

pub type MmrRootHash = H256;
pub fn create_merkle_root(leaves: Vec<MmrRootHash>) -> MmrRootHash {
            sp_runtime::traits::BlakeTwo256::trie_root(
    leaves
        .iter()
        .enumerate()
        .map(|(i, l)| ((i as u32).encode(), l.encode()))
        .collect()
);
        }

I want to verify Merkle Root of a leaf with its batch root and adjacent_leaves. Can somebody help me to provide library for the same?


fn verify_merkle_root(root: MmrRootHash, batch_root: MmrRootHash, adjacent_leaves: Vec< MmrRootHash >) -> bool {

..

}



1
  • @bkchr Can you please help me to provide the solution?
    – Boleng
    Commented Jun 17 at 10:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.