
Real-time payment protocol analytics for Coinbase x402 on Base
Track every x402 payment settlement on Base mainnet. Indexes the x402ExactPermit2Proxy contract, correlates USDC transfers, and computes per-actor analytics in real time.
Layer 1 - Extraction
map_x402_settlements .......... Proxy settlement events (Settled / SettledWithPermit)
map_payment_transfers ......... USDC Transfer events in x402 transactions
Layer 2 - State Stores
store_payer_volume ............ Total spend per payer
store_payer_count ............. Payment count per payer
store_recipient_volume ........ Revenue per resource server
store_recipient_count ......... Payment count per recipient
store_facilitator_volume ...... Volume per facilitator
store_facilitator_count ....... Settlement count per facilitator
store_facilitator_gas ......... Gas cost per facilitator
Layer 3 - Analytics
map_payer_stats ............... Payer leaderboards & averages
map_recipient_stats ........... Resource server revenue stats
map_facilitator_stats ......... Facilitator economics
Layer 4 - SQL Sink
db_out ........................ PostgreSQL output (5 tables + 5 views)
| Contract | Address | Events |
|---|---|---|
| x402ExactPermit2Proxy | 0x4020615294c913F045dc10f0a5cdEbd86c280001 |
Settled, SettledWithPermit |
| USDC (Base) | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
Transfer |
# Stream x402 settlements from Base
substreams run x402-base-pulse map_x402_settlements \
-e base-mainnet.streamingfast.io:443 \
-s 25000000 -t +1000
# GUI mode
substreams gui x402-base-pulse map_x402_settlements \
-e base-mainnet.streamingfast.io:443 \
-s 25000000
# Sink to PostgreSQL
substreams-sink-sql run "psql://localhost/x402" \
x402-base-pulse-v1.0.0.spkg \
-e base-mainnet.streamingfast.io:443
| Table | Primary Key | Description |
|---|---|---|
settlements |
tx_hash + log_index | Every x402 payment on Base |
payers |
payer_address | Aggregated spend per payer |
recipients |
recipient_address | Revenue per resource server |
facilitators |
facilitator_address | Gas economics per facilitator |
daily_stats |
date | Protocol-wide daily aggregates |
| View | Description |
|---|---|
top_payers |
Leaderboard by total spend |
top_recipients |
Top resource servers by revenue |
facilitator_economics |
Gas cost analysis per facilitator |
whale_payments |
Payments > $100 USDC |
recent_settlements |
Live settlement feed |
x402 is Coinbase's open-standard payment protocol using the HTTP 402 status code for internet-native crypto payments. Clients pay for API resources via signed authorizations (EIP-3009 / Permit2), and facilitators handle on-chain settlement and gas sponsorship.
Payment flow:
This Substreams indexes step 4 -- every on-chain settlement -- giving you full visibility into the x402 payment network on Base.
cargo build --target wasm32-unknown-unknown --release
substreams pack substreams.yaml
base-mainnet.streamingfast.io:443Extracts x402 settlement events from the x402ExactPermit2Proxy contract. Correlates proxy events with USDC transfers in the same transaction to capture payer, recipient, amount, and facilitator for every x402 payment.
substreams gui x402-base-pulse@v1.0.0 map_x402_settlementsExtracts USDC Transfer events that occur in transactions involving the x402 proxy. These represent the actual token movements for x402 payments.
substreams gui x402-base-pulse@v1.0.0 map_payment_transfersComputes real-time payer statistics by combining settlement data with accumulated store values.
substreams gui x402-base-pulse@v1.0.0 map_payer_statsComputes real-time recipient (resource server) revenue statistics.
substreams gui x402-base-pulse@v1.0.0 map_recipient_statsComputes facilitator economics: volume processed, gas spent, settlement count.
substreams gui x402-base-pulse@v1.0.0 map_facilitator_statsOutputs database changes for PostgreSQL sink. Tables: settlements, payers, recipients, facilitators, daily_stats
substreams gui x402-base-pulse@v1.0.0 db_outall_events gives you all the events in a block (from successful transactions), with basic block hash/number/timestamp and transaction hash
substreams gui x402-base-pulse@v1.0.0 ethcommon:all_eventsAccumulates total payment volume per payer address. Key: {payer_address}
substreams gui x402-base-pulse@v1.0.0 store_payer_volumeCounts total payments per payer address. Key: {payer_address}
substreams gui x402-base-pulse@v1.0.0 store_payer_countAccumulates total revenue per recipient (resource server). Key: {recipient_address}
substreams gui x402-base-pulse@v1.0.0 store_recipient_volumeCounts total payments per recipient. Key: {recipient_address}
substreams gui x402-base-pulse@v1.0.0 store_recipient_countAccumulates total volume settled per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v1.0.0 store_facilitator_volumeCounts total settlements per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v1.0.0 store_facilitator_countAccumulates total gas spent per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v1.0.0 store_facilitator_gasindex_events sets the following keys on the block:
substreams gui x402-base-pulse@v1.0.0 ethcommon:index_events