Skip to main content
The clearing engines run as cold services inside TEEs that replicate every state change without a blockchain and without a vote. This page covers how state changes are ordered, finalized, and recovered after failure.

Proposals and slots

Hot services (the OMS and orderbooks) only propose state changes; they cannot change the ledger. Ordering and signing run in a protocol called the Slot Machine:
  1. Hot services propose state changes — matched fills, deposits, withdrawals, settlements.
  2. The leader clearing engine puts the proposals in order, applies each one, and replicates them to the followers one at a time.
  3. The followers apply the same state changes in the same order, so they hold the same state as the leader.
  4. A slot is the run of state changes between two checkpoints. At each checkpoint, every clearing engine signs the withdrawal approvals queued during that slot. The deposit contract executes withdrawals only if the number of attested node signatures authorizing it exceeds the configured withdrawal quorum.
There is no vote and no confirmation wait: the leader alone decides the order and commits each state change at once. One clearing engine is the leader; the followers replicate it and do not produce a competing order.

When a fill is finalized

A state change is visible before it is finalized. The stages a fill passes through are listed in the trust model: an orderbook match is a confirmed fill (instant, not yet validated by the clearing engine; trade streams report it as Confirmed), the leader clearing engine’s validation makes it a finalized fill (Finalized on trade streams), and a later checkpoint is the durable recovery point. Settlement approvals are signed as soon as the clearing engine accepts the settlement request. During a freeze, trading and new checkpoints pause for a migration. Eligible withdrawals can still be approved immediately and signed against the last checkpoint. A confirmed fill is provisional, but the clearing engine finalizes the vast majority of fills unchanged, so a confirmed fill can be acted on for most purposes. At finalization the clearing engine re-checks every party’s margin. If a maker fails validation, the other makers’ valid matches can still finalize. If the taker fails, the whole match reverts. Fill-or-kill orders are the exception: they are finalized all-or-nothing across the batch. A settlement is atomic on the same principle: either the incoming asset is credited or the lock expires and the outgoing funds are restored, never both. Replication between the leader and its followers is asynchronous — chosen for latency over durability. An acknowledgment means the leader processed your request, not that it is durably replicated; a leader crash in that window can drop the unreplicated tail (see Recovery).

Checkpoints

The clearing engines run entirely in encrypted memory, so they periodically write critical state (balances, inventories) to a checkpoint: encrypted with a key that is split into decryption shares, one per member of the operator committee, and signed by the clearing engine that wrote it. A fresh clearing engine needs the threshold of shares recorded for that checkpoint. For a newly written checkpoint, that threshold is at least two. A checkpoint is the point the system restarts from after a total outage.

Recovery

Automatic leader election is planned; today the operator committee names the leader and supplies the decryption shares for a restart, at the committee threshold.

What a restart recovers

A checkpoint captures finalized balances and inventories plus the per-chain deposit, withdrawal, and settlement nonces, as of one finalized slot. A restart loads it and resumes from the next slot; the window between the checkpoint and the outage is rebuilt by source.
  • Onchain events — deposits, withdrawals, and settlements are anchored onchain, so they outlive the outage. They are re-ingested from the chain on top of the checkpoint, and its per-chain nonces apply each exactly once: anything already in the checkpoint is skipped as a duplicate, anything that landed after it is applied. Nothing is double-credited or missed.
  • Offchain state changes — the action log is replayed forward from the checkpoint as far as it was durably captured. This is where the unreplicated-tail risk above applies: a fill or order acknowledged but not yet replicated when the outage hit can be absent after restart. Orderbooks recover from retained state or an encrypted market snapshot and replay their own logs. Check recovered trades and open order quantities before resubmitting any missing orders.
The checkpoint protects the balances it contains. Later offchain activity, including an acknowledged fill, can be absent if it falls beyond the recovered sequence.

How it compares

The slot machine trades cryptographic guarantees for performance and privacy relative to public chains and rollups. The trust model is the explicit tradeoff: hardware integrity plus node-quorum signing is weaker than a validity proof, in exchange for arbitrary offchain compute — portfolio margining does not fit in a ZK circuit — at low latency. Asynchronous ZK proofs and economic security (operator staking/slashing) are planned additions on top, verifying execution after the fact, off the hot path. See what TEEs do not solve.