
Real-time payment protocol analytics for Coinbase x402 on Base
Track every x402 payment settlement on Base. This Substreams detects when facilitators call transferWithAuthorization on USDC to settle HTTP 402 payments, extracting payer, recipient, amount, and facilitator data from each settlement.
The x402 protocol enables internet-native payments using the HTTP 402 status code. When a client wants to access a paid resource:
transferWithAuthorization on USDC to settle payment on-chainAuthorizationUsed + Transfer events| Module | Kind | Description |
|---|---|---|
map_x402_settlements |
Map | Pairs AuthorizationUsed + Transfer events on USDC to extract settlement details |
store_payer_volume |
Store | Accumulates total USDC spent per payer |
store_payer_count |
Store | Counts payments per payer |
store_recipient_volume |
Store | Accumulates total USDC received per resource server |
store_recipient_count |
Store | Counts payments per recipient |
store_facilitator_volume |
Store | Accumulates total USDC volume per facilitator |
store_facilitator_count |
Store | Counts settlements per facilitator |
store_facilitator_gas |
Store | Tracks gas costs per facilitator |
map_payer_stats |
Map | Computes payer leaderboards and averages |
map_recipient_stats |
Map | Computes resource server revenue stats |
map_facilitator_stats |
Map | Computes facilitator economics (volume vs gas cost) |
db_out |
Map | Outputs DatabaseChanges for PostgreSQL sink |
| Contract | Address | Events |
|---|---|---|
| USDC (Base) | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
AuthorizationUsed, Transfer |
# Stream settlements
substreams run x402-base-pulse map_x402_settlements \
-e base-mainnet.streamingfast.io:443 \
-s 29000000 -t +1000
# GUI mode
substreams gui x402-base-pulse map_x402_settlements \
-e base-mainnet.streamingfast.io:443 \
-s 29000000
# Sink to PostgreSQL
substreams-sink-sql run "psql://localhost/x402" \
x402-base-pulse-v2.0.1.spkg \
-e base-mainnet.streamingfast.io:443
| Table | Key | Description |
|---|---|---|
settlements |
tx_hash-log_index |
Every settlement with payer, recipient, amount, facilitator, gas |
payers |
payer_address |
Aggregated spend and payment count per payer |
recipients |
recipient_address |
Revenue and payment count per resource server |
facilitators |
facilitator_address |
Volume settled, settlement count, total gas spent |
daily_stats |
date |
Daily protocol-wide volume, participants, gas |
| View | Description |
|---|---|
top_payers |
Ranked by total USDC spent |
top_recipients |
Ranked by total USDC received |
facilitator_economics |
Volume settled vs gas cost per facilitator |
whale_payments |
Payments > $100 USDC |
recent_settlements |
Latest 100 settlements |
cargo build --target wasm32-unknown-unknown --release
substreams pack substreams.yaml
base-mainnet.streamingfast.io:443Extracts x402 payment settlements on Base by detecting EIP-3009 AuthorizationUsed events on the USDC contract. Per the x402 protocol (https://docs.cdp.coinbase.com/x402), facilitators settle payments by calling transferWithAuthorization on USDC. Each AuthorizationUsed event is paired with its Transfer event to capture payer, recipient, and amount. Also detects Permit2 proxy settlements (Settled / SettledWithPermit) for the newer settlement path.
substreams gui x402-base-pulse@v2.0.1 map_x402_settlementsComputes real-time payer statistics by combining settlement data with accumulated store values.
substreams gui x402-base-pulse@v2.0.1 map_payer_statsComputes real-time recipient (resource server) revenue statistics.
substreams gui x402-base-pulse@v2.0.1 map_recipient_statsComputes facilitator economics: volume processed, gas spent, settlement count.
substreams gui x402-base-pulse@v2.0.1 map_facilitator_statsOutputs database changes for PostgreSQL sink. Tables: settlements, payers, recipients, facilitators
substreams gui x402-base-pulse@v2.0.1 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@v2.0.1 ethcommon:all_eventsAccumulates total payment volume per payer address. Key: {payer_address}
substreams gui x402-base-pulse@v2.0.1 store_payer_volumeCounts total payments per payer address. Key: {payer_address}
substreams gui x402-base-pulse@v2.0.1 store_payer_countAccumulates total revenue per recipient (resource server). Key: {recipient_address}
substreams gui x402-base-pulse@v2.0.1 store_recipient_volumeCounts total payments per recipient. Key: {recipient_address}
substreams gui x402-base-pulse@v2.0.1 store_recipient_countAccumulates total volume settled per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v2.0.1 store_facilitator_volumeCounts total settlements per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v2.0.1 store_facilitator_countAccumulates total gas spent per facilitator. Key: {facilitator_address}
substreams gui x402-base-pulse@v2.0.1 store_facilitator_gasindex_events sets the following keys on the block:
substreams gui x402-base-pulse@v2.0.1 ethcommon:index_events