Created
April 16, 2025 18:24
-
-
Save Turupawn/9b6f58a170a0a4c288287a04f6ca4443 to your computer and use it in GitHub Desktop.
Merkle Inclusion Proofs in Noir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::hash::pedersen_hash; | |
fn main(root : pub Field, | |
index : Field, | |
hash_path : [Field; 2], | |
secret: Field, priv_key: Field, | |
public_param1: pub Field, | |
public_param2: pub Field) -> pub Field | |
{ | |
let note_commitment = pedersen_hash([priv_key, secret]); | |
let nullifier = pedersen_hash([root, priv_key, public_param1]); | |
let computed_root = | |
std::merkle::compute_merkle_root(note_commitment, index, hash_path); | |
assert(root == computed_root); | |
nullifier | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment