RSS Amplifier

Neiman’s Blog · Oct 16, 2024

MPZ - Merkle Pedersen Aztec

0
Sign in to vote or save

This page did not load. You can still read it on the original site — the toolbar below keeps your place in the directory.

A CLI tool for generating Merkle trees using the Pedersen hash based on the Aztec implementation.

I just “released” (i.e., put on Github), a new CLI tool for generating Merkle tree interactively based on users input.

This CLI tool generates Merkle trees using the Pedersen hash based on the Aztec implementation. The hashing process is executed through a Noir program, utilizing the Nargo tool to calculate the hash and retrieve the output.

[Github, Readme]

The readme covers the usage details well enough, so let’s just put here a video.

The backstory

I feel almost embarrassed of this release. It’s practical yet trivial. It’s implemented in a super hacky non-elegant way, but doing things properly simply makes no sense here considering the effort required.

After a long soul-searching, in which I mostly tried tools other than Noir to use for snark stuff, I found myself coming back to Noir. The ZKVM stuff was too slow, and Circom was too low-level.

In my use-case of Noir, which is mainly for certificates, I need often to verify membership in a group. The best way to do that is to use Merkle trees. Noir allows verification of Merkle proofs, but doesn’t give the option to generate them! Their Merkle trees are using Aztec specific implementation of Pedersen hashes (and commitments). These are implemented for Noir in the Barrentenberg C++ library and there is no Rust version.

I dedicated almost two days to writing a Rust implementation myself. Granted it took time since I had only a vague understanding of Pedersen commitment before (it’s much better now) and had no idea how Pedersen hashes are made. But this was the easy part to learn. The main issue was that Aztec implemented things using their own curve, generator, and window size - and I didn’t find anywhere specification for this. I started to reverse-engineer it; It’s possible but also tiring. So after a while, I decided to take the practical way out: simply write a Rust program that wraps a Noir program in order to calculate Pedersen Hashes.

If this will end up being used I could always go back to implementing everything natively in Rust. Heck, if this would be used we could also add support for more hashes! But if and if and if and if. Let’s start easy.

What’s next

There’s an almost complete Safecat new release that has a very nice generalized mechanism to generate Noir programs and their proofs. It’s using Merkle trees, which is why I wanted to get this release done before.

After that? I’ll try to make an MVP of a name system and put it on some blockchain.

I have no idea yet which blockchain to choose. I’d like to have something that you can work with without 3rd parties and external services. But does such a thing exist?

If you have input on that, please write me to neiman@hackerspace.pl or communicate on Mastodon.

Read on neimanslab.org

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.