Skip to main content
StoffelLang uses Python-like indentation, def functions, var bindings, static types, lists, and explicit MPC share APIs. Programs compile to .stflb bytecode and are run through the stoffel CLI or Rust SDK.

Comments

Functions and entry point

Functions use def. The default entry point is a function named main:
Select another entry point with the CLI when needed:

Variables and primitive types

Use var for local bindings. Type annotations are optional when inference is clear.
Common types:
  • signed integers: int8, int16, int32, int64
  • unsigned integers: uint8, uint16, uint32, uint64
  • bool
  • string
  • Share and typed secret values such as secret int64
  • list[T]
  • None for no-value returns

Control flow

Ranges and list iteration are supported:

Lists

Share and secret values

Share values represent private MPC values. You can also use the secret keyword in type annotations, such as secret int64, secret bool, or secret fix64, to declare typed share values. Keep sensitive values as shares while computing, then reveal, open, or send only the output you intend to disclose. secret is valid inside type annotations for parameters, returns, locals, list elements, and object fields. It is not a declaration modifier: use var x: secret int64 = ..., not secret var x = ....
For arithmetic, use normal operators when they fit the value shape:
The same operator style works for secret booleans and fixed-point values where the operation is supported:
You can still call share operations as methods or functions when you want a specific builtin:

ClientStore inputs

ClientStore reads external client input slots during local or network MPC execution.
Run locally with a client-slot input:
With the Rust SDK, pass the same slot input using .with_client_input(0, &[42_i64]).

Runtime metadata

Runnable examples for this page

Use the runnable examples guide for a guided path through the examples. For the syntax on this page, these examples are the most direct references:

Build and run

See also