Blog
The technical content top engineers rely on to level up.
8 min read
32-Bit Emulation in ZK
32-Bit Emulation in ZK The default datatype in ZK is the field element, where all arithmetic is done modulo a large prime number. However, most “real” computation is done using 32, 64, or 256-bit...
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...
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...
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...
6 min read
Indicate Then Constrain
Indicate Then Constrain If we want to say that “ can be equal to 5 or 6” we can simply use the following constraint: However, suppose we want to say that “ is less than 5 or is greater than 17.” In...
10 min read
Hello World Circom
Hello World Circom Introduction This chapter shows the relationship between Circom code and the Rank 1 Constraint System (R1CS) it compiles to. Understanding R1CSs is critical to understanding...
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...
12 min read
Compute Then Constrain
Compute Then Constrain "Compute then constrain" is a design pattern in ZK circuits where an algorithm's correct output is first computed without constraints. The correctness of the solution is then...
6 min read
Circom Template Parameters, Variables, Loops, If Statements, Assert
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...
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...
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...
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...