Skip to content

Circuit Options

Terminal window
ach circuit <path> [options]
FlagDescription
--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.

For circuits with array parameters, --input-file avoids the _N naming convention:

inputs.toml
root = "7853200120375982..."
leaf = "1"
path = ["2", "3"]
indices = ["0", "1"]
Terminal window
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.

FlagDescription
--backend <backend>Constraint backend: r1cs (default) or plonkish

Generates .r1cs and .wtns files compatible with snarkjs.

Generates Plonkish gates, lookups, and copy constraints. Verifies locally (no binary export yet).

FlagDescription
--proveGenerate a cryptographic proof after compiling and verifying
--solidityGenerate a Solidity verifier contract (R1CS/Groth16 only)
FlagDescription
--no-optimizeSkip SSA IR optimization passes (constant folding, DCE, boolean propagation)
Terminal window
# 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
FileDescription
circuit.r1csR1CS constraint system (iden3 binary format v1)
witness.wtnsWitness values (iden3 binary format v2)

Both files are compatible with snarkjs:

Terminal window
snarkjs r1cs info circuit.r1cs
snarkjs wtns check circuit.r1cs witness.wtns