Overview
MPC applications have unique security requirements beyond typical smart contracts. The security of the entire system depends on:- Access control - Who can trigger state transitions
- Input integrity - Ensuring inputs are properly masked and validated
- Round sequencing - Maintaining correct state machine flow
- Threshold configuration - Proper n/t settings for Byzantine fault tolerance
Access Control
Why onlyDesignatedParty Matters
The designated party role controls the MPC lifecycle. Unauthorized access could:
- Skip preprocessing, causing computation failures
- Prematurely end input collection, excluding legitimate clients
- Trigger computation with insufficient inputs
- Publish invalid outputs
Party Role Management
Designated Party Security
Threshold Configuration
The n >= 3t + 1 Rule
HoneyBadger MPC requiresn >= 3t + 1 for Byzantine fault tolerance:
A threshold of
t means the system tolerates up to t malicious or faulty parties. Higher thresholds require more parties but provide stronger security guarantees.Production Recommendations
Input Handling
Why Input Masking is Required
Raw inputs on-chain would be visible to everyone. Masking ensures privacy:Input Count Validation
Always validate sufficient inputs before computation:Replay Attack Prevention
Each input mask can only be used once:Round State Machine
Why Rounds Must Be Sequential
The round state machine ensures:- Preprocessing completes before inputs are collected
- All inputs are gathered before computation
- Computation finishes before outputs are published
The atRound Modifier
Always use atRound to enforce correct sequencing:
Common Round Pitfalls
Timeout Handling
For production systems, implement timeouts to handle stuck states:Common Vulnerabilities
1. Insufficient Input Validation
2. Missing Round Checks
3. Incorrect Threshold Configuration
4. Reentrancy in Input Submission
5. Missing Events for Critical Actions
Security Checklist
Before deploying your MPC contract, verify:Access Control
- All lifecycle methods have
onlyDesignatedPartymodifier - Party management functions validate threshold constraints
- Designated party key is secured (hardware wallet/multi-sig)
Input Handling
- Input masks are initialized in preprocessing
- Index reservations are validated before submission
- Used indices are invalidated after submission
- Minimum input count is enforced before computation
Round Management
- All state-changing functions use
atRoundmodifier -
_nextRound()is called exactly once per lifecycle method - Timeout mechanisms exist for stuck states
General
- Threshold configuration satisfies
n >= 3t + 1 - Critical events are emitted for monitoring
- Checks-Effects-Interactions pattern is followed
- Contract has been tested with edge cases
Next Steps
- Template Guide - Step-by-step implementation
- StoffelCoordinator - Full API reference
- Access Control - Role management details
- Input Manager - Input handling details