A Haskell library for building ZK programs
- High level expression language DSL for writing ZK programs
- Low level arithmetic circuit DSL
- Efficient constraint solver for arbitrary circuits
- Binary codecs for core types (R1CS, witness, etc) which are compatible with the Circom toolchain
- Witness generator which is WASM compatible with Circom witness generator binaries
- A CLI to manage compilation, solving, witness verification, etc
- There are examples in
language/test
directory. See the sudoku verifier for the most complete example. - There is an example for how to setup up a client side (in-browser) prover here.
- There is an example which uses the nova folding scheme here.
Circom is a language/compiler which has been widely adopted by developers building ZK programs. As such, many proving frameworks (e.g. arkworks, snarkjs, nova) have integrations with Circom that expect a certain binary serialization format for the r1cs and witness data. The Circom compiler also emits a witness calculator in the form of a WASM binary, which is meant to be embedded in a host environment (e.g. the browser, a rust program, etc). In the circom-compat
library in this repo, we give the scaffolding that you need in order to produce this binary via GHC's WASM backend. You can see an example of how to use it here
This work started as a fork from the original arithmetic-circuits library which is no longer developed. Since there is currently no hope for merging changes upstream and GitHub forks have limited PM functionality, this repo has been severed. All good ideas surrounding the low-level circuit DSL come from those effors, and the supporting libs created by those original authors (e.g. galois-fields lib) are heavily used. You can find their original README in the docs
folder. Much credit goes to them, in the event they revive the original libraries then PRs will be made.