CLI Reference
Lof ships with three binaries: lof for compiling .lof source files, lofit for Groth16 setup/proving/verification, and lof-witness-gen for producing witness calculators from IR artifacts. This page documents the commands, default outputs, and common options for each tool.
lof — language compiler
The lof CLI parses, type checks, and compiles .lof circuits. All commands require a file with the .lof extension.
lof <command> [options]
Commands
lof check
lof check path/to/circuit.lof [--verbose]
- Runs the parser and type checker without emitting artifacts.
--verboseprints the source, pipeline status, and additional diagnostics.- Fails if the file is missing a
proofblock or violates visibility/type rules.
lof compile
lof compile path/to/circuit.lof \
[--target {r1cs|wasm}] \
[--output <dir>] \
[--generate-templates] \
[--skip-wasm] \
[--verbose]
- Default target is
r1cs. Artifacts are copied intobuild/, with companion directoriesinputs/,keys/, andproofs/created alongside the source. --generate-templateswrites<name>_public.jsonand<name>_witness.jsonunderinputs/using the signal names from the compiled circuit.--outputoverrides the root directory used for the generated folders when targeting WebAssembly.--target wasmfirst compiles to R1CS, then reuseslofit package-webto create a browser-oriented bundle (keys, prover WASM, witness helpers). Use--skip-wasmto emit the source tree without runningwasm-pack.--verbosesurfaces pipeline stages and tracing output.
lof parse
lof parse path/to/circuit.lof [--pretty] [--verbose]
- Parses a
.loffile and prints the AST to stdout. --prettyformats the debug output with indentation.--verboseechoes the source and parsing stages before dumping the AST.
lof version
lof version
- Prints the current crate version (identical to
--version).
Generated filesystem layout
Running lof compile (target r1cs) produces:
build/<name>.r1cs— constraint systembuild/<name>.ir— intermediate representation (if IR generation is enabled)inputs/<name>_public.jsonandinputs/<name>_witness.json(when--generate-templatesis passed)- empty
keys/andproofs/directories ready forlofitlof compile --target wasmcreates a web package containingbuild/,keys/,inputs/,proofs/,witness/, andprover/folders plus integration examples.
lofit — proving toolkit
lofit consumes the artifacts emitted by lof to perform Groth16 setup, proof generation, verification, and web packaging. Unless otherwise specified, it infers file names from the base name of the supplied R1CS file and defaults to the build/, inputs/, keys/, and proofs/ directories produced earlier.
lofit <command> [options]
Commands
lofit setup
lofit setup --input build/circuit.r1cs \
[--proving-key keys/circuit_pk.bin] \
[--verification-key keys/circuit_vk.bin]
- Generates a Groth16 proving key and verification key.
- If paths are omitted, keys are written to
keys/<name>_pk.binandkeys/<name>_vk.bin.
lofit prove
lofit prove --input build/circuit.r1cs \
[--proving-key keys/circuit_pk.bin] \
[--public-inputs inputs/circuit_public.json] \
[--witness inputs/circuit_witness.json] \
[--output proofs/circuit_proof.bin]
- Reads the R1CS and proving key, loads public inputs from JSON, and derives the witness.
- If the witness JSON exists, partially supplied values are respected; otherwise the witness is derived from constraints alone.
- Writes the Groth16 proof to the selected
--outputpath (defaultproofs/<name>_proof.bin) and emitsfull_witness.jsonalongside the proof. - Set the environment variable
LOFIT_VERBOSE=1for constraint-level debug output.
lofit verify
lofit verify \
[--verification-key keys/circuit_vk.bin] \
[--proof proofs/circuit_proof.bin] \
[--public-inputs inputs/circuit_public.json] \
[--input build/circuit.r1cs]
- Validates a Groth16 proof against the verification key and public inputs.
- The optional
--inputflag helps infer the circuit base name when your files do not follow the default naming convention.
lofit package-web
lofit package-web --input build/circuit.r1cs \
[--output dist/circuit] \
[--skip-wasm]
- Produces a distributable directory containing R1CS, keys, JSON templates, a witness calculator, and a prover WASM bundle with JS/TS bindings.
--skip-wasmcopies the generated source tree without runningwasm-pack(useful when Rust→WASM toolchains are unavailable).- Invoked automatically by
lof compile --target wasm, but can be run independently for custom packaging workflows.
lofit version
lofit version
- Prints the current
lofitcrate version.
lof-witness-gen — witness calculator generator
lof-witness-gen converts an IR file (.ir) into both a Rust witness calculator and a WASM project scaffold.
lof-witness-gen path/to/circuit.ir [output_dir]
- When
output_diris omitted, files are placed next to the IR source. - Emits
<name>_witness.rs(Rust helper) and<name>_witness_wasm/(WASM project withCargo.tomlandsrc/lib.rs). - The generated README at the end of the command outlines next steps for building with
wasm-pack.
Typical workflow recap
- Compile:
lof compile circuits/mul.lof --generate-templates - Setup keys:
lofit setup --input circuits/build/mul.r1cs - Populate inputs: edit
circuits/inputs/mul_public.jsonandmul_witness.json - Generate proof:
lofit prove --input circuits/build/mul.r1cs - Verify proof:
lofit verify --input circuits/build/mul.r1cs - Package for the web (optional):
lofit package-web --input circuits/build/mul.r1csRefer back to the command sections above for optional flags and environment hooks.