Skip to main content

Compile a gnark circuit

Use frontend.Compile, to convert a circuit definition into an arithmetic representation.

The frontend.Compile method takes a high-level program and translates it to a sequence of constraints which have a simple mathematic form.

var myCircuit Circuit
r1cs, err := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &myCircuit)
Playground

Check out the gnark Playground to compile and visualize the sequence of constraints from a circuit.