SlideShare a Scribd company logo
Log-derivative lookups for improving performance
of non-native arithmetic in SNARKs
Ivo Kubjas
gnark
August 3, 2023
Motivation
I In pairing based SNARKs we work in a pairing-friendly elliptic
curve group.
I The arithmetic is defined on the scalars of the EC group.
I The computation (circuit) is defined as a relation between
polynomials.
I Succinct verification: verifier only receives commitments to
some polynomials, asks opening and checks relation on the
evaluations.
I Heavy prover: has to compute relation → need FFT/NTT for
any reasonably-sized circuits
Motivation
I But curves which are good for SNARKs, are not compatible
with practical applications
I ECDSA over BN254, P-256/P-384
I RSA signature scheme
I BLS signatures
I We need non-native (to the scalar field) arithmetic!
Useful fields
Fast fields
for SNARKs
BLS sigs
over 2-chains
Non-native arithmetic
I Chinese remainder theorem 1 - schoolbook multi-precision
integer multiplication
I Casting out primes (nines) 2 - check against many small prime
moduli
I Goblin Plonk - ZKSG a few weeks ago
I xjSNARK-style polynomial identity testing 3
1
https://hackmd.io/@arielg/B13JoihA8
2
https://eprint.iacr.org/2022/1470
3
https://akosba.github.io/papers/xjsnark.pdf
Representation
I Moduli of native field r and non-native field q.
I Decompose non-native element a in basis 2B:
a =
N−1
X
i=0
ai2iB
, ∀ai ∈ [0, 2B
)
I If 2B < r, then limbs ai can fit into the native field.
Native element
Non-native
element limb
a0 a1 a2
I Have to track if possibly ai ≥ 2B. Introducing overflow such
that ai ∈ [0, 2B+overflow).
Arithmetic 101
I Arithmetic on integers, do not bother about modular
reduction for now.
I Addition limbwise: a + b =
PN−1
i=0 (ai + bi)2iB. Set
overflow = max(overflowa, overflowb) + 1.
I It is going to be easy...
I Subtraction limbwise: a − b =
PN−1
i=0 (ai − bi)2iB. But what if
bi > ai? 🤯
I Being in a field, can add multiples of q: padding s such that
si > bi and s = αq.
I Subtraction: a + s − b, then never underflows.
Multiplication
I Naive integer multiplication:
c = a · b ⇔ c` =
2N−1
X
i,j=0
i+j=`
aibj
I Observe: native multiplication complexity O(N2).
I xjSNARK observations
I for integer a =
P
ai 2B
associate polynomial a(X) =
P
ai X
I can compute c out-circuit (using advice/hint) and have to
assert a(X) · b(X) = c(X)
I cannot do Schwartz-Zippel, but degree of c(X) is small
enough to brute-force
I constants!
I Got O(N) multiplication complexity (T&C apply)
I Overflow of the result limbs bounded by
B + overflowa + overflowb + b + log2(2N − 1).
I I went over the fact that we need to range-check c` from hint.
Modular reduction
I Can amortize multiplications before we have to mod-reduce
I But in practice not useful as limb count of grows exponentially
and overflows large ⇒ range checks become very difficult
I a ≡ b (mod q) ⇔ ∃α : a − b = αq (NB! integer assertion)
I Could try comparing limb-wise, but a − b and αq may have
different overflows
I To carry excess, need to partition the limbs at common split
⇒ need to range check carries to ensure partition correctness.
a0 a1 a2
- + - +
b0 b1 b2
e0 e1
e0 e1
I For equality check of a and b, consider as polynomials a(X),
b(X) and polynomial e(X) made from the excess:
a(X) = b(X) + (2B
− X)e(X)
Mulmod
I Combining with multiplication and modular reduction, get:
a(X)b(X) ≡ c(X) + α(X)q(X) + (2B
− X)e(X) (mod r)
I Good in R1CS (polynomial evaluation at constant)
I Less good in PLONK
I Some badness can be averted using caching
Done?
I Multiplication complexity small-ish
(O(N) with small constants)
I But have to range check: c
(modular residual c, coefficient α
and carries e)
I Naive range check adds 1/2
constraint per bit (O(B) with same
small constants):
(1 − xi) ∗ xi = 0 &
X
i
xi2i
= x
I B is ≤ 64 times larger than N
Range checks
I UltraPLONK (custom gates + plookup) - couldn’t figure out
how to do nicely, also in Groth16.
I Waksman permutation network - too small saving.
I Multiset equality using logarithmic derivative argument? 4
X
fi
ki
X − fi
=
X
sj
1
X − sj
4
https://ia.cr/2022/1530
Fiat-Shamir challenge in-circuit
I We would need a succinct verifier challenge depending on fi,
ki and si.
I In-circuit hashing doesn’t work, too expensive for prover.
I Out-circuit challenge computation doesn’t work, too
expensive for verifier and privacy loss.
I LegoSNARK commitment?
I Trick to efficiency - use part of proof as a commitment.
Commitment as in-circuit challenge
I Pedersen vector commitment with proving key as a basis
I For binding, basis has to be linearly independent ⇒ basis with
known relations to prover would lead to multiple valid witness.
I If prover can predict commitment value for a random basis,
then can break discrete log.
I Hash commitment with domain separation to native field, use
as a public witness.
I For PLONK, we use a custom gate to mark committed
variables and use its polynomial commitment as a public
witness.5
5
https://ia.cr/2022/1072
Using randomness in circuit
I Unified circuits for PLONK and R1CS.
I Multiple commitment: τi = H(i, τ)
I Tables by compressing entries and lookups: f(τ) =
P
i fiτi
I Boolean function pre-computation: Lookup(x||y||XOR(x, y))
I Non-native mulmod check:
a(τ)b(τ) ≡ c(τ) + α(τ)q(τ) + (2B − τ)e(τ)
Technical consideration - non-native soundness
func (c *Circuit) Define(api *frontend.API) error {
nna := emulated.New[emulated.Secp256k1](api)
nna.Rangecheck(c.Witness)
nna.Rangecheck(c.Input)
res := nna.Mul(c.Witness, c.Input)
nna.Rangecheck(res)
// ...
}
Better
func (c *Circuit) Define(api *frontend.API) error {
nna := emulated.New[emulated.Secp256k1](api)
res := nna.Mul(c.Witness, c.Input)
// ...
}
Technical considerations - lazy finalization
func (c *Circuit) Define(api *frontend.API) error {
rchecker := rangecheck.New(api)
rchecker.Check(c.Witness, 16)
// ..
rchecker.Finalize()
}
Better
func (c *Circuit) Define(api *frontend.API) error {
rchecker := rangecheck.New(api)
rchecker.Check(c.Witness, 16)
return nil // automatically finalized
}
Technical considerations - range check table size
func (c *Circuit) Define(api *frontend.API) error {
rchecker := rangecheck.New(api)
rchecker.Check(c.Witness, 16)
rchecker.Check(c.Witness2, 16)
// built table of size 2^16
}
I Estimate optimal table size for the number of inputs and bits
checked
Benchmarks
I Counting constraints not very descriptive (proof systems,
precomputation)
I Time, CPU usage, memory better
I https://www.zk-bench.org/circuit
I https://zka.lc/
I https://zprize.io
I Benchmarks on MBP M1 over BN254 (solve + prove)
Operation Groth16 PLONK
ECDSA secp256k1/P256 1.29s (284767) 18.9s (1136131)
ECDSA P384 2.75s (598706) 127.9s (2334733)
BN254 pairing 7.07s (1895732) (7458801)
BLS12-381 pairing 10.90s (2546974) (10077257)

More Related Content

What's hot

ZK Study Club: Supernova (Srinath Setty - MS Research)
ZK Study Club: Supernova (Srinath Setty - MS Research)ZK Study Club: Supernova (Srinath Setty - MS Research)
ZK Study Club: Supernova (Srinath Setty - MS Research)
Alex Pruden
 
クラウドを支えるこれからの暗号技術
クラウドを支えるこれからの暗号技術クラウドを支えるこれからの暗号技術
クラウドを支えるこれからの暗号技術
MITSUNARI Shigeo
 
Requirement diagram
Requirement diagramRequirement diagram
Requirement diagram
Yohsuke Nambu
 
暗認本読書会11
暗認本読書会11暗認本読書会11
暗認本読書会11
MITSUNARI Shigeo
 
ブロックチェーン系プロジェクトで着目される暗号技術
ブロックチェーン系プロジェクトで着目される暗号技術ブロックチェーン系プロジェクトで着目される暗号技術
ブロックチェーン系プロジェクトで着目される暗号技術
MITSUNARI Shigeo
 
犬でもわかる公開鍵暗号
犬でもわかる公開鍵暗号犬でもわかる公開鍵暗号
犬でもわかる公開鍵暗号
akakou
 
競プロでGo!
競プロでGo!競プロでGo!
競プロでGo!
鈴木 セシル
 
ビットコインとブロックチェーンを初めからていねいに(超基礎編)
ビットコインとブロックチェーンを初めからていねいに(超基礎編)ビットコインとブロックチェーンを初めからていねいに(超基礎編)
ビットコインとブロックチェーンを初めからていねいに(超基礎編)
dcubeio
 
zk-SNARKsの仕組みについて
zk-SNARKsの仕組みについてzk-SNARKsの仕組みについて
zk-SNARKsの仕組みについて
ts21
 
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
Recruit Technologies
 
katagaitai CTF勉強会 #5 Crypto
katagaitai CTF勉強会 #5 Cryptokatagaitai CTF勉強会 #5 Crypto
katagaitai CTF勉強会 #5 Crypto
trmr
 
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
Akira Kanaoka
 
暗認本読書会12
暗認本読書会12暗認本読書会12
暗認本読書会12
MITSUNARI Shigeo
 
暗認本読書会9
暗認本読書会9暗認本読書会9
暗認本読書会9
MITSUNARI Shigeo
 
冬のLock free祭り safe
冬のLock free祭り safe冬のLock free祭り safe
冬のLock free祭り safeKumazaki Hiroki
 
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
MITSUNARI Shigeo
 
コンテナの作り方「Dockerは裏方で何をしているのか?」
コンテナの作り方「Dockerは裏方で何をしているのか?」コンテナの作り方「Dockerは裏方で何をしているのか?」
コンテナの作り方「Dockerは裏方で何をしているのか?」
Masahito Zembutsu
 
暗認本読書会13 advanced
暗認本読書会13 advanced暗認本読書会13 advanced
暗認本読書会13 advanced
MITSUNARI Shigeo
 
AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解
MITSUNARI Shigeo
 
暗認本読書会6
暗認本読書会6暗認本読書会6
暗認本読書会6
MITSUNARI Shigeo
 

What's hot (20)

ZK Study Club: Supernova (Srinath Setty - MS Research)
ZK Study Club: Supernova (Srinath Setty - MS Research)ZK Study Club: Supernova (Srinath Setty - MS Research)
ZK Study Club: Supernova (Srinath Setty - MS Research)
 
クラウドを支えるこれからの暗号技術
クラウドを支えるこれからの暗号技術クラウドを支えるこれからの暗号技術
クラウドを支えるこれからの暗号技術
 
Requirement diagram
Requirement diagramRequirement diagram
Requirement diagram
 
暗認本読書会11
暗認本読書会11暗認本読書会11
暗認本読書会11
 
ブロックチェーン系プロジェクトで着目される暗号技術
ブロックチェーン系プロジェクトで着目される暗号技術ブロックチェーン系プロジェクトで着目される暗号技術
ブロックチェーン系プロジェクトで着目される暗号技術
 
犬でもわかる公開鍵暗号
犬でもわかる公開鍵暗号犬でもわかる公開鍵暗号
犬でもわかる公開鍵暗号
 
競プロでGo!
競プロでGo!競プロでGo!
競プロでGo!
 
ビットコインとブロックチェーンを初めからていねいに(超基礎編)
ビットコインとブロックチェーンを初めからていねいに(超基礎編)ビットコインとブロックチェーンを初めからていねいに(超基礎編)
ビットコインとブロックチェーンを初めからていねいに(超基礎編)
 
zk-SNARKsの仕組みについて
zk-SNARKsの仕組みについてzk-SNARKsの仕組みについて
zk-SNARKsの仕組みについて
 
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
レコメンドバッチ高速化に向けたSpark/MapReduceの機械学習ライブラリ比較検証
 
katagaitai CTF勉強会 #5 Crypto
katagaitai CTF勉強会 #5 Cryptokatagaitai CTF勉強会 #5 Crypto
katagaitai CTF勉強会 #5 Crypto
 
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
IDベース暗号の概観と今後の展望(次世代セキュア情報基盤ワークショップ )
 
暗認本読書会12
暗認本読書会12暗認本読書会12
暗認本読書会12
 
暗認本読書会9
暗認本読書会9暗認本読書会9
暗認本読書会9
 
冬のLock free祭り safe
冬のLock free祭り safe冬のLock free祭り safe
冬のLock free祭り safe
 
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
ElGamal型暗号文に対する任意関数演算・再暗号化の二者間秘密計算プロトコルとその応用
 
コンテナの作り方「Dockerは裏方で何をしているのか?」
コンテナの作り方「Dockerは裏方で何をしているのか?」コンテナの作り方「Dockerは裏方で何をしているのか?」
コンテナの作り方「Dockerは裏方で何をしているのか?」
 
暗認本読書会13 advanced
暗認本読書会13 advanced暗認本読書会13 advanced
暗認本読書会13 advanced
 
AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解AVX-512(フォーマット)詳解
AVX-512(フォーマット)詳解
 
暗認本読書会6
暗認本読書会6暗認本読書会6
暗認本読書会6
 

Similar to zkStudyClub - Improving performance of non-native arithmetic in SNARKs (Ivo Kubjas, Consensys Gnark)

zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
Alex Pruden
 
Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2
Vijayananda Mohire
 
Reducing Structural Bias in Technology Mapping
Reducing Structural Bias in Technology MappingReducing Structural Bias in Technology Mapping
Reducing Structural Bias in Technology Mappingsatrajit
 
An Introduction to Elleptic Curve Cryptography
An Introduction to Elleptic Curve CryptographyAn Introduction to Elleptic Curve Cryptography
An Introduction to Elleptic Curve Cryptography
Derek Callaway
 
3306565.ppt
3306565.ppt3306565.ppt
3306565.ppt
JP Chicano
 
fauvel_igarss.pdf
fauvel_igarss.pdffauvel_igarss.pdf
fauvel_igarss.pdfgrssieee
 
Cheatsheet convolutional-neural-networks
Cheatsheet convolutional-neural-networksCheatsheet convolutional-neural-networks
Cheatsheet convolutional-neural-networks
Steve Nouri
 
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
Matt Moores
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
AnaNeacsu5
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
Dilum Bandara
 
Ec2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.orgEc2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.org
annaunivedu
 
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
3rd Semester Computer Science and Engineering  (ACU-2022) Question papers3rd Semester Computer Science and Engineering  (ACU-2022) Question papers
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
BGS Institute of Technology, Adichunchanagiri University (ACU)
 
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Spark Summit
 
Engineering fast indexes (Deepdive)
Engineering fast indexes (Deepdive)Engineering fast indexes (Deepdive)
Engineering fast indexes (Deepdive)
Daniel Lemire
 
Stratified Monte Carlo and bootstrapping for approximate Bayesian computation
Stratified Monte Carlo and bootstrapping for approximate Bayesian computationStratified Monte Carlo and bootstrapping for approximate Bayesian computation
Stratified Monte Carlo and bootstrapping for approximate Bayesian computation
Umberto Picchini
 
Low-rank response surface in numerical aerodynamics
Low-rank response surface in numerical aerodynamicsLow-rank response surface in numerical aerodynamics
Low-rank response surface in numerical aerodynamics
Alexander Litvinenko
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
Computer Network Assignment Help
 

Similar to zkStudyClub - Improving performance of non-native arithmetic in SNARKs (Ivo Kubjas, Consensys Gnark) (20)

zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
zkStudyClub: PLONKUP & Reinforced Concrete [Luke Pearson, Joshua Fitzgerald, ...
 
Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2Quantum Computing Notes Ver 1.2
Quantum Computing Notes Ver 1.2
 
Reducing Structural Bias in Technology Mapping
Reducing Structural Bias in Technology MappingReducing Structural Bias in Technology Mapping
Reducing Structural Bias in Technology Mapping
 
An Introduction to Elleptic Curve Cryptography
An Introduction to Elleptic Curve CryptographyAn Introduction to Elleptic Curve Cryptography
An Introduction to Elleptic Curve Cryptography
 
3306565.ppt
3306565.ppt3306565.ppt
3306565.ppt
 
fauvel_igarss.pdf
fauvel_igarss.pdffauvel_igarss.pdf
fauvel_igarss.pdf
 
Cheatsheet convolutional-neural-networks
Cheatsheet convolutional-neural-networksCheatsheet convolutional-neural-networks
Cheatsheet convolutional-neural-networks
 
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
R package 'bayesImageS': a case study in Bayesian computation using Rcpp and ...
 
lecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdflecture01_lecture01_lecture0001_ceva.pdf
lecture01_lecture01_lecture0001_ceva.pdf
 
Digital Logic
Digital LogicDigital Logic
Digital Logic
 
Ec2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.orgEc2203 digital electronics questions anna university by www.annaunivedu.org
Ec2203 digital electronics questions anna university by www.annaunivedu.org
 
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
3rd Semester Computer Science and Engineering  (ACU-2022) Question papers3rd Semester Computer Science and Engineering  (ACU-2022) Question papers
3rd Semester Computer Science and Engineering (ACU-2022) Question papers
 
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
Engineering Fast Indexes for Big-Data Applications: Spark Summit East talk by...
 
Engineering fast indexes (Deepdive)
Engineering fast indexes (Deepdive)Engineering fast indexes (Deepdive)
Engineering fast indexes (Deepdive)
 
Stratified Monte Carlo and bootstrapping for approximate Bayesian computation
Stratified Monte Carlo and bootstrapping for approximate Bayesian computationStratified Monte Carlo and bootstrapping for approximate Bayesian computation
Stratified Monte Carlo and bootstrapping for approximate Bayesian computation
 
Low-rank response surface in numerical aerodynamics
Low-rank response surface in numerical aerodynamicsLow-rank response surface in numerical aerodynamics
Low-rank response surface in numerical aerodynamics
 
Mtc ssample05
Mtc ssample05Mtc ssample05
Mtc ssample05
 
Mtc ssample05
Mtc ssample05Mtc ssample05
Mtc ssample05
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Minimizing boolean
Minimizing booleanMinimizing boolean
Minimizing boolean
 

More from Alex Pruden

zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
Alex Pruden
 
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
Alex Pruden
 
zkStudyClub - cqlin: Efficient linear operations on KZG commitments
zkStudyClub - cqlin: Efficient linear operations on KZG commitments zkStudyClub - cqlin: Efficient linear operations on KZG commitments
zkStudyClub - cqlin: Efficient linear operations on KZG commitments
Alex Pruden
 
Eos - Efficient Private Delegation of zkSNARK provers
Eos  - Efficient Private Delegation of zkSNARK proversEos  - Efficient Private Delegation of zkSNARK provers
Eos - Efficient Private Delegation of zkSNARK provers
Alex Pruden
 
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
Alex Pruden
 
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
Alex Pruden
 
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
Alex Pruden
 
zkStudy Club: Subquadratic SNARGs in the Random Oracle Model
zkStudy Club: Subquadratic SNARGs in the Random Oracle ModelzkStudy Club: Subquadratic SNARGs in the Random Oracle Model
zkStudy Club: Subquadratic SNARGs in the Random Oracle Model
Alex Pruden
 
ZK Study Club: Sumcheck Arguments and Their Applications
ZK Study Club: Sumcheck Arguments and Their ApplicationsZK Study Club: Sumcheck Arguments and Their Applications
ZK Study Club: Sumcheck Arguments and Their Applications
Alex Pruden
 
Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9
Alex Pruden
 
Quarks zk study-club
Quarks zk study-clubQuarks zk study-club
Quarks zk study-club
Alex Pruden
 
zkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to CircuitszkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to Circuits
Alex Pruden
 

More from Alex Pruden (13)

zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
zkStudyClub - zkSaaS (Sruthi Sekar, UCB)
 
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
zkStudyClub - ProtoStar (Binyi Chen & Benedikt Bünz, Espresso Systems)
 
zkStudyClub - cqlin: Efficient linear operations on KZG commitments
zkStudyClub - cqlin: Efficient linear operations on KZG commitments zkStudyClub - cqlin: Efficient linear operations on KZG commitments
zkStudyClub - cqlin: Efficient linear operations on KZG commitments
 
Eos - Efficient Private Delegation of zkSNARK provers
Eos  - Efficient Private Delegation of zkSNARK proversEos  - Efficient Private Delegation of zkSNARK provers
Eos - Efficient Private Delegation of zkSNARK provers
 
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
zkStudyClub: HyperPlonk (Binyi Chen, Benedikt Bünz)
 
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
Caulk: zkStudyClub: Caulk - Lookup Arguments in Sublinear Time (A. Zapico)
 
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
zkStudyClub: Zero-Knowledge Proofs Security, in Practice [JP Aumasson, Taurus]
 
zkStudy Club: Subquadratic SNARGs in the Random Oracle Model
zkStudy Club: Subquadratic SNARGs in the Random Oracle ModelzkStudy Club: Subquadratic SNARGs in the Random Oracle Model
zkStudy Club: Subquadratic SNARGs in the Random Oracle Model
 
ZK Study Club: Sumcheck Arguments and Their Applications
ZK Study Club: Sumcheck Arguments and Their ApplicationsZK Study Club: Sumcheck Arguments and Their Applications
ZK Study Club: Sumcheck Arguments and Their Applications
 
Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9Ecfft zk studyclub 9.9
Ecfft zk studyclub 9.9
 
Quarks zk study-club
Quarks zk study-clubQuarks zk study-club
Quarks zk study-club
 
zkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to CircuitszkStudyClub: CirC and Compiling Programs to Circuits
zkStudyClub: CirC and Compiling Programs to Circuits
 

Recently uploaded

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 

zkStudyClub - Improving performance of non-native arithmetic in SNARKs (Ivo Kubjas, Consensys Gnark)

  • 1. Log-derivative lookups for improving performance of non-native arithmetic in SNARKs Ivo Kubjas gnark August 3, 2023
  • 2. Motivation I In pairing based SNARKs we work in a pairing-friendly elliptic curve group. I The arithmetic is defined on the scalars of the EC group. I The computation (circuit) is defined as a relation between polynomials. I Succinct verification: verifier only receives commitments to some polynomials, asks opening and checks relation on the evaluations. I Heavy prover: has to compute relation → need FFT/NTT for any reasonably-sized circuits
  • 3. Motivation I But curves which are good for SNARKs, are not compatible with practical applications I ECDSA over BN254, P-256/P-384 I RSA signature scheme I BLS signatures I We need non-native (to the scalar field) arithmetic! Useful fields Fast fields for SNARKs BLS sigs over 2-chains
  • 4. Non-native arithmetic I Chinese remainder theorem 1 - schoolbook multi-precision integer multiplication I Casting out primes (nines) 2 - check against many small prime moduli I Goblin Plonk - ZKSG a few weeks ago I xjSNARK-style polynomial identity testing 3 1 https://hackmd.io/@arielg/B13JoihA8 2 https://eprint.iacr.org/2022/1470 3 https://akosba.github.io/papers/xjsnark.pdf
  • 5. Representation I Moduli of native field r and non-native field q. I Decompose non-native element a in basis 2B: a = N−1 X i=0 ai2iB , ∀ai ∈ [0, 2B ) I If 2B < r, then limbs ai can fit into the native field. Native element Non-native element limb a0 a1 a2 I Have to track if possibly ai ≥ 2B. Introducing overflow such that ai ∈ [0, 2B+overflow).
  • 6. Arithmetic 101 I Arithmetic on integers, do not bother about modular reduction for now. I Addition limbwise: a + b = PN−1 i=0 (ai + bi)2iB. Set overflow = max(overflowa, overflowb) + 1. I It is going to be easy... I Subtraction limbwise: a − b = PN−1 i=0 (ai − bi)2iB. But what if bi > ai? 🤯 I Being in a field, can add multiples of q: padding s such that si > bi and s = αq. I Subtraction: a + s − b, then never underflows.
  • 7. Multiplication I Naive integer multiplication: c = a · b ⇔ c` = 2N−1 X i,j=0 i+j=` aibj I Observe: native multiplication complexity O(N2). I xjSNARK observations I for integer a = P ai 2B associate polynomial a(X) = P ai X I can compute c out-circuit (using advice/hint) and have to assert a(X) · b(X) = c(X) I cannot do Schwartz-Zippel, but degree of c(X) is small enough to brute-force I constants! I Got O(N) multiplication complexity (T&C apply) I Overflow of the result limbs bounded by B + overflowa + overflowb + b + log2(2N − 1). I I went over the fact that we need to range-check c` from hint.
  • 8. Modular reduction I Can amortize multiplications before we have to mod-reduce I But in practice not useful as limb count of grows exponentially and overflows large ⇒ range checks become very difficult I a ≡ b (mod q) ⇔ ∃α : a − b = αq (NB! integer assertion) I Could try comparing limb-wise, but a − b and αq may have different overflows I To carry excess, need to partition the limbs at common split ⇒ need to range check carries to ensure partition correctness. a0 a1 a2 - + - + b0 b1 b2 e0 e1 e0 e1 I For equality check of a and b, consider as polynomials a(X), b(X) and polynomial e(X) made from the excess: a(X) = b(X) + (2B − X)e(X)
  • 9. Mulmod I Combining with multiplication and modular reduction, get: a(X)b(X) ≡ c(X) + α(X)q(X) + (2B − X)e(X) (mod r) I Good in R1CS (polynomial evaluation at constant) I Less good in PLONK I Some badness can be averted using caching
  • 10. Done? I Multiplication complexity small-ish (O(N) with small constants) I But have to range check: c (modular residual c, coefficient α and carries e) I Naive range check adds 1/2 constraint per bit (O(B) with same small constants): (1 − xi) ∗ xi = 0 & X i xi2i = x I B is ≤ 64 times larger than N
  • 11. Range checks I UltraPLONK (custom gates + plookup) - couldn’t figure out how to do nicely, also in Groth16. I Waksman permutation network - too small saving. I Multiset equality using logarithmic derivative argument? 4 X fi ki X − fi = X sj 1 X − sj 4 https://ia.cr/2022/1530
  • 12. Fiat-Shamir challenge in-circuit I We would need a succinct verifier challenge depending on fi, ki and si. I In-circuit hashing doesn’t work, too expensive for prover. I Out-circuit challenge computation doesn’t work, too expensive for verifier and privacy loss. I LegoSNARK commitment?
  • 13. I Trick to efficiency - use part of proof as a commitment.
  • 14. Commitment as in-circuit challenge I Pedersen vector commitment with proving key as a basis I For binding, basis has to be linearly independent ⇒ basis with known relations to prover would lead to multiple valid witness. I If prover can predict commitment value for a random basis, then can break discrete log. I Hash commitment with domain separation to native field, use as a public witness. I For PLONK, we use a custom gate to mark committed variables and use its polynomial commitment as a public witness.5 5 https://ia.cr/2022/1072
  • 15. Using randomness in circuit I Unified circuits for PLONK and R1CS. I Multiple commitment: τi = H(i, τ) I Tables by compressing entries and lookups: f(τ) = P i fiτi I Boolean function pre-computation: Lookup(x||y||XOR(x, y)) I Non-native mulmod check: a(τ)b(τ) ≡ c(τ) + α(τ)q(τ) + (2B − τ)e(τ)
  • 16. Technical consideration - non-native soundness func (c *Circuit) Define(api *frontend.API) error { nna := emulated.New[emulated.Secp256k1](api) nna.Rangecheck(c.Witness) nna.Rangecheck(c.Input) res := nna.Mul(c.Witness, c.Input) nna.Rangecheck(res) // ... } Better func (c *Circuit) Define(api *frontend.API) error { nna := emulated.New[emulated.Secp256k1](api) res := nna.Mul(c.Witness, c.Input) // ... }
  • 17. Technical considerations - lazy finalization func (c *Circuit) Define(api *frontend.API) error { rchecker := rangecheck.New(api) rchecker.Check(c.Witness, 16) // .. rchecker.Finalize() } Better func (c *Circuit) Define(api *frontend.API) error { rchecker := rangecheck.New(api) rchecker.Check(c.Witness, 16) return nil // automatically finalized }
  • 18. Technical considerations - range check table size func (c *Circuit) Define(api *frontend.API) error { rchecker := rangecheck.New(api) rchecker.Check(c.Witness, 16) rchecker.Check(c.Witness2, 16) // built table of size 2^16 } I Estimate optimal table size for the number of inputs and bits checked
  • 19. Benchmarks I Counting constraints not very descriptive (proof systems, precomputation) I Time, CPU usage, memory better I https://www.zk-bench.org/circuit I https://zka.lc/ I https://zprize.io I Benchmarks on MBP M1 over BN254 (solve + prove) Operation Groth16 PLONK ECDSA secp256k1/P256 1.29s (284767) 18.9s (1136131) ECDSA P384 2.75s (598706) 127.9s (2334733) BN254 pairing 7.07s (1895732) (7458801) BLS12-381 pairing 10.90s (2546974) (10077257)