Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 2.3 KB

README.md

File metadata and controls

36 lines (22 loc) · 2.3 KB

Semaphore Circuits Implementation in Halo2

This repository contains an educational implementation of Semaphore circuits using Halo2. One may find it useful as a more complex complement to the SimpleExample in the Halo2 book.

Disclaimer

This implementation is for educational purposes and contains bugs. For a higher quality Semaphore implementation in Halo2, see Andrija Novakovic's work.

Features

The circuit size is dominated by the Poseidon circuits. Each layer of the merkle tree adds rows to the circuit. A tree of height 48 (281,474,976,710,656 leafes) fits into 2^11 rows. The next smaller circuit with 2^10 rows would only be able to support 2^24 (16,777,216) leafes i.e. identities in the anonymity set. Halo2 allows to use more columns instead of rows to trade off prover time against verifier time.

How I went about this project

Prerequisites

  • Basic understanding of the arithmetization step in zero-knowledge proofs.
  • Familiarity with Rust programming language.

My prior knowledge includes implementing vanilla plonk and plonk with lookups. These experiences, although not necessary, were beneficial in understanding and working with Halo2.

Learning Path

  1. Read sections 1 and 2 of the Halo2 book.
  2. Go through Errol Drummond's Halo2 Tutorial.
  3. Attend 0xparc's Halo2 learning group lectures.
  4. Build a basic circuit using more than one chip in Halo2.
  5. Revisit the Halo2 book and lectures to reinforce your understanding.
  6. Experiment with the circuit-layout printer to optimize the number of rows.

Running the Example

  • main.rs contains a basic example to get started. Modify and execute it to see how the implementation works.