Open app

Unpaid proof

How a service proves on chain that an agent didn't pay, using the agent's own signed voucher.

A service serves calls before it is paid, and the last voucher it accepted, signed by the agent's key, is its evidence if the agent never settles. flag_unpaid puts that voucher on chain, the program checks the signature, and the tab is marked unpaid with the voucher's amount public. Tabs that settle keep their amounts private.

When a service can flag

flag_unpaid is accepted when all of these hold:

  • the transaction is signed by the service's signing key,
  • the tab is open or settling,
  • the service's settlement window has passed since the tab opened: the current time is later than opened_at plus the service's settlement_window_seconds.

The window is part of the service's listing, so an agent knows it before it opens a tab. The agent's SDK starts settling when a third of the window is left, and the service's SDK waits a grace period past the window before flagging, so the two don't race.

A tab on which the service accepted no voucher has no evidence to post. Once its window passes, the service closes it as void with void_tab; nothing about an amount is published, since there was none.

How the program checks the voucher

Solana programs don't verify Ed25519 signatures themselves. They read the result of the Ed25519 precompile, a native instruction that verifies a signature and fails the whole transaction if it doesn't check out. A flag transaction carries two instructions:

  1. The Ed25519 precompile instruction, with the agent's public key, the voucher's signature and the 126-byte voucher message.
  2. flag_unpaid, with the voucher's tab, cumulative amount and sequence.

flag_unpaid reads the instructions sysvar, finds the precompile instruction, and checks that:

  • its public key is the agent's registered signing_key,
  • its message is exactly the voucher message for this tab and amount, under this program ID and this cluster's genesis hash,
  • its offsets point inside that same instruction, so the signed data can't be swapped for other bytes in the transaction.

If the checks pass, the program stores the cumulative amount in the tab's flagged_amount, sets the status to unpaid, and raises the unpaid counters on the agent and the service.

What becomes public

FieldPublic after a flag
Tab statusunpaid
flagged_amountThe cumulative amount of the last voucher
Agent's tabs_unpaidUp by one
Service's tabs_unpaidUp by one

Anyone can read an agent's unpaid count before serving it, and the service directory shows each service's count too. The amounts of every other tab stay private.