Skip to content

Threat model

Generated · Rendered from docs/threat-model.md, last changed 27 November 2026.

Draft v0.1 — 11 November 2026 — for review before publication (security-hardening §3). Who sees what in a Fondaco swap, what each party can do with it, and what stops the things that should not happen. It describes the current version on Preprod; where mainnet will differ, it says so.

A swap involves a user's wallet (or an app built on the wallet SDK), the relay, the solvers that quote, the winning solver or the matcher, the Midnight chain, and the edge in front of the relay. The relay never holds funds: a solver settles from its own coins and the wallet signs its own side. Privacy on Midnight is a property of each leg: a shielded token's leg hides amount, coins and the link to the user; an unshielded token's leg (NIGHT) shows the address and the amount. The user's privacy level (privacy-levels.md) constrains the user's legs only; it does not change what the relay or a solver sees.

Party Sees Does not see
Anyone reading the chain Every unshielded output and input: for a NIGHT leg, the user's NIGHT address and amount, and the solver's NIGHT input. The DUST fee paid. That a transaction happened, its nullifiers and commitments. An MIP-0006 open order's imbalances (amounts and token types, not identities) Shielded amounts, coins and change; the fee amounts and recipients; which shielded inputs belong to whom
The relay (Fondaco) The request: pair, size, privacy level, app key, the user's IP and country as the edge reports them. Every quote. For user_offer, the offer bytes; for solver_offer, the solver's leg. The user's receiver address. Fee-output openings (token, value, recipient). Fill status and the transaction id The user's keys; the user's shielded balance; any link between the shielded inputs and a person beyond what the request itself carries; a compliant disclosure record (stored encrypted, unreadable to the relay)
A solver that quotes The pair and the size of each request it is sent, and the privacy level; whether its own quote won Who asked; the user's IP; other solvers' quotes before the release; the user's address, unless it wins
The winning solver The accepted terms and the user's receiver address; the user's offer bytes (user_offer) or its own leg and the merged transaction (solver_offer) The user's keys and other coins; the user's IP
The matcher The resting offers on the book and the requests it crosses against them As a solver
The wallet or app that brought the trade Everything about its own user's trade, and its statement of fills and fees Other apps' flow
The edge provider IP, country, request paths, and — where TLS terminates at the edge — request and response bodies Anything the relay itself does not see
Party Could try to What stops it
A solver Quote and then not deliver (a fade) The quote is signed and binds until it expires. A fade costs 50 bps of the notional from the solver's bond (5–500 USDM); fulfilment under 95% over 7 days suspends (solver-programme.md)
A solver Deliver a leg that pays the user less, or drops the fee outputs The wallet SDK checks the leg against the quote before the wallet signs; the relay verifies every leg and its fee openings before passing it on, and finds the fee commitments in the finalized transaction. A fee breach costs the penalty cap and suspends
A solver Alter the user's offer An offer file is proven; any change invalidates it. The ledger settles both legs together or neither
A user or anyone Post the same coins in many offers The book takes one offer per input; the second post is refused, on any relay node
The relay Tell a wallet a worse quote was the best, or dispatch a job the solver did not agree to The attestation commits to every quote by digest and is signed with the relay key the SDKs pin; each firm quote carries its solver's signature; solvers check every accept and job against their own quotes
The relay Move user or solver funds It holds none and signs no transaction that spends them
The relay Read shielded amounts or link shielded inputs to a person Zswap's proofs: the relay sees the same public view as the chain, plus what the request itself states
An attacker who steals the relay signing key Forge attestations and job dispatches until the key is rotated Rotation with an overlap window; the key-management decision moves it into a KMS (m1/key-management.md). It still cannot move funds
An attacker who steals a solver's wallet seed Spend that solver's inventory Hot inventory is capped; the rest is held cold (m1/key-management.md). Users' funds are not exposed
An attacker with the relay database Read requests, fills, quote snapshots, receiver addresses of unshielded legs, fee records and statements; try to rewrite the record No keys or seeds are stored there; solver bearer tokens are stored only as hashes; the audit log is hash-chained, so a rewrite shows. Database traffic is TLS-verified outside the devnet
Someone forging a location Reach the service from a declined country The edge strips any incoming country header and sets its own; the relay trusts the header only from configured proxies, and with the location rule on, declines a request that has none
A flood of requests Exhaust the relay Per-IP rate limits at the edge and in the relay, per-IP connection caps, a cap on quote frames per solver, and kill switches the on-call can reach in under a minute
One region failing Settle a fill twice or lose one Only the home region writes money-moving state, under a lease; a home that loses the lease stops its fills; a fill is rebuilt from its record after a failover
  • The NIGHT leg is public. Until a shielded form of NIGHT is listed, a buy or sell of NIGHT shows the user's NIGHT address and amount on any explorer. The swap says so before the wallet signs.
  • The relay sees the request. Pair, size, the user's receiver and their IP reach the relay. It keeps request logs for 30 days and fills for as long as the law requires (legal-pages §1).
  • A quote can go stale. A user offer is all-or-nothing and binds until its expiry; it can be cancelled before then only by spending one of its inputs.
  • The winning solver learns the counterparty's receiver. It needs it to pay out.
  • Bridged assets carry their bridge's assumptions. No bridged asset is listed today. Before one is (Nightmode's vault assets, the Cardano rails' tokens), this document will state who holds the bridge's keys and what happens if they misbehave.
  • The key-management option for the relay key (m1/key-management.md §5 recommends a KMS).
  • The edge provider and where TLS terminates, which decides whether the provider sees bodies.
  • Ledger viewing keys (Foundation roadmap, Q1 2027), which will move compliant disclosure on chain.
  • Counsel's review of the data list on the privacy page.