This project is a demo of a simple ZK application that allows verifying a proof generated using the groth16 scheme and the BLS12_381 curve.
This demo only shows the verification of a proof using BLS12_381 but BN254 is also supported in the AVM. However, Zokrates does not support BN254 curve, so a different library will be needed to generate a proof for that curve.
First clone this repo down
Note: This demo requires Python >= 3.10
In the sandbox
directory, run ./setup.sh
to
- clone down the sandbox
- setup configuration, so it may run with the EC math ops
- start the sandbox node
Note: This will start a sandbox node using the barnjamin/ec-math-wiggle
branch of go-algorand
, which has the EC math ops enabled in version 8 of the AVM. The AVM version they'll be enabled with is more likely to be version 10, but this is sufficient to start testing.
Install Zokrates using the instructions here.
Run the generate_proof
script to generate the Verification Key and Proof
./generate_proof.sh
Note: This must be done prior to running the contract since it relies on the Verification Key and Proof generated during this step
Install python prerequisites
$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install -r requirements.txt
Run the demo
(.venv) $ cd contracts
(.venv) $ python main.py
Created app: 1
Contract verified? True
Modify the .zok
file to change the proof that is generated to something more interesting.
Generate a proof using a different library to use the BN254
curve