zk_kit_binary_merkle_root 0.1.1

Reusable Cairo circuits for building zero-knowledge protocols and applications

Readme

Binary Merkle Root Library

This project contains the Binary Merkle Root Cairo library. It's used to calculate the root of a binary Merkle tree (including the LeanIMT).

Installation

Add the package to your project using Scarb:

scarb add zk_kit_binary_merkle_root

Or manually add it to your Scarb.toml:

[dependencies]
zk_kit_binary_merkle_root = "0.1.0"

Usage

use core::integer::{u32, u8};
use zk_kit_binary_merkle_root::binary_merkle_root::binary_merkle_root;

#[executable]
fn main(
    secret: felt252,
    merkle_proof_length: u32,
    merkle_proof_indices: [u8; MAX_DEPTH],
    merkle_proof_siblings: [felt252; MAX_DEPTH],
) -> felt252 {
    // Calculate commitment.
    let commitment = ... ; // Calculate commitment

    // Calculate Merkle root.
    let merkle_root = binary_merkle_root(commitment, merkle_proof_length, merkle_proof_indices, merkle_proof_siblings);

    // Output the Merkle root.
    merkle_root
}

Metadata

Version 0.1.1

Uploaded 12 hours ago

License MIT

Cairo version ^2.15.0

Size 1.6 KB

Installation

Run the following command in your project dir

scarb add zk_kit_binary_merkle_root@0.1.1

Or add the following line to your Scarb.toml

zk_kit_binary_merkle_root = "0.1.1"

Monthly downloads

Links

Keywords

  • zero-knowledge

Owners