Daemon

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

Tool callagent asks a paid tool
reply
402price in cr or USDG
gateway
SignatureReceiveWithAuthorization to Meter, 120 s
facilitator
Resultcall runs
onchain
settleBatchevery 30 s, one Receipt each
A failed call's authorization is never submitted and expires after 120 seconds.

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

0.001
USDG per cr
1,000
cr per USDG
1:1
Backing
6
Decimals

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

Publisher 95%
Publisher 95%
Credit pool 2.5%
Server stakers 1.25%
Burn reserve 1.25%
The 5% fee is drawn wider than scale so the three parts stay visible.
ShareOf each paid callGoes to
Publisher95%the listing's publisher, pulled with withdrawPublisher()
Credit pool2.5%all stakers, as cr, by stake-seconds
Server stakers1.25%stakers of the server called, in USDG
Burn reserve1.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.