the spend rail
An agent credit card that works over HTTP
A credit line is only interesting if it buys something. This is the leg that turns Priors reputation into purchasing power: a paywalled compute endpoint speaking 402 Payment Required, settled in USDG drawn from an agent's uncollateralized line.
1. Draw
borrow() sends USDG from the pool straight to the agent's address. Fee is 1% per 30d, pro-rata.
2. Pay the invoice
The resource answers 402 with payment requirements. The agent transfers USDG and retries with an X-PAYMENT header.
3. Repay, score up
repay() closes the loan and splits the fee 50%/25%/25%. The repayment is what grows the next line.
console
Quote a credit-funded spend
Fee
$0.011666
principal x baseFeeBps x term / (30d x 10000)
Total due on repay
$5.011666
Effective APR
12.17%
fee annualised over the chosen term
Agent credit available
$5
of a $5 line
- 1Draw from credit lineto 0x28121009…C8DE21
borrow(uint256 agentId,uint256 principal,uint64 term,address to,uint256 maxFee)
- agentId
- 7616
- principal
- 5000000
- term
- 604800
- to
- 0x2BcAbba4FF62f0d45Bc3FC71C99198e4dfb8F7f0
- maxFee
- 11666
0x1a29492b0000000000000000000000000000000000000000000000000000000000001dc000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000000000000000000000000000000000000000093a800000000000000000000000002bcabba4ff62f0d45bc3fc71c99198e4dfb8f7f00000000000000000000000000000000000000000000000000000000000002d92
- 2Settle the x402 invoice in USDGto 0x5fc5360D…F1d168
transfer(address to,uint256 amount)
- to
- 0x2BcAbba4FF62f0d45Bc3FC71C99198e4dfb8F7f0
- amount
- 5000000
0xa9059cbb0000000000000000000000002bcabba4ff62f0d45bc3fc71c99198e4dfb8f7f000000000000000000000000000000000000000000000000000000000004c4b40
- 3Repay principal + fee to rebuild the scoreto 0x28121009…C8DE21
repay(uint256 loanId,uint256 agentId,uint256 amount)
- loanId
- <loanId from the Borrowed event in step 1>
- agentId
- 7616
- amount
- 5011666
Calldata is finalised once step 1 emits its loanId.
Calldata is returned unsigned. This app holds no agent keys; the operator broadcasts.
Live x402 handshake
A real priced resource: an underwriting report computed from the agent's on-chain loan history.
{
"x402Version": 1,
"accepts": [
{
"scheme": "exact-onchain",
"network": "robinhood-chain-4663",
"maxAmountRequired": "20000",
"resource": "/api/x402/compute?agentId=7616",
"description": "Priors underwriting report for agent #7616",
"mimeType": "application/json",
"payTo": "0x2BcAbba4FF62f0d45Bc3FC71C99198e4dfb8F7f0",
"maxTimeoutSeconds": 300,
"asset": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
"extra": {
"name": "USDG",
"decimals": 6,
"settlement": "Send a USDG transfer to payTo for at least maxAmountRequired, then retry within maxTimeoutSeconds (300s, measured from the payment's block) with X-PAYMENT: base64({\"x402Version\":1,\"scheme\":\"exact-onchain\",\"network\":\"robinhood-chain-4663\",\"payload\":{\"txHash\":\"0x...\"}}). A PriorsPay swipe to payTo is a valid payment: its receipt carries the card's USDG Transfer to payTo. A swipe counts only for the invoice it was made for: its ref must be keccak256(utf8(resource)) = 0x24a7876324340dd9b6eb616bf743d7fa993495f420d091f27fd554c9f49b6251; a swipe carrying another ref is refused (and not consumed).",
"note": "Settlement is an on-chain USDG transfer verified by this server from the transaction receipt, so a contract payer (a PriorsPay card swipe) can pay. This endpoint does not take the EIP-3009 `exact` scheme, which needs a signature from the wallet holding the USDG. With ?payer=<agentId> the USDG must come from that agent's identity owner, or from PriorsPay with a Swiped event in the same receipt naming that agent and carrying this invoice's ref. A redeemed tx hash is refused afterwards (recorded per instance and in the regional Runtime Cache)."
}
}
],
"error": "X-PAYMENT header required"
}Settle it: send the invoiced USDG to payTo, then paste the transaction hash. The server decodes the real Transfer log from the receipt before serving anything.
Any hash is checked for real: wrong asset, wrong recipient, short payment, a reverted transaction, or one already redeemed are all rejected with the reason. This app holds no keys, so it cannot make the payment for you.
signer
Run the loop for real
Execute it yourself
No EIP-1193 wallet is injected in this browser, so the three legs cannot be signed here. Install a wallet and point it at chain 4663, or use the operator CLI (npm run cycle) which signs with a key from your own environment. The unsigned calldata above is the same either way.
protocol note
Why this endpoint is not `exact`
Canonical x402 on EVM uses the exact scheme, which settles via an EIP-3009 transferWithAuthorization signature so a facilitator can pull funds gaslessly. USDG on Robinhood Chain implements it, and the Priors facilitator settles its merchants that way.
But exact needs a 65-byte signature from the wallet that holds the USDG, so a contract cannot pay with it, and a Priors Card swipe pays from the PriorsPay contract, not from the agent's wallet.
This endpoint therefore keeps the x402 envelope faithful (same status code, same accepts shape, same X-PAYMENT / X-PAYMENT-RESPONSE headers) and takes the settlement proof any payer, wallet or contract, can produce:
The facilitator fetches the receipt, decodes the USDG Transfer logs, and requires a transfer to payTo of at least the invoiced amount, in a successful transaction, not already redeemed. Nothing is taken on trust.
endpoints
Call it yourself
The priced resource. 402 without payment, the report with it.
Fee quote plus unsigned calldata for all three legs.
Full credit report, score breakdown, ladder, loans, timeline.
Every discovered agent, ranked.
Pool totals and live protocol constants.
settlement
Invoice details
- payTo
- 0x2BcAbba4FF62f0d45Bc3FC71C99198e4dfb8F7f0
- asset (USDG)
- 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
- price
- $0.02 per report
- network
- robinhood-chain-4663
payTo defaults to the Priors treasury sponsor and is configurable with X402_PAY_TO. Redeemed hashes are tracked in memory, so a redeploy clears them; a production facilitator would persist that set.
Reputation became purchasing power
Nothing in that flow asked who the agent was, whether it had assets, or for a human to co-sign. It asked what it had repaid. That is the whole thesis, and you can watch it compound on agent #7616.