crates/stoffel-lang/examples/. Use them to learn the language, read client-provided private inputs, compose MPC primitives, and adapt private workflows into your own app.
Recommended path
If you are new to StoffelLang, start with these examples in order:local_control_flow— learn functions, loops, ranges, branching, and arithmetic.local_collections— work with lists, indexing, appending, and length checks.mpc_client_private_score— read a client-provided private input and return an output share.mpc_secure_comparison— study a reusable MPC primitive that reveals only a comparison bit.mpc_histogramormpc_first_price_auction— see how primitives become app-shaped private workflows.
Run the examples
Clone the Stoffel repository and validate the examples from the repository root:examples/dist/. A failure usually means the local CLI/compiler checkout is out of sync or the example needs a specific input shape from its README.
Run a clear language example
Start with a clear example when you want the lowest-friction check:Run a client-input MPC example
Read each example README before running MPC examples, because client slots and input values are example-specific. Formpc_client_private_score:
Choose by job
Reuse MPC building blocks
These examples are useful when you need source-level patterns for a private computation boundary:
When adapting these examples, copy the computation pattern, not the whole directory structure. Keep private inputs at
ClientStore, keep intermediate values secret, and make reveal or client-output points explicit.
Study larger workflows
Use these after you understand the smaller building blocks:
Ordinary app logic should stay in the host application. The StoffelLang program should contain the private computation, the client input reads, and the explicit reveal or client-output boundary. Use the Rust SDK examples when you are ready to embed a StoffelLang program in application code.
Coverage matrix
For complete language and builtin coverage, readcrates/stoffel-lang/examples/COVERAGE.md. The matrix maps syntax, runtime semantics, ClientStore APIs, Share APIs, MPC metadata, crypto builtins, AVSS helpers, and RBC helpers to specific examples.