The complete process of ZK proof contains 3 steps:
Today, Let’s focus on the second step. Circom is an HDL (Hardware Description Language) that describe ZK circuits, and it is the most popular ZK programming language.
I won’t teach you how to write a Circom compiler. Instead, we will act as the Circom compiler, translate a simple Circom code to R1CS BY HAND.
I already write a Circom program: the prover knows 2 secret value a
and b
, such that a*b=c
, c
is a public value known to both prover and verifier.
https://gist.github.com/doutv/0ed578125b251ff555d1bdbbef62036a
Even if you haven’t learned Circom before, you definitely can understand this program.