(Cir)cuit (C)ompiler. Compiling high-level languages to circuits for SMT, zero-knowledge proofs, and more.
Rust
317
271 commits
updated Jan 27, 2026
CirC is a compiler infrastructure which supports compilation from high-level (stateful, uniform) languages to (state-free, non-uniform, existentially quantified) circuits.
It's been used to compile {C, ZoKrates} to {SMT, ILP, R1CS, MPC}, but it probably also applies to any statically type high-level language and constant-time/FHE.
If you want to learn more about CirC, see our paper or slides.
This is the second implementation of CirC. The first was done in Haskell and can be found here.
Developing CirC requires the CVC4 SMT solver, which is used in some tests. Its
binary must be on your path. On Arch Linux and Ubuntu you can install the
cvc4 package from official repositories.
You'll also need the COIN-OR CBC solver. On Arch linux, this is coin-or-cbc.
On Ubuntu coinor-cbc and coinor-libcbc-dev.
You'll also need a stable Rust compiler.
For an example of doing ZKP compilation, look here.
src/ir
term/bv.rs: bit-vec literalsterm/field.rs: prime-field literalsterm/ty.rs: type-checkingterm/extras.rs: algorithms: substitutions, etc.opt/cfold.rs: constant foldingopt/flat.rs: n-ary flatteningopt/inline.rs: inliningopt/sha.rs: replacements for SHA's CH and MAJ operationsopt/tuple.rs: eliminating tuplesopt/mem/obliv.rs: oblivious array eliminationopt/mem/lin.rs: linear-scan array eliminationopt/mem/visit.rs: utility for visiting (and replacing?) all
array-related termssrc/target
src/circify
mem: the stack memory modulemod: the main Circify interfacesrc/front
zokrates: the ZoKrates front-endsrc/util
examples/circ.rs
The SMT backend can be changed between CVC4
and cvc5 by setting the
RSMT2_CVC4_CMD
environmental variable to the SMT solver's invocation command (cvc4 or
cvc5).
Rust
95.8%
Shell
2.1%
Python
2.0%
(Cir)cuit (C)ompiler. Compiling high-level languages to circuits for SMT, zero-knowledge proofs, and more.
Rust
317
271 commits
updated Jan 27, 2026
CirC is a compiler infrastructure which supports compilation from high-level (stateful, uniform) languages to (state-free, non-uniform, existentially quantified) circuits.
It's been used to compile {C, ZoKrates} to {SMT, ILP, R1CS, MPC}, but it probably also applies to any statically type high-level language and constant-time/FHE.
If you want to learn more about CirC, see our paper or slides.
This is the second implementation of CirC. The first was done in Haskell and can be found here.
Developing CirC requires the CVC4 SMT solver, which is used in some tests. Its
binary must be on your path. On Arch Linux and Ubuntu you can install the
cvc4 package from official repositories.
You'll also need the COIN-OR CBC solver. On Arch linux, this is coin-or-cbc.
On Ubuntu coinor-cbc and coinor-libcbc-dev.
You'll also need a stable Rust compiler.
For an example of doing ZKP compilation, look here.
src/ir
term/bv.rs: bit-vec literalsterm/field.rs: prime-field literalsterm/ty.rs: type-checkingterm/extras.rs: algorithms: substitutions, etc.opt/cfold.rs: constant foldingopt/flat.rs: n-ary flatteningopt/inline.rs: inliningopt/sha.rs: replacements for SHA's CH and MAJ operationsopt/tuple.rs: eliminating tuplesopt/mem/obliv.rs: oblivious array eliminationopt/mem/lin.rs: linear-scan array eliminationopt/mem/visit.rs: utility for visiting (and replacing?) all
array-related termssrc/target
src/circify
mem: the stack memory modulemod: the main Circify interfacesrc/front
zokrates: the ZoKrates front-endsrc/util
examples/circ.rs
The SMT backend can be changed between CVC4
and cvc5 by setting the
RSMT2_CVC4_CMD
environmental variable to the SMT solver's invocation command (cvc4 or
cvc5).
Rust
95.8%
Shell
2.1%
Python
2.0%