> ## 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.

# System Architecture

> Complete Stoffel system architecture showing how CLI, compiler, VM, SDKs, and MPC protocols interact.

This section provides an overview of the complete Stoffel system architecture and how the various components interact.

## Overall System Design

<img src="https://mintcdn.com/stoffellabs/WsJVEVCX73RSUEma/images/campaign/stoffel-how-it-works-architecture.png?fit=max&auto=format&n=WsJVEVCX73RSUEma&q=85&s=7cb8865dfce89c3a2b5018c005413c02" alt="Campaign-style Stoffel architecture diagram showing developer application code, build artifacts, coordinator-managed execution, VM parties, and authorized outputs." width="1800" height="1125" data-path="images/campaign/stoffel-how-it-works-architecture.png" />

The same `.stflb` artifact connects the application-facing build path to the runtime party mesh. App code prepares protected inputs, the coordinator manages lifecycle and IO routing, and VM parties compute over shares.

## Component Interactions

### Development Workflow

1. **Project Creation**: Stoffel CLI creates project structure with templates
2. **Code Writing**: Developers write StoffelLang programs with MPC primitives
3. **Compilation**: StoffelLang compiler generates optimized VM bytecode
4. **Testing**: Local VM execution for development and testing
5. **Deployment**: MPC network deployment with protocol integration

### Runtime Execution

1. **Program Loading**: Stoffel VM loads compiled bytecode
2. **Secret Sharing**: Input data is secret-shared across MPC nodes
3. **Secure Computation**: VM executes with MPC protocol integration
4. **Result Reconstruction**: Output is reconstructed from secret shares

## Data Flow

<img src="https://mintcdn.com/stoffellabs/WsJVEVCX73RSUEma/images/campaign/stoffel-networked-privacy-backend.png?fit=max&auto=format&n=WsJVEVCX73RSUEma&q=85&s=ce93340ce44de6b4039ac1c8a2a8bac4" alt="Campaign-style networked privacy backend diagram showing clients, coordinator, preprocessing, party mesh, and encrypted or authorized outputs." width="1800" height="1125" data-path="images/campaign/stoffel-networked-privacy-backend.png" />

### Clear Data Path

* Public inputs and configuration data
* Direct VM register operations
* No cryptographic overhead
* Immediate availability across all nodes

### Secret Data Path

* Private inputs requiring protection
* Automatic secret sharing on input
* MPC protocol operations during computation
* Selective reveal for output reconstruction

## Security Architecture

### Isolation Boundaries

* **Process Isolation**: Each MPC node runs in isolated environment
* **Memory Protection**: Clear and secret data separation
* **Network Security**: Encrypted communication between nodes
* **Access Control**: Role-based access to computation resources

### Trust Model

* **Honest Majority**: Assumes majority of nodes are honest
* **Semi-Honest Adversary**: Protects against passive attacks
* **Input Privacy**: Individual inputs remain private
* **Computation Privacy**: Intermediate values are protected

## Scalability Design

### Horizontal Scaling

* **Node Addition**: Dynamic addition of MPC nodes
* **Load Distribution**: Computation workload balancing
* **Geographic Distribution**: Global node deployment support

### Vertical Scaling

* **Resource Optimization**: Efficient CPU and memory usage
* **Parallel Execution**: Multi-threaded computation where possible
* **Caching Strategies**: Optimized data and computation caching

## Integration Points

### External Systems

* **Database Integration**: Secure querying of external databases
* **API Integration**: RESTful APIs for system interaction
* **Blockchain Integration**: Smart contract integration for verification

### Development Tools

* **IDE Support**: Language server protocol integration
* **Debugging Tools**: Comprehensive debugging and profiling
* **Testing Frameworks**: Specialized testing for MPC applications

This architecture enables secure, scalable, and developer-friendly multi-party computation while maintaining strong security guarantees.
