Skip to main content
StoffelLang source files (.stfl) compile to portable Stoffel bytecode files (.stflb). The current compiler lives in crates/stoffel-lang; the primary user-facing entry points are the stoffel CLI and Rust SDK.

Pipeline

Compilation pipeline from StoffelLang source through parsing, type checking, lowering, optimization, and .stflb bytecode. The compiler validates .stfl source, lowers it to VM function metadata and instructions, then writes the .stflb artifact that the CLI, SDK, and VM can load.

Validate without writing bytecode

check reads project defaults from Stoffel.toml unless you pass a source path. MPC settings can be overridden:

Build a project

build writes bytecode under target/debug or target/release.

Compile a source file

When compiling one selected source file, use --output to choose the bytecode path.

Optimization flags

--optimize uses O2 unless --release selects O3. --release writes under target/release and uses O3 unless --opt-level is set.

Disassemble bytecode

Use disassembly to confirm generated functions, instructions, and metadata before debugging runtime behavior.

Run after compiling

For local MPC runs, use the CLI local MPC path and provide any required client-slot inputs:

Validate repository examples

The repository examples are runnable programs under crates/stoffel-lang/examples/. From the Stoffel repository root, compile the examples and run local-only examples through the VM with:
Compiled bytecode is written to examples/dist/. Use the runnable examples guide to choose examples by task.

Common errors

secret placement

Use secret inside type annotations for share values:
Do not use secret as a declaration modifier before def or var. The accepted form is var x: secret int64 = ..., not secret var x = ....

Secret control flow

Do not branch on secret values. Reveal/open only the output you intend to disclose, or keep values as Share / secret T and send them to a client output path.

See also