Chiquito is a high-level DSL that provides syntax sugar and abstraction for constraint building and column placement when writing Halo2 circuits. It allows the user to manipulate an AST that’s compiled to a Chiquito Halo2 backend, which can be integrated into any Halo2 circuit.
It's HIGHLY RECOMMENDED that you read the design principles, architecture, and specific terms of a Chiquito circuit before getting started.
You can also learn about the project's current status) and its next steps.
Run the following in command line to add Chiquito as a dependency for your project:
cargo add --git https://github.com/privacy-scaling-explorations/chiquito
Use the following examples to understand how Chiquito works or use them as starting templates for building your own Chiquito circuit.
Refer to the Appendix on the exposed user functions and overall workflow of a Chiquito circuit.
Refer to Testing and Links on detailed API documentations.
Run the following in command line:
cargo run --example fibonacci
This example demonstrates how to construct signals, step types, constraints, and witness generation in Chiquito. Best for first time Chiquito users.
TODO: annotate this code example
This example demonstrates how to construct a lookup table and use external inputs as trace arguments in Chiquito, besides covering concepts in the Fibonacci example. MiMC7 is a zk-friendly hashing function.
privacy-scaling-explorations/zkevm-circuits#1348
This example rewrites the zkEVM bytecode circuit using Chiquito and passes all original tests. It demonstrates how Chiquito can standardize and simplify larger scale circuits on the production level.
API documentation: cargo doc --no-deps --package chiquito --open
Currently API documentation is only written for exposed user functions, which are scattered across the DSL, constraint builder, compiler, and AST. Refer to the following subdirectories for specific functions:
- Circuit building (DSL): https://qwang98.github.io/chiquito/chiquito/dsl/index.html
- Constraint building (constraint builder): https://qwang98.github.io/chiquito/chiquito/dsl/cb/index.html
- Witness generation (compiler): https://qwang98.github.io/chiquito/chiquito/compiler/trait.WitnessGenContext.html
- Fixed column generation (compiler): https://qwang98.github.io/chiquito/chiquito/compiler/trait.FixedGenContext.html
- Invoking the next instance of a forward signal (AST): https://qwang98.github.io/chiquito/chiquito/ast/expr/query/enum.Queriable.html#method.next
MIT OR Apache-2.0