Every Ethereum blob and most PLONK proofs come down to the one check below. If it passes, the verifier accepts a value of a polynomial it has never seen. The math behind it is solid. The real breaks, such as Frozen Heart, came from the code around it.
Click any symbol or protocol step to see what it is, who computes it and what it hides. The rest of the post builds this check from scratch, then shows where implementations broke.
Interactive version (click any symbol or step): luk3.tech
In this post: how KZG works, what PLONK and EIP-4844 add, public bugs, a 22-item checklist and runnable Rust code. The checklist is also a single README on GitHub, 0xluk3/kzg-security, written to be pasted into an AI assistant together with the code under review.
1. What KZG is and why it exists
KZG lets a prover prove that a polynomial fixed earlier has a given value at a given point, without revealing the polynomial. The prover fixes the polynomial by publishing one curve point C , called the commitment: once it is sent, the prover can no longer change the polynomial. Later, for any point z , the prover can send the value y=f(z) together with a short opening proof π that this value really comes from the polynomial behind C .
KZG is not a proof system on its own. It is a mechanism inside SNARKs such as PLONK:
- arithmetisation turns a system of equations (the circuit) into a statement about polynomials,
- those polynomials are large and contain the witness, so the prover does not send them: it sends commitments, and later opening proofs,
- the verifier checks the statement at a random point, and KZG guarantees that the values it receives come from the polynomials fixed by the commitments.
As a result the proof has constant size and verification costs a few pairings, whatever the size of the circuit.
KZG is also used on its own: Ethereum commits to every blob with it (EIP-4844). Section 3 lists where it shows up in an audit.
2. KZG step by step
This section builds the interactive version, in which the verifier sends a random point. Section 2.8 replaces that message with a hash. We start from the claim the verifier wants to check and transform it, one step at a time, into the equation the verifier actually computes.
2.1 The claim
Let F be a finite field: the integers modulo a large prime (the math cheatsheet covers the basics). Every number below is an element of F .
Let f be the prover's polynomial,
with coefficients f0,…,fn∈F (in code, just the vector (f0,…,fn) ). f(a) is its value at X=a .
The verifier picks a random z∈F and asks for the value of f there. The prover answers with a number y . The claim to check is
The verifier cannot simply recompute f(z) , because it does not see f .
2.2 From a value to a root
Moving y to the left gives a statement about one number: f(z)−y=0 . To turn it into a statement about a polynomial, subtract y from the whole polynomial instead. Let
the same coefficients as f , except the constant term, which becomes f0−y . Its value at z is g(z)=f(z)−y , so claim (1) says
that is, z is a root of g .
2.3 From a root to a factor
We know that z is a root of g . What does that say about g as a whole? Divide g by (X−z) (for example, by long division). The result is a quotient polynomial q(X) and a remainder r :
The remainder is always a polynomial of lower degree than the divisor. Here the divisor (X−z) has degree 1, so the remainder has degree 0: it is a constant, a single number. Substitute X=z :
So the remainder is exactly g(z) . Since z is a root, g(z)=0 , the remainder is zero, and
A polynomial with root z contains the factor (X−z) , and q is what is left after taking it out. This is the factor theorem.
Why divide at all? The division gives two things. The remainder tells whether the claim is true: r=g(z)=f(z)−y is zero exactly when y=f(z) . The quotient q is the object the prover will later hide in its proof: the evidence that the division came out exact.
Substituting g(X)=f(X)−y back, claim (1) is equivalent to
Key idea. This is the KZG equation. A claim about one number, (1), has become an identity between polynomials, (2). If y is false, the division leaves the remainder f(z)−y=0 and no polynomial q satisfies (2).
2.4 From an identity to one point
Two different polynomials of degree at most n agree on at most n points. So to check identity (2), it is enough to compare both sides at a single random point, provided the prover did not know that point when it chose f and q .
Let τ∈F be such a point: chosen at random by a setup ceremony, then deleted, so that nobody knows it. Substituting X=τ into (2):
If (3) holds, then with overwhelming probability (2) holds, and therefore (1) holds.
Key idea. The check happens at τ , but it proves something about z . The two points play different roles: z is public and is where the question is asked, while τ is secret and is where the answer is checked. The only requirement is τ=z , which fails with negligible probability.
Equation (3) is a statement about three numbers, f(τ) , q(τ) and τ−z , that nobody can compute, because nobody knows τ . The rest of KZG is a way to check (3) without anyone knowing them.
2.5 Hiding the numbers in curve points
Let G1 and G2 be the two groups of points of a pairing-friendly elliptic curve (BN254 or BLS12-381), with generators G and H . For a number a , let
Everyone can see the point, but nobody can recover a from it (the discrete-log problem, explained in private keys and elliptic curves). Points can be added and multiplied by known numbers: [a]1+[b]1=[a+b]1 and k⋅[a]1=Source:https://dev.to/0xluk3/building-and-securing-kzg-implementations-ng0

