4 releases (2 breaking)

0.4.0 Nov 7, 2023
0.3.0 Oct 26, 2023
0.2.1 Aug 1, 2023
0.2.0 Jul 28, 2023

#966 in Rust patterns

Download history 81/week @ 2023-08-17 56/week @ 2023-08-24 258/week @ 2023-08-31 221/week @ 2023-09-07 565/week @ 2023-09-14 1005/week @ 2023-09-21 1200/week @ 2023-09-28 1239/week @ 2023-10-05 1697/week @ 2023-10-12 1559/week @ 2023-10-19 1406/week @ 2023-10-26 2280/week @ 2023-11-02 1417/week @ 2023-11-09 1981/week @ 2023-11-16 7238/week @ 2023-11-23 7540/week @ 2023-11-30

18,617 downloads per month
Used in 33 crates (6 directly)

MIT/Apache

155KB
3.5K SLoC

This crate exposes the main traits and core structures of the bellpepper library.


lib.rs:

bellpepper is a crate for building zk-SNARK circuits. It provides circuit traits and and primitive structures, as well as basic gadget implementations such as booleans and number abstractions.

Example circuit

Say we want to write a circuit that proves we know the preimage to some hash computed using SHA-256d (calling SHA-256 twice). The preimage must have a fixed length known in advance (because the circuit parameters will depend on it), but can otherwise have any value. We take the following strategy:

  • Witness each bit of the preimage.
  • Compute hash = SHA-256d(preimage) inside the circuit.
  • Expose hash as a public input using multiscalar packing.

Dependencies

~1–1.5MB
~33K SLoC