Member-only story
Notes On zkSNARKs
16 min readSep 20, 2021
There are 4 stages of working out zkSNARKs:
Stage 1: Atomizing (or `Flattening`) Statements To Express An Arithmetic Circuit
The algorithmic formula contains a `trapdoor` as a proof. This is important for zkSNARKs, because this is task for the prover is to convince the verifier that such a witness exists, without revealing information about the witness.
Illustrative example
Designating an example of an algorithmic formula, i.e. a quadratic equation, example: x³+x+5 = 35. Designate that a proof is that Prover knows the solution to the equation. Here, solution: x=3.
Hence, this can be used as a witness statement, i.e. prove you know the solution to a cubic equation: x³+x+5 = 35 (answer is 3)The path to translating the algorithmic formula to a final polynomial form requires the step to first express it into a series of working codified steps. The quadratic equation is hence codified into a function:"""
def evaluate_formula (x):
y = x**3
return x + y + 5 # x³+x+5 (result must give 35, hence, x = 3)
"""
The complex statements are then atomized to be expressed into a sequence of statements that are of 2 forms:
[1] x = y ; y := variable or a number
[2] x = y (op) z ; op := {+, -, *, ÷}; y and z can be variables, numbers or even sub-expressions.