# ProvenPaid methodology (draft v0.1)

ProvenPaid reports evidence about a paid agent endpoint (x402 today; other payment rails such as MPP are detected and will be covered as they mature). It does not label sellers as fraudulent. Every item in a response names its source and the time it was measured.

## 1. Payment challenge check (live probe)
We send one unpaid request to the URL. We never send a payment in this step.
- Status is HTTP 402.
- Payment requirements are present: the base64 `PAYMENT-REQUIRED` header (x402 v2) or a JSON body (x402 v1).
- `x402Version` is 1 or 2; `accepts` is non-empty.
- For each payment option: a scheme, a recognized network, a positive amount, and a well-formed receiving address.
- Informational: whether the asset is a known USDC contract; whether the network is a mainnet; whether the declared resource host matches the URL; whether TLS is used; whether the endpoint redirects.
- Stated versus charged price (`challenge.price_check`): dollar amounts written in the challenge's human-readable description ("$0.01", "0.01 USDC") are compared with what the USDC payment options actually charge. Status is `match` (any stated amount equals any charged amount, within $0.00005), `differs` (none do; reported as a warning with both numbers), `no_stated_price` or `not_comparable` (no USDC option). A difference is reported as two numbers side by side, not as a judgement: descriptions go stale, and tiered prices can be written in ways this simple reading misses. The seller watch records this comparison daily.

## 2. Payer depth (on-chain)
For each payment option paid in USDC on Base (mainnet or Sepolia), we read USDC `Transfer` events into the receiving address from public Base transaction logs, over a trailing window (default 30 days). The window is set from block timestamps: its first block is the first one at or after the start time, found by searching block timestamps, and the start is rounded down to 10 minutes. Block counts are not used as a clock, because Base moved from one block every 2 seconds to one every 200 milliseconds on 2026-11-05.

The counting unit is the **settlement**. An EIP-3009 settlement is one authorization: one `AuthorizationUsed` event, with its own nonce, paired with one `Transfer` from the same payer in the same transaction. A batch transaction carrying five authorizations is five settlements. A transfer without an authorization counts once per (transaction, payer). Logs are deduplicated by (transaction, log index), so overlapping scans never double count. Each view reports `settlements` and `distinct_transactions` side by side, plus raw `transfers`, so batching stays visible.

Three views are reported:
- **x402_style**: settlements by an EIP-3009 signature in the same transaction (a USDC `AuthorizationUsed` event whose authorizer is the payer, emitted before the matching `Transfer`). This is the common way x402 "exact" payments settle on EVM chains, and the highest-confidence view.
- **other_usdc_in**: inbound USDC without an EIP-3009 authorization. This includes x402 payments settled another way (for example Permit2, or an allowance plus `transferFrom`, depending on the facilitator) and ordinary transfers unrelated to x402. The method is not classified yet.
- **all_usdc_in**: both of the above.

For each view: settlements, distinct transactions, transfers, total USDC, distinct payers, repeat payers and repeat-payer share (payers with two or more settlements), top-1 and top-5 payer share of settlements, median settlement amount, first and last block, and the timestamps of the first and last settlement (`first_settlement_at`, `last_settlement_at`, unix seconds, read from the block). The caller decides what recency matters.

We count settlements and payers, never paid calls. A seller that bills several calls with one authorization shows fewer settlements than calls served; that is expected, and the seller's own call counts are not visible on-chain. A retry that signs a second authorization counts twice, because money moved twice; a re-broadcast of the same transaction counts once. These rules are tested against seller-pattern cases contributed by a seller operator (provenpaid-log-fixture/1).

**Round-trip payers.** We also read USDC sent by the receiving address over the same covered blocks. A payer that also received USDC from the receiving address in the window is a round-trip payer. Round-trip payers are removed from every view and reported in `round_trip` (payers, of which x402-style, and their settlements). This can include legitimate refunds; it is reported as an observation, not a judgment. What logs alone cannot show: an operator paying its own address through EIP-3009 from a second wallet it controls looks the same as an outside customer, unless that wallet also receives USDC back in the window.

The response leads with **payer_depth**, a summary of the x402_style view for each scanned address: distinct payers, x402-style payments (settlements), repeat-payer share, top-1 payer share, first and last payment time, payers using other methods, round-trip payers, window and coverage, and a one-sentence statement of those counts. When there are no x402-style payments but USDC arrived by other methods, the statement says so rather than reporting zero demand. The statement reports what was observed and the share of the window scanned. It is not a rating. The full figures for every view are in **onchain**.

Coverage: results are cached and extended on every check. The response states which block range and which period have been scanned, the share of the window's time that was scanned, and whether the window is complete. A first check on an unfamiliar address may cover only the most recent part of the window; with 200 millisecond blocks a full 30-day window is about 1,300 node queries, so a first check usually covers hours, not days, and later checks extend it. If the window's first block is not within an hour of the intended start, the window is never reported as complete and the check is not charged.

Limits: a receiving address can serve many endpoints, so payer depth describes the address, not one URL. Payments settled through other schemes (for example batch settlement through an escrow contract) may not appear as direct transfers to the address. Window boundaries and settlement times both come from block timestamps, which Base reports in whole seconds. Transfers from the receiving address to itself and payments from ProvenPaid's own wallets are excluded and counted in `excluded_payers`.

If on-chain data cannot be read (node outage), the check returns HTTP 503 and the caller is not charged.

## 3. Demand-quality signals - in development
Patterns that suggest payments may not reflect outside demand, reported as observations, for example payer wallets funded by the receiving address or by one common funder, very new payer wallets, or uniform tiny payments.

## 4. Baseline
Percentile of payer depth versus all endpoints ProvenPaid has measured. The population grows with use and is reported alongside the percentile.

## When a check is charged
A check is charged only when the target returns an x402 challenge with at least one payment option in USDC on Base (mainnet or Sepolia) and a well-formed receiving address. Unsafe or invalid URLs, non-x402 targets, unsupported networks, on-chain outages and capacity limits return an error and are not charged. A check is charged when on-chain evidence is delivered for at least one receiving address: a complete window, at least 25% of it, or a scan that stopped only because of the per-check call budget (coverage grows across checks) or high volume. A scan cut short by a provider error or the time limit below 25% coverage does not count. Addresses that failed are marked `error`.

## Receiving address
ProvenPaid does not verify that an endpoint controls the address it asks to be paid at. A seller could list another seller's address or an exchange wallet. Each result says so and reports how many distinct endpoint hosts ProvenPaid has seen advertise the same address (hosts are stored only as hashes). At most 3 receiving addresses are scanned per check, within one shared budget of RPC calls and time; additional addresses are listed as skipped. A receiving address with very high transfer volume is scanned until provider limits are reached, and the response says coverage is partial.

## Seller watch (private history)
Once a day ProvenPaid sends one unpaid request to each known x402 seller endpoint and records the result: whether a valid challenge came back, the x402 version, the offers (network, USDC amount, receiving address, scheme), HTTP status and response time. Seller endpoints are found from the public x402.org ecosystem directory as published on 2026-10-09 (the x402 project removed that directory on 2026-10-15). Each week ProvenPaid probes every listed site and its published manifest again, which finds new endpoints of listed sellers; other listing sources are added only after their terms are checked. An endpoint stays on the list after it stops answering so outages and churn are recorded. robots.txt is honoured and no payment is ever sent.

After the probes, each distinct Base USDC receiving address seen in that day's valid challenges gets one payer-depth measurement with the same method as a paid check, within a fixed daily budget of node calls. Each daily record keeps its coverage, so a partial scan is marked partial, never extrapolated. From 2026-11-06 to 2026-11-20 the daily records used a window measured in blocks at 2 seconds each, which after Base's switch to 200 millisecond blocks covered about 3 days instead of 30. Those records were recomputed from the scan cache as of their original measurement time and are marked method 2; the original records are kept separately, marked as superseded. The log and the daily measurements are private; any published use is aggregate or anonymised.

## Data sources
Only the live endpoint itself and public blockchain data. ProvenPaid does not store or resell third-party catalog data.
