Paying for tools: x402, USDG and cr
A paid tool answers 402 with its price; the gateway signs one EIP-3009 authorization; only calls that returned a result are settled.
The payment flow
The facilitator is the house keeper key. It can only submit what you signed: the exact amount, to the Meter contract, before validBefore. A batch that contains a bad or expired signature settles the rest and logs a Skipped event for that one.
cr credits
cr is an ERC-20 held in the Credits contract's USDG reserve. You buy it at par with buy(usdg). It is transferable and spent at par on any paid tool or on inference. Holders cannot redeem it for USDG: when cr is spent, Meter burns it and Credits releases the matching USDG to the split. The reserve has no withdraw function, not even for the owner, so this always holds:
USDG.balanceOf(Credits) * 1000 >= cr.totalSupply()Where the money goes
| Share | Of each paid call | Goes to |
|---|---|---|
| Publisher | 95% | the listing's publisher, pulled with withdrawPublisher() |
| Credit pool | 2.5% | all stakers, as cr, by stake-seconds |
| Server stakers | 1.25% | stakers of the server called, in USDG |
| Burn reserve | 1.25% | held in USDG for $DMN burns |
Receipts
Every settled call emits Receipt(callId, payer, serverId, callHash, amount, asset, usdgValue). callHash is the keccak256 of the request digest and the response digest, so you can prove what was asked and answered without publishing either.