Skip to main content
Liquidations occur when a trader’s margin falls below the Maintenance Margin requirement. In Spectre’s private architecture, this process is unique because the specific details of a position (size, entry price, leverage) are cryptographically hidden.

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, check Equity < 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

The position_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
It then cryptographically verifies the following logic: CollateralQuantity×Mark Price×Maintenance RateScale\text{Collateral} \ge \frac{\text{Quantity} \times \text{Mark Price} \times \text{Maintenance Rate}}{\text{Scale}}

Liquidation Process

  1. Trigger: Monitor services (or the Sequencer) track the public price feed.
  2. Health Check: When the price moves significantly against a position, the protocol essentially asks: “Is this position still healthy?”
  3. 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.
  4. Action: The position is flagged for liquidation. The engine closes the position to protect the insurance fund and other traders.