Circom
Browse all Circom articles.

3 min read
Swapping Two Items in an Array in Circom
Swapping Two Items in an Array in Circom This chapter shows how to swap two signals in a list of signals. This is an important subroutine for a sorting algorithm. More generally, lists are a...
Last updated on Apr 15, 2025
Introduction to Stateful Computations in ZK When carrying out iterative computations such as powers, factorials, or computing the Fibonacci sequence, we need to “stop the computation” after a certain...
Last updated on Apr 15, 2025
4 min read
Conditional Statements in Circom
Conditional Statements in Circom Circom is very strict with the usage of if-statements. The following rules must be followed: Signals cannot be used to alter the behavior of an if-statement. A signal...
Last updated on Apr 15, 2025
4 min read
Public and Private Inputs
Public and Private Inputs A public input in Circom is a signal in the witness that will be revealed to the verifier. For example, suppose we want to create a ZK proof that states: “we know the input...
Last updated on Apr 15, 2025
3 min read
Symbolic Variables in Circom
Symbolic Variables in Circom A symbolic variable in Circom is a variable that has been assigned values from a signal. When a signal is assigned to a variable (thereby turning it into a symbolic...
Last updated on Apr 15, 2025
3 min read
Quadratic Constraints
Quadratic Constraints Circom Constraints A Rank 1 Constraint System has at most one multiplication between signals per constraint. This is called a "quadratic" constraint. Any constraint containing...
Last updated on Apr 15, 2025
Circom Template Parameters, Variables, Loops, If Statements, Assert This chapter covers essential syntax, which you'll see in most Circom programs. With Circom, we're able to define a Rank 1...
Last updated on Apr 15, 2025
6 min read
The Permutation Argument
The Permutation Argument A permutation argument is a proof that two lists hold the same elements, but possibly in a different order. For example, is a permutation of and vice-versa. The permutation...
Last updated on Apr 15, 2025
3 min read
Quin Selector
Quin Selector The Quin Selector is a design pattern that allows us to use a signal as an index for an array of signals. As a prerequisite, we assume the reader has read the chapter on Conditional...
Last updated on Apr 15, 2025
11 min read
Introduction to ZK Circuits with Circom
Introduction to ZK Circuits with Circom Circom is a programming language for creating Rank 1 Constraint Systems (R1CS) and populating the witness vector of the R1CS. The R1CS format is of interest...
Last updated on Apr 14, 2025
3 min read
Circom Components in a Loop
Circom Components in a Loop Circom does not allow for components to be directly instantiated in a loop. For example, compiling the following code results in the error below. The workaround is to...
Last updated on Apr 14, 2025
Hacking Underconstrained Circom Circuits With Fake Proofs The operator in Circom can be dangerous because it assigns values to signals but does not constrain them. But how do you actually ~~exploit~~...
Last updated on Aug 10, 2024