DIM · Dagon Inference Marketplace

Settlement and redemption

Settlement is how a seller gets paid. Anyone can submit the newest voucher for a channel to the Solana program with redeem. The program checks the session key's signature, then pays out the voucher's settled_total minus what the channel has already paid: to the seller's payout account, less the channel's protocol fee if it has one. It never pays twice and never pays past the channel's budget.

The redemption rule

if settled_total > redeemed:  delta = settled_total − redeemed
                              fee = floor(delta × fee_bps / 10,000)
                              pay (delta − fee) to seller_payout_token and fee to fee_recipient
                              redeemed = settled_total
else:                         succeed and pay nothing
  • Idempotent. A voucher at or below redeemed is a successful no-op, so a relay can retry safely.
  • Bounded. settled_total ≤ budget is enforced. A channel can never pay out more than was locked in it.
  • Only the newest matters. Totals are cumulative, so redeeming the latest voucher collects everything owed so far.
  • Only before the deadline. redeem requires now < D, the channel's close deadline. Once closing has begun, the seller has the grace period to redeem.

Who can redeem

redeem is permissionless. The instruction immediately before it in the same transaction must be Solana's Ed25519 signature check over the exact 168 voucher bytes and the channel's session key. Whoever submits the transaction pays only its fee; the money always goes to the payout account, and any protocol fee to the fee recipient, both fixed when the channel was opened. In practice the seller's gateway batches redemptions through its settler.

What happens to the money

Step Vault free Vault reserved Seller
Open a 2 USDC channel −2.000000 +2.000000
Redeem a voucher for 0.002233 −0.002233 +0.002233
Finalize after the deadline +1.997767 −1.997767

Under a Mandate, redemption also moves the paid amount, fee included, from the Mandate's reserved to its spent total.

The table has no protocol fee, which is the case on devnet today. At fee_bps = 100 (1%) the same redemption would pay the seller 0.002211 and the fee recipient 0.000022; the vault columns do not change.

The protocol fee

The program source can take a protocol fee from each redemption. Each channel fixes its rate, fee_bps, and the fee_recipient token account when it opens:

  • The rate is the fee authority's per-seller override for the channel's seller_settler if one exists, otherwise the protocol's default_fee_bps, and 0 while no fee config has been created.
  • It is at most MAX_FEE_BPS, 1,000 basis points (10%), a limit compiled into the program.
  • A later change to the fee config or an override applies only to channels opened afterwards; an open channel keeps its rate to the end.

The fee comes out of the seller's side. The buyer signs the same totals and the vault pays out the same amounts with or without a fee. A seller can read a channel's fee_bps on-chain before serving it.

[!NOTE] The program deployed on devnet predates protocol fees: it has no fee accounts, and redemption pays the seller the whole difference. The fee applies only once a build with it is deployed; the protocol reference's versioning page lists what differs.

Off-chain acknowledgment versus on-chain payment

The seller's {"ack": true} to a voucher POST means the seller accepted the receipts and stored the voucher. It is not payment. Payment happens when the voucher is redeemed on-chain. The seller protects itself by refusing new requests that would push unredeemed, unvouchered exposure past what the channel can still pay.

One deployment, one domain

Every hold and voucher is signed over a domain: the cluster's genesis hash plus the program ID. A voucher is valid only for the program it names. A successor program, if one is ever selected for new funds, lives at a different address; existing vouchers keep settling through the original program, and existing balances are never moved automatically.