What Is a Circuit?

Not the electrical kind

In ZK, a circuit is not hardware. It is a mathematical structure that represents a computation as a set of arithmetic constraints over a finite field.

When you write a ZK application, you are not writing a program that runs on a CPU. You are writing a circuit that describes a relationship between inputs and outputs, such that anyone can verify the relationship holds without seeing the private inputs.

Understanding what a circuit is and how it differs from regular code is the first thing you need before writing a single line of Circom or Noir.

Programs vs circuits

A normal program has control flow. It branches, loops, reads memory, throws exceptions. Execution happens sequentially and the result depends on runtime state.

A circuit has none of that. A circuit is a fixed set of mathematical constraints that must all be satisfied simultaneously. There are no conditionals in the traditional sense, no loops that expand at runtime, no dynamic memory. Every operation in the computation is expressed as a polynomial equation over a finite field.

The key consequence: circuits are not executed, they are satisfied. A valid witness is an assignment of values to all signals in the circuit such that every constraint evaluates to zero. The proof system checks that such a witness exists without revealing it.

💡
Regular code asks: "what is the output of this computation?" A circuit asks: "does this assignment of values satisfy all these constraints?" These are different questions and require a fundamentally different way of thinking.

The building blocks

Signals are the variables in a circuit. Every input, output, and intermediate value is a signal. Signals hold elements of a finite field, not integers in the usual sense. In Circom, they are declared with the signal keyword. In Noir, they map to field elements or typed values that compile down to field arithmetic.

Constraints are the equations that signals must satisfy. The most common form is a rank-1 constraint:

Answer the quiz correctly to continue →

Quiz · Multiple Choice1 / 3

What does it mean for a ZK circuit to be 'satisfied' rather than 'executed'?