Circom Interop Overview
Reuse Circom templates and full circuits inside Achronyme programs and proofs.
Achronyme compiles .circom files through the same backend pipeline as its own .ach circuits. This means you can reuse battle-tested gadgets from circomlib — Poseidon, MiMC, EdDSA, BabyJubjub, Num2Bits, comparators — without rewriting them in Achronyme.
Why Circom Interop
Circom has the largest production ZK gadget library in the ecosystem. Rewriting every hash function, signature scheme, and bit decomposition in a new language would waste years of community review. Achronyme instead parses .circom source directly, lowers templates into the same ProveIR that powers prove {} blocks, and emits R1CS or Plonkish constraints through its native backend.
The practical outcome: you write high-level logic in Achronyme, call Poseidon(2) or EdDSAPoseidonVerifier() exactly the way you would in a .circom file, and the proof system does not know or care where each template came from.
Three Ways to Reach Circom Code
| Form | Syntax | When |
|---|---|---|
| Full circuit absorption | import circuit "./file.circom" | You have a complete Circom circuit (with a main component) and want to prove it directly. |
| Selective templates | import { Template } from "./lib.circom" | You want to call specific templates from a Circom library inside an Achronyme prove block or circuit. |
| Namespaced library | import "./lib.circom" as P | Same as selective, but with a namespace prefix (P::Template(...)) — useful when two libraries export colliding names. |
The first form replaces the entire Achronyme circuit with the Circom one. The other two forms bring Circom templates in as callable primitives inside Achronyme code.
Decision Tree
- Do you already have a working
.circomfile with amaincomponent and just want a proof? →import circuit, or runach circom file.circomdirectly. - Do you want to reuse Circom primitives (Poseidon, bit decomposition, signatures) inside Achronyme logic? → selective or namespaced import.
- Are you writing new gadget code from scratch? → stay in Achronyme; the Circom frontend is for reuse, not for writing new Circom.
Pipeline at a Glance
Both source languages converge on ProveIR before any optimization or backend work happens. Circom templates become regular circuit nodes that optimize, deduplicate, and prove alongside Achronyme-native code.
What You Get
- Circomlib primitives on tap:
Poseidon,MiMC,MiMCSponge,BabyAdd,BabyDbl,EscalarMulAny,EscalarMulFix,EdDSAPoseidonVerifier,Num2Bits,Bits2Num,LessThan,IsZero,CompConstant,Pedersen, and the mux/gates family. - Same prover backend: R1CS + Groth16 or Plonkish + halo2. Circom templates produce the same
.r1csand.wtnsartifacts as native Achronyme circuits, and the Solidity verifier generator works on both. - Native diagnostics: the Circom frontend reuses Achronyme’s rustc-style diagnostic renderer, with error codes, source spans, and “did you mean?” suggestions.
- Constraint parity (or better): Achronyme’s O1 pass plus compile-time constant propagation matches or beats circom 2.x O2 output — the most aggressive setting circom offers — on every benchmarked circomlib template. Num2Bits, LessThan, and MiMCSponge drop strictly below circom’s best; the rest tie. See Circuit Mode for the full table.
What Stays in Circom
Some Circom features are not supported yet and produce clear compile-time errors: bus, tag, custom_templates, and certain recursive function bodies. See Limitations and Roadmap for the full list and the planned work to close each gap.