Skip to main content

Fee Structure

TL;DRDarknyx charges a flat protocol fee in basis points (for example, 30 bps). Both sides of a trade pay their own fee. Each order pre-funds its fee as part of its collateral, and the fee is collected at settlement as a fee note minted to the protocol, so fees, like everything else, settle privately on-chain.

The fee model

Each side pays in the asset it contributes to the trade. In raw protocol units:
Two principles define how it is applied:
  • Both legs pay. The bid and the ask each pay a fee on their own side of the trade. There is no maker rebate or taker surcharge, because a batch auction has no maker/taker roles (see Clearing Price).
  • The fee is pre-funded. An order must reserve enough note value to cover both its nominal cost and its own fee. The required collateral is:
For a bid, the worst-case nominal quote cost is floor(amount × price_limit / price_scale); for an ask it is the base amount. The engine derives the applicable floor-rounded fee at intake. If an order’s collateral note does not cover both, the order is rejected rather than allowed to under-pay.
Collateral must include the feeRead the finalized market and vault configuration when selecting a collateral note. The order request carries the note’s actual amount; intake recomputes its commitment and rejects a note that cannot cover the worst-case nominal amount plus fee. Higher-level wallet software can automate that coin selection, but the wire-level SDK does not add value to an existing note.

How fees are collected

Fees are collected at settlement, in the same atomic, proven step as the rest of the trade. When a batch settles, the output notes include the protocol’s fee notes, one per asset side, minted alongside the traded asset and any change note. There is no separate fee transaction and no off-chain fee accounting: the fee moves as a note, on-chain, under the same zero-knowledge proof that gates the trade.
Because the fee is charged on the actual cleared amount, an order that locked fee-inclusive collateral on its worst-case limit and then fills at a better clearing price gets unused collateral back as part of its change note.

Fee-note privacy and recovery

Fee notes must be recoverable by the protocol without becoming a public clue to which deposited note traded. Their private inner value therefore incorporates a rotating fee epoch key together with the consumed note’s unlinkable use tag and the fee side. The settlement proof binds the key’s governed on-chain commitment and epoch without revealing the key itself. This prevents an observer from trying every plausible small fee amount and matching the resulting public fee commitment back to a historical input leaf. For durability, each verified batch also records a fixed-size encrypted fee recovery bundle. Historical epoch keys let the protocol reconstruct only the fee notes that actually settled on finalized chain; users do not manage these keys or bundles.

Worked example

Suppose the fee rate is 30 bps (0.30%) and you place a bid to buy 10 base at a limit of 150 quote each. Expressed here in human units for readability:
If the batch clears at 148, you pay 1480 for the fill, your fee is charged on the cleared amount, and the difference comes back to you as a change note, all in one settled, proven step. On-chain arithmetic uses smallest token units and the configured price_scale, with every division rounded down as shown above.

Why fees settle as notes

Collecting fees as on-chain notes keeps the whole system consistent: there is one value-movement mechanism (notes, gated by proofs), one place aggregate liabilities are visible (the public transparency reserves, which account for every mint including the protocol’s), and no privileged off-chain ledger. Individual fee amounts and their input lineage remain shielded while the proof still enforces the exact configured fee.