diff options
Diffstat (limited to 'docs/journal/pages/polynomial-commitments.md')
| -rw-r--r-- | docs/journal/pages/polynomial-commitments.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/journal/pages/polynomial-commitments.md b/docs/journal/pages/polynomial-commitments.md new file mode 100644 index 0000000..3878f67 --- /dev/null +++ b/docs/journal/pages/polynomial-commitments.md @@ -0,0 +1,22 @@ +> [Index](../README.md) + +# Polynomial Commitments + +zkSNARKS like PLONK are typically constructed from cryptographic "gadgets", one of them being polynomial commitments. These provide mechanisms to commit to a specific polynomial `P` (in the case of PLONK, a univariate polynomial - meaning with only one "variable"), and then later convince a verifier with some proof `π` that `P(u) = v` for some public `u` and `v`, without the verifier needing to actually compute `P(u)`. These require some essential properties for constructing a zkSNARK: + +1. It must be _binding_: once you have committed to a polynomial `P`, you cannot later convince the verifier of some evaluation `P'(u) = v` where `P' != P`. +2. It must be _hiding_: the commitment to `P` should not leak any information about `P` itself. +3. It must be _succinct_: the size of the proof `π` and time to verify must be at most `O(log(n))` where `n` is the size of `P` + +A very common polynomial commitment scheme that is used in zkSNARKs is the KZG commitment scheme, which satisfies all of these properties. In fact, proofs are **just a single group element** and verification requires a **fixed number of group and paring operations**! This is essentially means that, the proof size and verification time is `O(1)` regardless of the size of the polynomial `P`, which is kind of amazing and magic if you ask me. KZG requires elliptic curve pairings, so this is why we needed our BLS12-381 curve and pairing implementation in the first place. The process, at a high level is: + +1. Perform a trusted setup: choose some randome secret `s` and compute `s * G`, `s^2 * G`, ..., `s^n * G` for some maximum degree `n` of polynomials that you want to commit to. Delete `s` (this is why this is referred to as a "trusted setup", as you must trust that `s` is truly deleted; if someone knows `s`, they can convince a verifier of false statements) +2. Commit to a polynomial `P` with a maximum degree `n` by computing the commitment `C = P(s) * G`, noting that it is possible to evaluate `P(s) * G` without knowing `s` by using the precomputed values from the trusted setup and the coefficients of `P`. +3. To prove that `P(u) = v` (sometimes referred to as "opening the polynomial at `u`"), compute the quotient polynomial `Q(x) = (P(x) - v) / (x - u)` and compute the proof `π = Q(s) * G` (again noting that it is possible to compute this without knowing `s` just like for `P(s) * G`). +4. To verify the proof, you would need to check that `(s - u) * π = C - v * G` (this stems from the fact that `Q(x) * (x - u) = P(x) - v` therefore `Q(s) * (s - u) = P(s) - v`, multipling both sides by the generator `G`, you get `[Q(s) * G] * (s - u) = [P(s) * G] - v * G`) + +# Resources + +- [ZK Whiteboard Sessions - S01E02](https://zkhack.dev/whiteboard/module-two/) + +> [Index](../README.md) |
