OCaml DSL for verifiable computation
Top 62.7% on sourcepulse
Snarky is an OCaml library for writing R1CS SNARKs, enabling developers to express verifiable computations in a familiar functional programming style. It targets researchers and developers working with zero-knowledge proofs who need a high-level abstraction for constructing SNARK circuits. The primary benefit is the ability to write what appears to be normal OCaml code, which is then compiled into a verifiable computation.
How It Works
Snarky utilizes a monadic approach, specifically a Checked.t
monad, to represent computations whose execution can be certified by a SNARK. Values within this monad are "checked variables," and operations on them generate constraints for the SNARK. For instance, a mul
function takes two var
types and returns a Checked.t
computation that produces a var
representing their product, ensuring the SNARK verifies this multiplication. This design allows for a more intuitive and less error-prone way to build complex SNARK circuits compared to lower-level constraint system representations.
Quick Start & Requirements
scripts/depends.sh
opam pin add git@github.com:o1-labs/snarky.git
dune build
Highlighted Details
Checked.t
monad.Maintenance & Community
The project was a primary component of earlier versions of the Mina project. The README notes that a substantial amount of obsolete code exists, with only src/intf
and src/base
being exceptions for current use.
Licensing & Compatibility
The README does not explicitly state a license.
Limitations & Caveats
The code has not been thoroughly audited and should not be used in production systems. A significant portion of the repository contains obsolete code, with only specific modules (src/intf
, src/base
) being relevant for current use.
3 weeks ago
1+ week