Circuit Options
Options for the circuit command.
Usage
ach circuit <path> [options]
Input Values
| Flag | Description |
|---|---|
--inputs <vals> | Comma-separated key=value pairs (e.g., --inputs "a=6,b=7,c=42") |
--input-file <path> | TOML file with input values (arrays supported natively) |
Values are parsed as BN254 field elements. Supports decimal, hex (0xFF), and negative values. The two flags are mutually exclusive.
TOML input file
For circuits with array parameters, --input-file avoids the _N naming convention:
# inputs.toml
root = "7853200120375982..."
leaf = "1"
path = ["2", "3"]
indices = ["0", "1"]
ach circuit merkle.ach --input-file inputs.toml
TOML arrays expand to path_0, path_1, etc. internally. Both string ("42") and integer (42) values are accepted.
Backend Selection
| Flag | Description |
|---|---|
--backend <backend> | Constraint backend: r1cs (default) or plonkish |
R1CS backend (default)
Generates .r1cs and .wtns files compatible with snarkjs.
Plonkish backend
Generates Plonkish gates, lookups, and copy constraints. Verifies locally (no binary export yet).
Proof Generation
| Flag | Description |
|---|---|
--prove | Generate a cryptographic proof after compiling and verifying |
--solidity | Generate a Solidity verifier contract (R1CS/Groth16 only) |
Optimization
| Flag | Description |
|---|---|
--no-optimize | Skip SSA IR optimization passes (constant folding, DCE, boolean propagation) |
Examples
# R1CS output
ach circuit circuit.ach --inputs "x=42,y=7"
# Plonkish backend
ach circuit circuit.ach --backend plonkish --inputs "x=42"
# Generate Groth16 proof
ach circuit circuit.ach --inputs "x=42,y=7" --prove
# Generate Solidity verifier
ach circuit circuit.ach --inputs "x=42,y=7" --solidity
# Unoptimized compilation
ach circuit circuit.ach --inputs "x=42" --no-optimize
Output Files (R1CS)
| File | Description |
|---|---|
circuit.r1cs | R1CS constraint system (iden3 binary format v1) |
witness.wtns | Witness values (iden3 binary format v2) |
Both files are compatible with snarkjs:
snarkjs r1cs info circuit.r1cs
snarkjs wtns check circuit.r1cs witness.wtns