A minimal, modular implementation of a Groth16 zkSNARK verifier in Python, compatible with snarkjs-generated artifacts, with a working example based on an autonomous driving stop-sign scenario.
This project is part of a step-by-step effort to rebuild Groth16 from scratch, starting from the verifier and progressing toward a full prover implementation.
Current status:
- ✅ Groth16 verifier (Python, BN128)
- ✅ Compatible with
snarkjsartifacts - ✅ Modular structure (
types,parser,verifier) - ✅ Example: stop-sign autonomous driving scenario
- ✅ Unit tests (positive + negative cases)
The verifier performs:
- Parsing of:
verification_key.jsonproof.jsonpublic.json
- Construction of the linear combination:
Project structure
.
├── cleanup.py
├── examples
│ └── hermes_stop_sign
│ ├── proof.json
│ ├── public.json
│ ├── run_verify.py
│ └── verification_key.json
├── groth16_core
│ ├── __init__.py
│ └── verifier
│ ├── __init__.py
│ ├── parser.py
│ ├── types.py
│ └── verifier.py
├── Makefile
├── README.md
└── tests
└── test_verifier.py
From the repository root:
PYTHONPATH=groth16-core python groth16-core/examples/hermes_stop_sign/run_verify.pyOutput
result: True
result with tampered public input: FalseRunning Test
PYTHONPATH=groth16-core pytest -q