A privacy-preserving age verification system built with zk-SNARKs, enabling users to prove they are above a required age (e.g., 18+) without ever revealing their actual age.
This project demonstrates real cryptographic ZKPs โ not just hashing tricks โ using BN128 elliptic curves, bilinear pairings, and arithmetic circuits.
- โ Zero-Knowledge: Server never learns your age
- โ Cryptographic Soundness: Proofs cannot be faked
- โ Succinct Proofs: Constant proof size (~1KB)
- โ Fast: Proof generation (~100ms), verification (~10ms)
- โ Non-Interactive: Only one message required
- โ Cloud Ready: Azure deployment templates included
- Client requests a challenge from the server
- Client computes age locally (never sent to server)
- zk-SNARK proof is generated using elliptic curve cryptography
- Client sends proof only
- Server verifies proof with bilinear pairings
- โ Result: Server confirms โ18+โ without seeing actual age
```python``
def age_verification_circuit(private_age, public_minimum_age): difference = private_age - public_minimum_age return difference >= 0
ZKP/ โโโ backend/ # Python backend โ โโโ zksnark_main.py # FastAPI server โ โโโ zksnark_age_verification.py # Core zk-SNARK implementation โ โโโ main.py # Educational demo (for learning) โ โโโ requirements.txt # Dependencies (py_ecc, FastAPI) โโโ frontend/ # Flutter frontend โ โโโ zkp_age_app/ โ โโโ lib/main.dart # UI connected to API โ โโโ pubspec.yaml โโโ azure/ # Azure deployment configs โโโ docs/ # Documentation
cd backend pip install -r requirements.txt python zksnark_main.py # Runs on http://localhost:8001
cd frontend/zkp_age_app flutter pub get flutter run -d web-server --web-port 3000
Access Points
๐ Web App โ http://localhost:3000
๐ API Docs โ http://localhost:8001/docs
๐ ZKP Info โ http://localhost:8001/zkp-info
Security Properties
๐ค Zero-Knowledge: Age never revealed ๐ก๏ธ Soundness: Impossible to fake proof โ Completeness: Valid users always verified โก Succinctness: Small, constant-size proofs
az webapp create --resource-group myResourceGroup
--plan myAppServicePlan --name zksnark-backend
--runtime "PYTHON|3.11"
cd frontend/zkp_age_app flutter build web az staticwebapp create --name zksnark-frontend --source .
cd backend pytest -v
cd frontend/zkp_age_app flutter test
This project is licensed under the MIT License. For educational and research purposes only.