This repository is prepared for learning the core mental model of Zero-Knowledge (ZK) proofs and the o1js workflow.
During this workshop:
- We will not build large projects
- We will not write UI / frontend
- We will write and run real ZK proofs
Focus:
ZK mental model + how to think in o1js
In this workshop you will:
- Understand public input vs private input (witness)
- Learn what a constraint actually means
- Use o1js to:
- compile
- prove
- verify
- Build a minimal commitment proof
- Mini challenge:
Prove βI am at least 18 years oldβ without revealing your age
Every ZK program in o1js follows this flow:
- Write a ZkProgram
- Compile the program
- Generate a proof using private input
- Verify the proof using public input
You will repeat this flow multiple times in this repository.
You should have the following installed:
- Node.js (v18+ recommended)
- npm
- Git
Check with:
node -v
npm -v
git --versionThe CLI is NOT required to complete this workshop. Everything can be done inside this repository.
The CLI is provided for those who want to experiment or create their own zkApps later.
The zkApp CLI (zk) is the official Mina tool used to:
- scaffold zkApp projects
- run tests
- deploy zkApps
It automatically includes o1js.
Install globally:
npm install -g zkapp-cliVerify installation:
zk --versionIf the command is not found:
- restart your terminal
- ensure your global npm bin path is in your $PATH
This step is optional and not required for the workshop.
zk project my-zkapp
cd my-zkapp
npm install
npm testRecommended official resources:
Clone the repository:
git clone https://github.com/GTU-Blockchain/o1js-workshop
cd o1js-workshop
npm install
npm testIf tests run successfully, you are ready.
Goal:
Prove that you are at least 18 years old without revealing your age.
Rules:
- Age must be a private input
- The constraint must enforce age >= 18
- Test both valid and invalid cases
-
Fork this repository
-
Create a new branch:
git checkout -b submit/<your-name>
-
Commit your changes:
git add . git commit -m "Complete workshop steps"
-
Push your branch:
git push origin submit/<your-name>
-
Open a Pull Request to the original repository
PR title:
[Submission] Your Name
If you do not want to fork:
git diff > your-name.patchShare the .patch file through the workshop channel.
- ZK code is not runtime logic
assertEquals,assertLessThandefine constraints- JavaScript
ifis not the same asProvable.if - Everything is about defining what must be true
Zero-Knowledge is not about hiding data, it is about proving correctness while staying private.
o1js is the tool that turns this idea into working code.