> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stoffelmpc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Create a Stoffel project, build bytecode, run local MPC, and understand the recommended development loop.

This guide gets you from a fresh install to a working Stoffel project. You will create a project, inspect its structure, build Stoffel bytecode, and run the program through local MPC on your machine.

<img src="https://mintcdn.com/stoffellabs/WsJVEVCX73RSUEma/images/diagrams/developer-loop.svg?fit=max&auto=format&n=WsJVEVCX73RSUEma&q=85&s=b6511eac9c7ed6e8c8a23b0f61eb0384" alt="Stoffel development loop from writing source through check, build, local MPC run, and Rust SDK integration." width="1200" height="675" data-path="images/diagrams/developer-loop.svg" />

## Copy-paste path

Use this block when you want the fastest verified default app, or when you are asking an AI coding agent to do the setup for you:

```bash theme={null}
curl -fsSL https://get.stoffelmpc.com | sh
export PATH="$HOME/.local/bin:$PATH"
stoffel --version
stoffel init hello-mpc
cd hello-mpc
stoffel status --verbose
stoffel check
stoffel build
stoffel run --timeout-secs 180
cargo build
cargo run
```

Success means the CLI creates the project, `stoffel check` validates `src/main.stfl`, `stoffel build` writes `.stflb` bytecode under `target/`, the local MPC run completes, and the Rust wrapper builds and runs. If any command fails, keep its exact output and use the troubleshooting section before changing the app.

## Create a Stoffel project

After installing the `stoffel` CLI, create and enter a new project:

```bash theme={null}
stoffel init hello-mpc
cd hello-mpc
```

The default template creates a Rust-backed Stoffel project:

```text theme={null}
hello-mpc/
├── Cargo.toml
├── README.md
├── Stoffel.toml
└── src/
    ├── main.rs
    ├── main.stfl
    └── stoffel_bindings.rs
```

There are four important files to start with:

* `src/main.stfl`: the StoffelLang program that compiles to `.stflb` bytecode.
* `Stoffel.toml`: package, build, and MPC topology settings such as `parties` and `threshold`.
* `src/main.rs`: a Rust SDK wrapper that calls the same Stoffel program from Rust application code.
* `src/stoffel_bindings.rs`: generated program metadata used by the Rust wrapper.

## Check and build

Validate the Stoffel source and project configuration:

```bash theme={null}
stoffel check
```

Expected output includes the checked source path and the functions found in the program:

```text theme={null}
Checked .../hello-mpc/src/main.stfl (...)
```

Build bytecode under `target/`:

```bash theme={null}
stoffel build
```

Expected output includes the generated `.stflb` file:

```text theme={null}
Built .../hello-mpc/target/debug/hello-mpc.stflb
Bytecode size: ... bytes
Optimization: O2 (enabled)
Profile: debug
```

Inspect the generated bytecode before running local MPC:

```bash theme={null}
stoffel compile --disassemble target/debug/hello-mpc.stflb
```

This prints the functions, inferred register classes, and instructions in the compiled program. If your project name produces a different bytecode file name, use the `.stflb` file that `stoffel build` wrote under `target/debug/`.

## Run local MPC during development

Run the generated example through local MPC:

```bash theme={null}
stoffel run
```

Local MPC testing runs the compiled program by spawning several MPC nodes/processes locally on your machine. The default project uses five parties with threshold one unless you override those settings.

For one-shot development runs, use `stoffel dev --once`:

```bash theme={null}
stoffel dev \
  --parties 5 \
  --threshold 1 \
  --once
```

For watch mode, remove `--once`:

```bash theme={null}
stoffel dev \
  --parties 5 \
  --threshold 1
```

`stoffel dev` watches `Stoffel.toml` and your source tree, rebuilds after changes, and reruns through local MPC.

<Note>
  Template programs can differ. Use the generated `README.md` and `src/main.stfl` to confirm whether the program expects named function inputs with `--input` or client share inputs with `--client-input`.
</Note>

## Run the Rust SDK wrapper

The default template also includes `src/main.rs`, a Rust application wrapper around the Stoffel program. It lets you call the same `src/main.stfl` program from Rust code instead of only from the CLI.

The generated wrapper currently:

* imports `stoffel::prelude::*`;
* loads `src/stoffel_bindings.rs` with `mod stoffel_bindings;`;
* creates an async `tokio` main function;
* references `stoffel_bindings::ProgramManifest`, the generated manifest for the compiled program shape;
* compiles `src/main.stfl` with `Stoffel::compile_file("src/main.stfl")?`;
* applies the local MPC topology with `.parties(5)` and `.threshold(1)`;
* runs the program with `.execute_local().await?`, which is for local testing where several MPC nodes are spawned locally on your machine;
* prints the first returned value.

Build and run the wrapper with Cargo:

```bash theme={null}
cargo build
cargo run
```

If you change the program's ClientStore input or output shape, regenerate or update the generated bindings before relying on the Rust wrapper.

## Edit the program

Open `src/main.stfl` and make a small change. Then rerun the fast check/build loop:

```bash theme={null}
stoffel check
stoffel build
```

When the program uses client-provided shares, pass local client inputs by slot:

```bash theme={null}
stoffel run \
  --client-input 0=42 \
  --parties 5 \
  --threshold 1
```

Use named inputs for programs that define ordinary function arguments:

```bash theme={null}
stoffel run --input a=40 --input b=2
```

## What the quick start covers

The core Stoffel development loop is:

1. Write the MPC program in `src/main.stfl`.
2. Run `stoffel check` for fast validation.
3. Run `stoffel build` to produce `.stflb` bytecode.
4. Run `stoffel run` or `stoffel dev` for local MPC development.
5. Use the Rust SDK wrapper when integrating the program into an application.

In local MPC execution:

* private values are modeled as shares;
* the program computes over shares instead of exposing raw inputs;
* outputs are reconstructed only where the program opens or sends them;
* several MPC nodes/processes run locally on your machine;
* party and threshold settings come from `Stoffel.toml`, SDK builder calls, or command-line flags.

## Recommended workflow

Use the fastest command that answers your current question:

| Goal                         | Command                                                      |
| ---------------------------- | ------------------------------------------------------------ |
| Validate source and settings | `stoffel check`                                              |
| Build bytecode               | `stoffel build`                                              |
| Inspect compiled bytecode    | `stoffel compile --disassemble target/debug/hello-mpc.stflb` |
| Run once through local MPC   | `stoffel dev --once`                                         |
| Iterate on an MPC program    | `stoffel dev`                                                |
| Build the Rust app wrapper   | `cargo build`                                                |
| Run the Rust app wrapper     | `cargo run`                                                  |

## Use with AI coding agents

If you want an AI coding agent to help build a Stoffel app, give it the Stoffel skills and live docs access before asking it to write code. See [Installation](./installation#install-stoffel-with-an-ai-coding-agent) for the copy-paste setup prompt, skills setup, and docs MCP setup.

Choose the skill based on the task:

| User task                                           | Start with                                                                         |
| --------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Create the first app and prove the toolchain works  | [Stoffel App Getting Started](/developer-skills/stoffel-app-getting-started)       |
| Build a custom private-computation app              | [Stoffel Full App Golden Path](/developer-skills/stoffel-full-app-golden-path)     |
| Write or modify `.stfl` source                      | [Stoffel-Lang App Programming](/developer-skills/stoffel-lang-app-programming)     |
| Use `ClientStore`, secret shares, or client outputs | [Stoffel Secret MPC Programming](/developer-skills/stoffel-secret-mpc-programming) |
| Integrate with Rust application code                | [Stoffel Rust App SDK](/developer-skills/stoffel-rust-app-sdk)                     |
| Run local MPC loops or debug local execution        | [Stoffel Local MPC Dev Loop](/developer-skills/stoffel-local-mpc-dev-loop)         |
| Prepare network or deployment handoff               | [Stoffel Deployment Runbook](/developer-skills/stoffel-deployment-runbook)         |

When reviewing agent work, ask for the exact command output from `stoffel check`, `stoffel build`, a local MPC run, and any Rust build/test command the agent changed. Do not accept a code-only answer for a runnable app task.

## Troubleshooting

### The program asks for inputs

Check the generated `README.md` and `src/main.stfl`:

* Use `--input NAME=VALUE` for ordinary named function inputs.
* Use `--client-input SLOT=VALUE` for programs that call `ClientStore.take_share`.

### I want the exact flags for my CLI version

Use command-specific help:

```bash theme={null}
stoffel run --help
stoffel dev --help
stoffel compile --help
```

## Next steps

* [Basic Usage](./basic-usage)
* [Your First MPC Project](./first-project)
* [Rust SDK Examples](../rust-sdk/examples)
