The Privacy Challenge
In a traditional exchange, the engine knows every user’s exact balance and position size. It can simply iterate through all users, checkEquity < Maintenance, and liquidate if true.
On Spectre, position details are encrypted and stored as commitments. The engine cannot “see” your position to check its health directly.
Position Health Proofs
To solve this, Spectre uses Zero-Knowledge Proofs (ZKPs) to verify solvency without revealing sensitive data.The Mechanism
Instead of the engine reading your data, the protocol requires a Position Health Proof. This is a cryptographic proof generated by a ZK-circuit that asserts:“I know a private position (Quantity, Collateral, Leverage) that corresponds to my on-chain commitment, and I attest that its Collateral is greater than or equal to the Maintenance Margin.”If this proof cannot be generated (because the position is actually underwater), or if the proof verification fails, the system knows the position is unhealthy.
Circuit Logic
Theposition_health circuit takes the following inputs:
- Public Inputs (Known to everyone):
- Current Mark Price
- Maintenance Rate (e.g., 5%)
- Max Allowed Leverage
- Private Inputs (Known only to the user/wallet):
- Position Quantity
- Collateral Amount
- Leverage used
Liquidation Process
- Trigger: Monitor services (or the Sequencer) track the public price feed.
- Health Check: When the price moves significantly against a position, the protocol essentially asks: “Is this position still healthy?”
- Proof Verification:
- Healthy: A valid proof is provided, confirming
Collateral >= Maintenance. The position remains open. - Unhealthy: If a valid proof cannot be generated (mathematically impossible if underwater), the check fails.
- Healthy: A valid proof is provided, confirming
- Action: The position is flagged for liquidation. The engine closes the position to protect the insurance fund and other traders.