The technical content top engineers rely on to level up.
3 min read
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 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 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 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" 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 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 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 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 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...
6 min read
Intermediate Signals and Sub-Component Circom’s primary purpose is to compile down to a Rank 1 Constraint System (R1CS), but its secondary purpose is to populate the witness. For most circuits, the...
6 min read
Tick limits in Uniswap V3 The smallest tick in Uniswap v3 is -887,272 and the largest tick is 887,272. This chapter explains the rationale behind this range, which is based on finding the tick that...
9 min read
Square Root Price in Uniswap V3 In Uniswap V2, the protocol tracks token reserves and derives the spot price, $p_x=y/x$, and total liquidity, $L=xy$, where $x$ and $y$ are the reserves of tokens X...