ZoKrates is a toolbox for zkSNARKs. This fork augments the capabilities of ZoKrates by adding the following command to the command line interface (CLI)
./zokrates export-avm-verifier [--proving-scheme <'G16'|'PGHR13'|'GM17'>] [--input <verifier path>] [--output <path>]
This command enables generation of SNARK verification contracts which can be deployed directly onto the Aion Virtual Machine (AVM). All other ZoKrates features (i.e. expressing SNARKs using the ZoKrates DSL) work as documented.
Note: Currently only the Groth 16 (G16) proving scheme is supported for AVM verifier export. Capabilities to export PGHR13 and GM17 will be added shortly.
This is a proof-of-concept implementation. It has not been tested for production.
- Build zokrates using the
build_release.shscripts (requires Rust to be installed).
- Express a SNARK using the ZoKrates DSL as usual (the documentation is quite helpful). The built binary will be located in
- When you're ready to generate a AVM contract containing the SNARK verification logic, simply run through the
generate-proofsteps using the built ZoKrates binary as usual.
- Instead of calling
export-verifier(which generates a Solidity contract), call
export-avm-verifier, which generates a set of Java source files within a directory called
avm-verifier. The entry-point to the AVM contract is called
- Deploy the contract files in the
avm-verifierdirectory the usual way :)