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 usedef. The default entry point is a function named main:
Variables and primitive types
Usevar for local bindings. Type annotations are optional when inference is clear.
- signed integers:
int8,int16,int32,int64 - unsigned integers:
uint8,uint16,uint32,uint64 boolstringShareand typed secret values such assecret int64list[T]Nonefor no-value returns
Control flow
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 = ....
ClientStore inputs
ClientStore reads external client input slots during local or network MPC execution.
.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:local_control_flowfor functions, loops, ranges, branching, and arithmetic.local_collectionsandlocal_nested_genericsfor lists and nested generic list shapes.mpc_share_arithmeticandmpc_boolean_circuitfor share arithmetic andsecret boolvalues.mpc_client_private_scoreandmpc_client_federated_averageforClientStoreinput slots and client-output patterns.