| Crates.io | oz_merkle_rs |
| lib.rs | oz_merkle_rs |
| version | 0.1.3 |
| created_at | 2024-02-09 18:43:10.66174+00 |
| updated_at | 2024-04-10 02:31:50.009961+00 |
| description | A lightweight Merkle tree implementation designed to seamlessly integrate with OpenZeppelin contracts for proof verification |
| homepage | |
| repository | https://github.com/AnonJon/oz-merkle-rs |
| max_upload_size | |
| id | 1134239 |
| size | 13,381 |
OZ Merkle-rs is a lightweight, efficient Merkle tree implementation written in Rust, designed to seamlessly integrate with OpenZeppelin contracts for proof verification.
Add oz_merkle_rs to your Cargo.toml file:
[dependencies]
oz_merkle_rs = "0.1.1"
use oz_merkle_rs::MerkleTree;
use std::str::FromStr;
fn main() {
let data = vec![
(Address::from_str("0x1111111111111111111111111111111111111111").unwrap(),
U256::from_dec_str("1840233889215604334017").unwrap()),
(Address::from_str("0x00393d62f17b07e64f7cdcdf9bdc2fd925b20bba").unwrap(),
U256::from_dec_str("7840233889215604334017").unwrap()),
];
// Create a new Merkle tree from the data
let merkle_tree = MerkleTree::new(data);
}
let data = vec![
(Address::from_str("0x1111111111111111111111111111111111111111").unwrap(),
U256::from_dec_str("1840233889215604334017").unwrap()),
(Address::from_str("0x00393d62f17b07e64f7cdcdf9bdc2fd925b20bba").unwrap(),
U256::from_dec_str("7840233889215604334017").unwrap()),
];
let tree = MerkleTree::new(data);
let node = MerkleTree::hash_node(data[0]);
let proof = tree.get_proof(node).unwrap();
let result = tree.verify_proof(node, proof, tree.get_root().unwrap());
OZ Merkle-rs is open source and available under the MIT License.