Add x402 protocol volume adapter for Base #4582
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DefiLlama adapter for tracking x402 payment protocol volume on Base.
What is x402?
x402 is a payment protocol enabling USDC payments to AI agents using Account Abstraction and EIP-3009 (
transferWithAuthorization) on Base L2.Links:
What This Adapter Tracks
Metrics Returned:
Coverage: Tracks 36 facilitator addresses across 11 providers (Coinbase, PayAI, Questflow, x402rs, Codenut, Aurracloud, OpenX402, Daydreams, Mogami, Thirdweb, 402104, XEcho) on Base.
Start Date: December 5, 2024 (earliest facilitator)
Why Fees/Revenue = 0?
Transferevents show full payment amounts (user → AI agent) with no visible deduction✅ dailyVolume is accurate: Total USDC transferred through x402 facilitators is precisely measured
Technical Implementation
Detection Method
Why Track by Sender (tx.from)?
Challenge:
Solution:
Alternative Approach (Future Enhancement):
A separate adapter could track individual AI agent volumes by recipient address (tx.to):
Event Signatures
AuthorizationUsed (EIP-3009):
Transfer (ERC-20):
Multi-Path Fallback
The adapter uses multiple paths for different RPC capabilities:
getTxReceiptsto get full transaction datagetTransactionswhen receipts unavailableTesting
Verified Dates:
Code Structure
Single file:
fees/x402/index.ts(~210 lines)Methodology Statement
Volume: USDC payment volume facilitated through x402 protocol on Base. Tracks transfers from authorized facilitator addresses (36 addresses across 11 providers) using EIP-3009. Respects dateOfFirstTransaction for each facilitator address.
Fees: x402 protocol does not charge user fees on-chain. All payment amounts go directly to recipients. Facilitators may charge fees off-chain.
Revenue: Protocol does not collect direct revenue from transactions. Revenue model is not public.
Data Accuracy
High confidence:
Limitations: