mini-SNARK is a simple implementation of zk-SNARK protocol. It's implemented in Python and the only external dependency is py-ecc
from the Ethereum foundation. I wanted something simpler and easier to understand than the babySNARK. And the goal is to keep the code as simple as possible.
field.py
: Implementation of finite field arithmetic and polynomial.bls12.py
: A symmetric adaptation of the BLS12-381 curve.
The BLS12 code is from the babySNARK repo. Also, I took the field.py
partially from the stark101 tutorial repo with some modifications.
KZG is one PCS that is commonly used. I've implemented two versions.
kzg-simple.py
: A simplified KZG PCS implementation.kzg.py
: A reusable implementation of KZG PCS.
The detailed explanation of their implementation is in docs/kzg.md
.
Complete examples combining PCS with a simple circuit:
example-single-op.py
: A single operation circuit example.example-single-op-optimized.py
: An optimized version of the example above.
The detailed explanation of their implementation is in docs/example.md
.
- ZK Whiteboard lectures by Dan Boneh (2022 Aug)
- "Why and how zk-SNARK works" (2019) by Maksym Petkus (2019)