| Crates.io | midnight-circuits |
| lib.rs | midnight-circuits |
| version | 6.0.0 |
| created_at | 2025-10-28 16:29:28.812376+00 |
| updated_at | 2025-12-19 16:15:02.633173+00 |
| description | Circuit and gadget implementations for Midnight zero-knowledge proofs |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1905138 |
| size | 1,992,999 |
Midnight Circuits is a library designed for implementing circuits with Halo2. It is built on the PSE v0.4.0 release of Halo2, incorporating a few minor additions required to support Midnight Circuits.
Disclaimer: This library has not been audited. Use it at your own risk.
Midnight Circuits provides several tools to facilitate circuit development with Halo2. These include:
We aim to expose these functionalities via traits, which can be found in [src/instructions].
We provide support for variable-length vectors in-circuit, even when the exact size of the vector is unknown
at compilation time. Each variable-length vector is parameterized with a MAX_LENGTH attribute, which
specifies the maximum allowed size.
The cost of using these structures in-circuit is proportional to the MAX_LENGTH, while the computed result
is guaranteed to correspond to the operation applied to the actual vector values. For example, operations
such as hashing or parsing are performed over the full vector of length MAX_LENGTH, and the final result
is conditionally selected to reflect the operation applied only to the actual elements of the vector.
Midnight Circuits provides low-level building blocks for constructing zero-knowledge circuits.
For a higher-level abstraction that simplifies circuit development, see the midnight-zk-stdlib
crate.
We use Semantic Versioning. To capture
the changes that do not affect the API, do not add any new functionality, but
are breaking changes, we increment the MAJOR version. This happens when the
circuit is modified for performance or bug fixes; the modification of the
verification keys break backwards compatibility.