Snårkl ("Snorkel") is a high-level language and compiler for verifiable computing. It is capable of compiling an embedded DSL to a system of arithmetic constraints and solving for a satisfying witness. These programs can be embedded in larger Haskell programs or used as standalone applications via the CLI bindings.
There is a tutorial which is written in literate Haskell (i.e. it compiles to an executable). You can also find some interesting examples involving user defined datatypes.
Snarkl can be used either for simple verified computation or for zk-SNARK production. However, Snarkl is not capable of generating zk-SNARKs by itself -- it is only able to compile programs to a system of arithmetic constraints (e.g. an R1CS), or to solve for a witness for these constraints. It is possible to include both public and private input data to these computations, but Snarkl cannot e.g. create a trusted setup, construct proofs, or verify them.
For this reason we have written an integration with the arkworks framework called arkworks-bridge. Snarkl can serialize it's constraint and witness values to a JSON lines format which is compatible with arkworks-bridge
. You can use arkworks-bridge
as a CLI program or embed it in a larger rust program.
We provide an example application which uses arkworks-bridge
to generate a verifying contract on Ethereum for your Snarkl programs. It also shows how to construct and submit proofs to this verifier.
This repository is a fork/continuation of the original which is no longer actively developed. The original authors also wrote a paper describing the original implementation which you can find here. They did amazing work and deserve most of the credit for what's here.