Circuit Options
ach circuit <path> [options]Input Values
Section titled “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
Section titled “TOML input file”For circuits with array parameters, --input-file avoids the _N naming convention:
root = "7853200120375982..."leaf = "1"path = ["2", "3"]indices = ["0", "1"]ach circuit merkle.ach --input-file inputs.tomlTOML arrays expand to path_0, path_1, etc. internally. Both string ("42") and integer (42) values are accepted.
Backend Selection
Section titled “Backend Selection”| Flag | Description |
|---|---|
--backend <backend> | Constraint backend: r1cs (default) or plonkish |
R1CS backend (default)
Section titled “R1CS backend (default)”Generates .r1cs and .wtns files compatible with snarkjs.
Plonkish backend
Section titled “Plonkish backend”Generates Plonkish gates, lookups, and copy constraints. Verifies locally (no binary export yet).
Proof Generation
Section titled “Proof Generation”| Flag | Description |
|---|---|
--prove | Generate a cryptographic proof after compiling and verifying |
--solidity | Generate a Solidity verifier contract (R1CS/Groth16 only) |
Optimization
Section titled “Optimization”| Flag | Description |
|---|---|
--no-optimize | Skip SSA IR optimization passes (constant folding, DCE, boolean propagation) |
Examples
Section titled “Examples”# R1CS outputach circuit circuit.ach --inputs "x=42,y=7"
# Plonkish backendach circuit circuit.ach --backend plonkish --inputs "x=42"
# Generate Groth16 proofach circuit circuit.ach --inputs "x=42,y=7" --prove
# Generate Solidity verifierach circuit circuit.ach --inputs "x=42,y=7" --solidity
# Unoptimized compilationach circuit circuit.ach --inputs "x=42" --no-optimizeOutput Files (R1CS)
Section titled “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.r1cssnarkjs wtns check circuit.r1cs witness.wtns