Skip to content

Explore the world of zero-knowledge proofs from first principles.

License

Notifications You must be signed in to change notification settings

uncomputable/zkp-workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting to Know Zero-Knowledge

Everyone talks about zero-knowledge proofs (ZKP), but who understands them? How can a proof consist of bytes without leaking any knowledge? Why should I trust such a proof? 🤔

What this is

This is a workshop about ZKP written in Python. We use Jupyter as our interactive learning environment. Each notebook is a chapter. The chapters cover fundamentals, applications and much more. Explore and have fun 😜

What this isn't

We will not cover the latest and shiniest crypto. We will not build SNARKs, STARKs or validity rollups. The code you will see will not live up to the highest security standards (we use insecure parameters and take shortcuts for easier learning) 🕵️

Rationale

Master the basics first, then move to the advanced stuff; that is my philosophy. Let's build an intuition for how ZKP works. We start small and work our way up. Things become simpler when we break them down into their constituent parts. Divide and conquer. Once there is understanding, we can take what we learned here and apply it to real problems 💪

Benefits of zero-knowledge proofs

Zero-knowledge proofs have clear benefits compared to ordinary plain-text proofs. These properties might seem impossible and have the potential to change our world.

Compact

Proofs grow logarithmically in size. If you double the size of the data, then the size of the proof grows by a single bit. This means, we can compress data beyond entropy!

Fast

Proofs take logarithmic time to verify. If you double the number of steps of a computation, then the verification of the proof only takes one step longer! This means, we can compress computations!

Zero-knowledge

Proofs reveal no information. Everything that is sent over the wire is randomized. This means, we can work on private data without revealing it!

Run the workshop

Run the workshop online (binder) or locally (nix or pip).

We have come a long way since this workshop Sage (1 GB). The new dependencies take up less than 50 MB 🍃

See below how to set up the workshop.

Then select a chapter to read 📖

Use binder

Click the binder badge and wait for the workshop to be built on the server.

Binder

Use nix

Use the provided nix flake to set up the runtime environment.

nix develop

Run Jupyter on the command line.

jupyter notebook

Use pip

Create a virtual environment and use pip to install the dependencies.

python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

Run Jupyter on the command line.

jupyter notebook

Read the chapters

Some chapters depend on lessons from other chapters.

Start with chapters that depend on nothing else and work your way down the dependency tree, towards more advanced chapters.

Skip / skim lessons you already know. Look at what interests you and ignore everything else. Have fun 🤓

Chapter dependency tree

Explore extra content

See why the discrete logarithm is hard

See how the curve points jump in 2D space as you iterate through the curve.

This is explained in more detail in the chapter on elliptic curves 🌀

python3 hardness_dlog.py

Play Sudoku

Play the side of Victor in an interactive proof of knowledge of a Sudoku solution. Accept or reject. Peggy might be lying! 🧩

python3 play_sudoku.py

Customize the workshop

Look at the documentation for how to further customize the workshop 🎨

Improve the workshop

If you see errors or room for improvement, then feel free to open a Github issue.

Pull requests are also welcome.

Let's turn this workshop into the best it can be 🚀

Continue your journey

There is a lot more to learn about ZKP.

Check out these external resources. Happy learning 🧠