snarky  by o1-labs

OCaml DSL for verifiable computation

created 7 years ago
503 stars

Top 62.7% on sourcepulse

GitHubView on GitHub
Project Summary

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

  • Install libsnark dependencies: scripts/depends.sh
  • Install opam.
  • Install snarky: opam pin add git@github.com:o1-labs/snarky.git
  • Build: dune build
  • Requires OCaml and opam.

Highlighted Details

  • OCaml front-end for R1CS SNARKs.
  • Modular design with backends (e.g., libsnark).
  • Example implementation for Merkle tree verification within the 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.

Health Check
Last commit

3 weeks ago

Responsiveness

1+ week

Pull Requests (30d)
6
Issues (30d)
1
Star History
4 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.