Stoffel CLI Overview
The Stoffel CLI is a comprehensive command-line interface that provides everything you need to develop, build, test, and run privacy-preserving applications using secure Multi-Party Computation (MPC).
Design Philosophy
The Stoffel CLI is designed with the following principles:
- Developer-Friendly: Intuitive commands that follow familiar patterns from tools like
cargoandnpm - Template-Driven: Project templates for different use cases and programming languages
- Integrated Workflow: Seamless integration between development, compilation, and execution
Core Commands
Project Management
# Initialize new projects
stoffel init my-project # Default StoffelLang project
stoffel init my-project --template python # Python SDK integration
stoffel init my-project --template rust # Rust SDK integration
stoffel init my-project --lib # Create a library project
stoffel init my-project --interactive # Interactive project setup
Compilation
# Compile StoffelLang programs
stoffel compile # Compile all files in src/
stoffel compile src/main.stfl # Compile specific file
stoffel compile --binary # Generate VM-compatible binaries (.stfb)
stoffel compile -O3 # Maximum optimization (levels 0-3)
stoffel compile --disassemble program.stfb # Disassemble bytecode
stoffel compile --print-ir # Print intermediate representation
Building
# Build entire project
stoffel build # Debug build
stoffel build --release # Release build with optimizations
stoffel build -O2 # Specific optimization level
Development
# Compile and run locally
stoffel dev # Default: 5 parties
stoffel dev --parties 7 # Custom party count
stoffel dev --field bn254 # Different cryptographic field
Execution
# Run compiled bytecode
stoffel run # Auto-discover in target/
stoffel run program.stfb # Run specific file
stoffel run --entry my_function # Custom entry point
Testing
# Run project tests
stoffel test # Discover and run all tests
stoffel test --test specific_test # Run specific test function
stoffel test --integration # Integration tests only
stoffel test --verbose # Detailed output
Available Templates
The CLI provides templates for different development scenarios:
Language-Specific Templates
| Template | Description | Status |
|---|---|---|
stoffel | Pure StoffelLang project (default) | ✅ Complete |
python | Python SDK integration with Poetry | ✅ Complete |
rust | Rust SDK integration | ✅ Complete |
typescript | TypeScript/Node.js integration | ⚠️ Skeleton (SDK pending) |
solidity-foundry | Solidity with Foundry framework | ✅ Complete |
solidity-hardhat | Solidity with Hardhat framework | ✅ Complete |
Template Usage
stoffel init my-app # Default stoffel template
stoffel init my-app --template python # Python project
stoffel init my-app --template rust # Rust project
stoffel init my-app --template solidity-foundry # Foundry project
stoffel init my-app --template solidity-hardhat # Hardhat project
Project Structure
Pure StoffelLang Project
my-mpc-project/
├── Stoffel.toml # Project configuration
├── src/ # StoffelLang source files
│ └── main.stfl # Main program entry point
├── tests/ # Test files
│ └── integration.stfl # Integration tests
└── README.md # Project documentation
Python Template Structure
my-python-project/
├── pyproject.toml # Poetry configuration
├── src/
│ └── my_python_project/
│ └── main.py # Python entry point
├── stoffel/ # Nested Stoffel project
│ ├── Stoffel.toml
│ └── src/
│ └── program.stfl # StoffelLang program
├── tests/
│ └── test_main.py # Python tests
└── README.md
Rust Template Structure
my-rust-project/
├── Cargo.toml # Rust project config
├── src/
│ └── main.rs # Rust entry point with SDK
├── stoffel/ # Nested Stoffel project
│ ├── Stoffel.toml
│ └── src/
│ └── program.stfl # StoffelLang program
└── README.md
Solidity Template Structure (Foundry)
my-solidity-project/
├── foundry.toml # Foundry configuration
├── src/
│ └── MyMPCApp.sol # Main contract
├── test/
│ └── MyMPCApp.t.sol # Foundry tests
├── script/
│ └── Deploy.s.sol # Deployment script
├── stoffel/ # Nested Stoffel project
│ ├── Stoffel.toml
│ └── src/
│ └── program.stfl
└── README.md
Configuration
Stoffel.toml
The main configuration file for Stoffel projects:
[package]
name = "my-secure-app"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
[mpc]
protocol = "honeybadger"
parties = 5
threshold = 1
field = "bls12-381"
[build]
optimization_level = 2
output_dir = "target"
MPC Configuration
The CLI supports configurable MPC parameters:
- Parties: Number of parties in the MPC computation (minimum 4 for HoneyBadger)
- Threshold: Maximum number of corrupted parties tolerated
- Constraint:
parties >= 3 * threshold + 1 - Cryptographic Fields: BLS12-381 (default), BN254, Secp256k1, Prime61
Valid Configurations
| Parties | Threshold | Valid? |
|---|---|---|
| 4 | 1 | ✅ (4 >= 4) |
| 5 | 1 | ✅ (5 >= 4) - default |
| 7 | 2 | ✅ (7 >= 7) |
| 3 | 1 | ❌ (3 < 4) |
Help System
The CLI provides comprehensive help for all commands:
stoffel --help # Main help
stoffel init --help # Command-specific help
stoffel compile --help # Compilation options
stoffel test --help # Testing options
Command Status
Implemented Commands
| Command | Description |
|---|---|
init | Project initialization with templates |
compile | StoffelLang compilation |
build | Build entire project |
dev | Development mode (compile + run) |
run | Execute compiled bytecode |
test | Test discovery and execution |
Planned Commands
| Command | Description |
|---|---|
deploy | Deployment to MPC networks |
add | Package dependency management |
update | Update dependencies |
publish | Publish packages to registry |
clean | Remove build artifacts |
Examples
Quick Start
# Create and run a simple MPC project
stoffel init hello-mpc
cd hello-mpc
stoffel dev
Rust SDK Integration
# Create Rust project with SDK
stoffel init secure-compute --template rust
cd secure-compute
cargo build
cargo run
Solidity Integration
# Create Solidity project with Foundry
stoffel init my-contract --template solidity-foundry
cd my-contract
forge build
forge test
Next Steps
- Project Management: Learn about creating and managing projects
- Development Workflow: Understand the development process
- Building and Deployment: Build and deploy your applications