Zero Knowledge proofs (or ZKP) allow developers to create mathematical proofs that a computation have been executed correctly, while not having to reveal all the data of this computation.
There are three main areas of application:
Proving systems allow to create ZKP for arbitrary computations. They are like a computer system that can execute an arbitrary computation. A ZKP circuit is a definition for a proving system that proofs a specific computation. For example, for bubble sort algorithm you could write a circuit for a specific proving system that proofs bubble sort executions.
The main elements are:
It is important to note that if the prover and validator have agreed on the setup will have the same proving and validation keys, and will not have to trust each other.
An arithmetization is the way to represent the setup to the proving system. They are very low level and based on polynomials. As a simil, if the proving system is a CPU, the arithmetization is its machine code.
It is a tool to write arithmetization in a more developer friendly way, but still very close to the arithmetization. If arithmetization is machine code, a ZKP low-level DSL is like assembly.
They allow to write the setup in a way that is closer to the way a developer thinks about the computation, and they get compiled to the arithmatization. Following the previous simil a ZKP high-level structured language is like Python.
Chiquito is an example of ZKP high-level structured language that is based on steps.
In ZKP the witness signals are not made of bytes, they are elements (or values) of a Finite Prime Field. We need to understand how FPFs work in order to write circuits.
As a developer you can see it as a unsigned integer type where the maximum value is a prime minus one (p - 1
instead of 2^n-1
) and addition and multiplication overflows as expected, so a + b = a + b mod p
and a * b = a * b mod p
.
Negative values are obtained by the formula a + (-a) mod p = 0
.
The prime p
is usually a very big number when used in ZKP, but we can see an easy example with p = 7
.
The posible values would be 0, 1, 2, 3, 4, 5
and 6
. If we go over p
it overflows around to 0
. So for example 6 + 1 = 0
or 5 + 3 = 1
.
Then for example -3 + 3 mod 7 = 0
which is satisfied by 4 + 3 mod 7 = 0 => -3 = 4
.
This is a very short summary of what you need to know about FPFs.