chordDocs

Protocol

Clearing and selection

How solvers quote a batch and how the winning quote is chosen.

When a batch’s collection window closes, its orders are fixed. Solvers then have the solve window to quote. Each quote names one price and the fills it implies; the collector validates every quote and keeps the one that leaves traders the most surplus.

#What a quote contains

FieldMeaning
PricepriceNumerator / priceDenominator, raw B per raw A, the same for every fill
FillsFor each included order: its id, the amount sold and the amount bought
ReservesThe A and B the solver will deposit at commit to cover every output
SurplusThe quote’s score, computed as below
PolicyA label naming how the quote was produced

The quote is signed by the solver’s key and bound to Chord’s program, config and chain. The exact format is on Submitting a quote.

#Validation

The collector rejects a quote unless every one of these holds:

  • it arrives during the solve window, from a registered solver with an unlocked bond;
  • every fill names an order that is open in this batch, at most once;
  • every fill pays exactly floor(sell × price) and meets that order’s minimum;
  • orders that don’t allow partial fills are filled completely or not at all;
  • the reserves cover every output the quote owes, rounded up;
  • the solver’s funding accounts hold those reserves.

#Surplus

An order’s surplus is what it receives above its proportional minimum. To add surpluses in A and B together, the collector values both in B at the market’s fixed reference price:

Text
surplus = Σ (B received − B minimum) × ref.denominator
        + Σ (A received − A minimum) × ref.numerator

Scaling by the reference fraction keeps the comparison exact: no floating point, and no rounding between two quotes. The highest surplus wins. A tie goes to the quote with the lower candidate digest, so the choice is deterministic.

#The reference solver

Chord runs a reference solver so every batch gets at least one quote. For each candidate price, every order’s limit and the reference price, it:

  1. finds the best set of whole orders on each side, exhaustively when 18 or fewer are eligible and by surplus density above that;
  2. tries to add partial fills of the remaining orders within the inventory it has left;
  3. scores the result, and keeps the best price.

This is a reproducible policy, not a proof of the best possible auction. Any registered solver can submit a better quote, and the better quote wins.

#Why one price

Every fill using the same price means the batch can’t favour one trader over another, and the order of signatures inside the window doesn’t matter. It also means opposite orders can fill each other directly: at one price, a buy and a sell are two halves of the same trade.