🚀 Stoffel MPC Protocols
This repository provides a fully-asynchronous, robust collection of MPC (Multi-Party Computation) protocols designed to run inside the StoffelVM runtime and the StoffelNet networking layer. However, it can also be used independently.
The repository is designed as a general-purpose foundation for hosting multiple MPC protocol families that share common networking, preprocessing, and arithmetic components. This repository is intended to serve as a collection of MPC protocols, not a single fixed construction.
At present, HoneyBadgerMPC is the only fully integrated end-to-end MPC protocol. However, the architecture is deliberately modular so that additional MPC protocols can be added over time without rewriting core components.
Key design goals:
- Protocol-agnostic networking via the
Networktrait - Reusable common sub-protocols (rbc,secret sharing,etc)
- Shared arithmetic layers (field, fixed-point, integer)
- Explicit protocol routing via compact
SessionIds
HoneyBadgerMPC 🦡
It includes implementations for HoneyBadgerMPC like random sharing protocols, preprocessing, Beaver triples, fixed-point arithmetic, integer arithmetic, and robust reconstruction procedures.
The core engine is built around the HoneyBadgerMPCNode, which orchestrates all subprotocols using an asynchronous message-passing model.
✨ Features
Included Protocols
| Category | Protocol | Status |
|---|---|---|
| Preprocessing | Shamir Random Share (RanSha) | ✔ Implemented |
| Preprocessing | Double Sharing / Random Double Sharing (DouSha / RanDouSha) | ✔ Implemented |
| Preprocessing | Beaver Triple Generation | ✔ Implemented |
| Preprocessing | Random Bit / PRandBit / PRandInt | ✔ Implemented |
| Arithmetic | Secure Beaver Multiplication | ✔ Implemented |
| Arithmetic | Fixed-Point Mul / DivWithConst / Trunc | ✔ Implemented |
| I/O | Distributed Input / Output (via RBC) | ✔ Implemented |
| Reconstruction | Robust Interpolation | ✔ Implemented |
| Reconstruction | Batch Reconstruction | ✔ Implemented |
| Complete MPC | HoneyBadgerMPC Core | ✔ Implemented |
📦 Crate Structure
mod.rs exposes the following modules:
robust_interpolate/ # RS-based robust interpolation (HBMPC Fig.1)
batch_recon/ # Batch reconstruction (HBMPC Fig.2)
ran_dou_sha/ # Random double sharing (HBMPC Fig.3)
share_gen/ # Random share generation
double_share/ # Basic double-share generation
triple_gen/ # Beaver triple generator
fpmul/ # Fixed-point arithmetic protocols
input/, output/ # MPC I/O protocols via RBC
mul/ # Secure Beaver multiplication
preprocessing/ # Preprocessing store management
share_gen/ # Random Shamir share generation
All modules plug into:
HoneyBadgerMPCNode<F, R>
A node capable of:
- Running preprocessing (random shares, doubles, triples, PRandBit, PRandInt)
- Performing secure arithmetic operations
- Handling RBC-based input and output
- Routing messages using compact
SessionIdfields
⏱️ Offline Phase, Abort Semantics, and Timeouts
The offline (preprocessing) phase of HoneyBadgerMPC is intentionally designed to be non-robust. In line with the original HoneyBadgerMPC design, preprocessing protocols (e.g., random sharing, batch reconstruction, Beaver triple generation) are expected to abort on failure and be restarted by the caller until sufficient preprocessing material has been generated.
Typical failure conditions include:
- A node going offline
- Network message loss or delays
- RBC or subprotocols failing to terminate
⚠️ Important:
The preprocessing protocols do not internally enforce timeouts. If a required message or share never arrives, the protocol may wait indefinitely. As a result, timeout handling is the responsibility of the caller. Preprocessing should always be wrapped in external timeout logic, with retry or abort behavior defined by the application.
🏃 How to Run
Running MPC requires:
- Start
NHoneyBadgerMPCNode instances - Connect them with a StoffelNet‐compatible network (
Networktrait) - Spawn a processing loop for each node
- Send messages into the network
- Call MPC operations like multiplication, fixed-point division, etc.
▶ Minimal Example: Running a 4-Party Secure Multiplication
Replace FakeNetwork with any Network implementation (FakeNetwork, StoffelNet, etc.):
async
For more examples check out the tests.
🧪 Running Tests
Run everything:
Run a specific test:
See logs:
RUST_LOG=info
🔌 Running Preprocessing
let mut rng = from_entropy;
node.run_preprocessing.await?;
This generates:
- Random Shamir shares
- Double shares
- Random double shares
- Beaver triples
- PRandBit outputs
- PRandInt outputs
📚 Reference Papers
- HoneyBadgerMPC — https://eprint.iacr.org/2019/883
- Fixed-Point Secure Computation — https://ifca.ai/pub/fc10/31_47.pdf
Learn More
To learn more about what you can build with Stoffel, visit stoffelmpc.com