This is a small local example. Use the same modeling steps with your own deployment and security validation when moving beyond the tutorial.

What you will use
- The
stoffelCLI. - The Rust SDK from crates.io when you run or adapt the Rust wrapper path.
- A
Share-based StoffelLang program.
Create a project
Replace src/main.stfl
Use this simple Share-based program:
Share while it computes, then opens only the final eligibility score as the allowed tutorial output.
Validate and build
target/debug and use that path.
Run locally with a client input
Run the project through local MPC. This starts several MPC nodes/processes locally on your machine and feeds client slot0 with the private input value:
(42 + 25) * 2, not the raw client input.
Iterate in watch mode
--once.
Run the same idea from Rust
The Rust SDK is the primary application API for embedding Stoffel programs in Rust apps. Use the bytecode you already built fromsrc/main.stfl instead of embedding a second sample program in Rust. In this example, .execute_local().await? performs local MPC testing by spawning several MPC nodes/processes on your machine:
Shape the local harness like a participant client
This section is a trusted local development harness. The file handoff and.with_client_input(...) call below expose the fixture plaintext to the local harness process. They prove program behavior; they are not a production privacy architecture and must not be moved into an application backend.
For client-owned private input in a deployed app, separate these roles:
src/lib.rs:
src/app.rs for the ordinary application types:
src/bin/local_mpc.rs. This is the trusted local development harness: it loads the bytecode built from src/main.stfl, waits for fixture requests, sees the local fixture plaintext, and runs each score through local MPC. It must not be used as an application backend. Stop it with Ctrl-C when you are done.
src/client.rs. This file represents participant-owned client code: it accepts its owner’s request, sends the private score to the trusted local MPC harness, then combines the returned score with ordinary client-side fields. Do not expose EligibilityRequest.private_score as an application-service request schema.
src/bin/eligibility_client.rs as a command-line entry point for the client-handling code:
main.rs starts local MPC nodes and sees fixture plaintext on the same development machine. In a deployed setup, the participant-owned client would load pinned bindings and public deployment config, then submit directly to the separately deployed network. A separate application control plane may manage public metadata, session lifecycle, non-sensitive receipts, and authorized opened aggregates, but it must remain outside the plaintext path.
Want to deploy MPC apps instead of running local development networks? Sign up for Stoffel updates to hear when we launch the platform for deploying MPC apps.
Design notes
- Identify which input is secret-shared, which policy logic is public, and which computed result should be reconstructed.
- Keep sensitive values as
Sharevalues while computing. - Use
open()only for outputs you intentionally reveal. - For client-directed share outputs beyond this tutorial, prefer
MpcOutput.send_to_clientorShare.send_to_client. - Use
stoffel check --print-ir,stoffel run --program-info, and bytecode disassembly when debugging.