“Gentle” Introduction to Zero Knowledge Proof for Blockchain Developers
Angel “Java” Lopez�@ajlopez�https://github.com/ajlopez
Agenda
Transactions in Ethereum
Alice -> Bob 3 ETH�Bob -> Charlie 2 ETH�Charlie -> Dan 1 ETH
Moving Processing to Off-Chain
First Paper
Zero Knowledge Proof
A Simple Use Case
Alice, Bob and the Balls
Alice View
Bob View
Bob and Alice
Alice
Bob
First Interaction
Alice
Bob
Bob and Alice
Alice
Bob
Same!
Bob and Alice
Alice
Bob
Different!
Result
Zero Knowledge Proof for Transactions
Rules for a Transaction
Transformations
From Rules to ZK Circuit to Prover and Verifier
Rules
Circuit
Prover
Verifier
From Transaction To Verification of Proof
Alice sends 2 ETH to Bob
Prover
Proof
Verifier
OK
Zero Knowledge Proof for Transactions in Blockchain
SNARK
STARK
Offline Processing
Initial Setup
Operator
Prover
Blockchain
zkRollup Smart Contract
Verifier
Alice’s Wallet�20 ETH
�zkRollup contract�0 ETH
Alice Transfers to zkRollup 15 ETH
Operator
Prover
Blockchain
zkRollup Smart Contract
Verifier
Alice’s Wallet�5 ETH
�zkRollup contract�15 ETH
Offline Operations
Operator
Prover
Blockchain
zkRollup Smart Contract
Verifier
Alice’s Wallet�5 ETH
�zkRollup contract�15 ETH
Alice -> Bob �3 ETH�Bob -> Charlie�2 ETH�Charlie’s exit�2 ETH
Charlie’s Proof
Operator
Prover
Blockchain
zkRollup Smart Contract
Verifier
Alice’s Wallet�5 ETH
�zkRollup contract�15 ETH
Alice -> Bob �3 ETH�Bob -> Charlie�2 ETH�Charlie’s exit�2 ETH
Proof
New State
Operator
Prover
Blockchain
zkRollup Smart Contract
Verifier
Alice’s Wallet�5 ETH
�zkRollup contract�15 ETH��Charlie’s Wallet�2 ETH
Alice -> Bob �3 ETH�Bob -> Charlie�2 ETH�Charlie’s exit�2 ETH
Not So “Gentle” Introduction
From Code to Proof and Beyond
The Circuit
a
b
c
+
*
*
(a+b)*b*c
Homomorphic Hiding (HH)
An HH E(x) of a number x is a function satisfying the following properties:
Using E(x)
Polynomial Evaluation
A Polynomial Over a Field
Evaluation at s
Evaluation at E(s)�P(s) = P(E(s))
From Computation to Polynomials
From Polynomials to Elliptic Curve Points