Hermez zk-rollup Circom Circuits Are Now Public!

2 years ago   •   2 min read

By Polygon Hermez

We’re releasing the Circom circuits used in the Hermez zk-rollup for every developer in the world to review them!

More on that below. First, let’s give a bird’s eye view of the circuits.

ZK-Rollup Validity Proofs Generation

In addition to the smart contracts (already publicly available), the Hermez protocol is executed in the zero-knowledge circuits.

A circuit is a set of constraints or rules that a coordinator must follow to process all allowed transactions, and in order to generate the zk-SNARK validity proof of the batch, which will be validated on Ethereum mainnet.

Say Bob has a balance of 10 HEZ, and Alice has 20 HEZ. Bob tries to send Alice 100 HEZ, returning a balance of -90 HEZ.

When processing the transaction, one of the circuit constraints establishes that negative balances are not valid. Hence the transaction won't go through.

Circuits For All

Hermez's circuits are written in Circom, a programming language part of the iden3 zero-knowledge stack and developed by our Technical Lead, Jordi Baylina.

Unlike other circuit compilers, Circom is a DSL language with a syntax similar to C and javascript, two of the most popular languages among devs worldwide.

We've also built a general purpose circuit library about cryptography, circomlib, which other projects are already using, like Semaphore and Tornado Cash.

The support of these projects shows circomlib's significant degree of resilience.

Also, with a grant from Ethereum Foundation, a new version of Circom circuit compiler based in Rust is currently at the latest stages of development.

Hermez Circom Circuits Open Source

After countless hours of work, we're releasing our circuits open-source on Github.

You can check the circuit code in our repositories and review them. We're very interested in discussing your findings.

As you may know, Hermez is sponsoring the zkSummit 6, where Jordi Baylina will conduct a hands-on workshop about Hermez zk-rollup circuits.

For more information about the zkSummit 6, you can read last week's blog announcement. If you want to delve deeper into our code, check this post about Zero-knowledge-proofing Hermez II: preparePhase2 update.

Stay on top of Hermez-related news by following us on Twitter at @Hermez_network and joining our new Discord server.

Spread the word

Keep reading