Skip to content

Study: measure RPC sold per call to AI agents over x402 - #18

Closed
macjayz wants to merge 1 commit into
mainfrom
study/x402-rpc-sellers
Closed

macjayz wants to merge 1 commit into
mainfrom
study/x402-rpc-sellers

Conversation

@macjayz

@macjayz macjayz commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the RPC that AI agents actually pay for to the reliability study: Pocket Network's Agentic Portal sells Ethereum, Base and Arbitrum JSON-RPC over x402 at $0.005 a call (USDC on Base, quoted 1 Nov 2026). In x402scan's top services, blockchain RPC is the only paid data that can be cross-checked, so this is where Heightproof's verification applies.

  • @heightproof/web3: createHeightproofRpcClient accepts a fetchImpl for calls to rpcUrl, so a priced endpoint can be called through a paying fetch.
  • scripts/study/paid.ts: wraps an x402 client with two spending caps.
    • x402 refuses any single payment above $0.01.
    • The wrapper stops paying for the rest of the UTC day once STUDY_PAID_DAILY_BUDGET_USD is spent.
    • Only settled or successful payments count toward the budget.
  • Collector:
    • Paid endpoints are off unless STUDY_X402_PAYER_KEY is set.
    • They run every STUDY_PAID_EVERY_TICKS ticks (default 80, about every 20 minutes) and are never used as verification peers, so nothing else spends money.
    • Skipped ticks aren't recorded as provider failures.
  • Compose: passes the new settings to the study service.

Cost at the defaults: about 72 rounds a day × ~6 calls × $0.005 ≈ $2.20 per chain, so about $6.50 a day for all three, with a hard cap of $8 a day.

OneSource was left out: it sells RPC through its own REST routes, not JSON-RPC.

Testing

  • Tests: all workspace tests pass, including a new web3 test that fetchImpl replaces the global fetch for rpcUrl. Typecheck and lint are clean.
  • Live against Pocket with an unfunded key:
    • the wrapper signs a payment and Pocket's facilitator rejects it (PAYMENT_INVALID)
    • nothing is counted against the budget
    • free endpoints pass straight through
    • the budget check blocks calls once the cap is reached
  • Not tested: a settled payment, which needs a funded wallet.

Adds Pocket Network's Agentic Portal (Ethereum, Base, Arbitrum JSON-RPC at
$0.005 a call in USDC on Base) to the reliability study, so the report
covers the providers agents actually pay.

- @heightproof/web3: createHeightproofRpcClient takes a fetchImpl, so
  calls to rpcUrl can go through a paying fetch.
- scripts/study/paid.ts wraps an x402 client with two caps: x402 refuses
  any payment above $0.01, and the wrapper stops paying for the rest of
  the UTC day at STUDY_PAID_DAILY_BUDGET_USD. Only settled payments count.
- Paid endpoints run only with STUDY_X402_PAYER_KEY set, every
  STUDY_PAID_EVERY_TICKS ticks (default 80, about every 20 minutes), and
  are never used as verification peers. Skipped ticks are not recorded
  as failures.
@macjayz macjayz closed this Nov 1, 2026
@macjayz
macjayz deleted the study/x402-rpc-sellers branch November 1, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant