Package Logo
x402-base-pulse
x402-base-pulse@v2.0.0
Total Downloads
3
Published
2 hours ago
Network
base base
Publisher
User Avatar PaulieB14

Readme

x402 Base Pulse

Real-time payment protocol analytics for Coinbase x402 on Base

Note: The x402 proxy contract is currently active on Base Sepolia testnet (194+ settlements since Jan 2026) and has not yet been deployed to Base mainnet. This Substreams is production-ready and will begin indexing automatically once the proxy goes live on mainnet.

Track every x402 payment settlement on Base mainnet. Indexes the x402ExactPermit2Proxy contract, correlates USDC transfers, and computes per-actor analytics in real time.


Modules

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)

Contracts Indexed

Contract Address Events
x402ExactPermit2Proxy 0x4020615294c913F045dc10f0a5cdEbd86c280001 Settled, SettledWithPermit
USDC (Base) 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 Transfer

Quick Start

# 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

SQL Schema

Tables

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

Views

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

What is x402?

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:

  1. Client requests a paid resource
  2. Server responds with HTTP 402 + payment requirements
  3. Client signs a payment authorization
  4. Facilitator settles on-chain via the x402 proxy
  5. Server delivers the resource

This Substreams indexes step 4 -- every on-chain settlement -- giving you full visibility into the x402 payment network on Base.

Build from Source

cargo build --target wasm32-unknown-unknown --release
substreams pack substreams.yaml

Network

  • Chain: Base (EVM)
  • Start Block: 25,000,000
  • Endpoint: base-mainnet.streamingfast.io:443

Documentation

Modules

Maps icon
Maps

map
map_x402_settlements

29fd519cf9c23b0f6117c1766bf62c3041f1968c
map map_x402_settlements (
blocksf.ethereum.type.v2.Block
)  -> x402.v1.Settlements

Extracts 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.0 map_x402_settlements

map
map_payer_stats

b2cb5267bd55dd3f846b163f8ea28014004c7545

Computes real-time payer statistics by combining settlement data with accumulated store values.

substreams gui x402-base-pulse@v2.0.0 map_payer_stats

map
map_recipient_stats

bf8a444b16d10fcc8f02491980a642be0aa7479e

Computes real-time recipient (resource server) revenue statistics.

substreams gui x402-base-pulse@v2.0.0 map_recipient_stats

map
map_facilitator_stats

2e3f0df108414ab8d49eb19b79e2142dd045978f

Computes facilitator economics: volume processed, gas spent, settlement count.

substreams gui x402-base-pulse@v2.0.0 map_facilitator_stats

map
db_out

82a0bda491eee33e078be4281d268874bd58e70b
Default param : min_amount=0

Outputs database changes for PostgreSQL sink. Tables: settlements, payers, recipients, facilitators

substreams gui x402-base-pulse@v2.0.0 db_out

map
ethcommon:all_events

963652a247fd23d0823dde62d21ae54c783b6073
map ethcommon:all_events (
)  -> sf.substreams.ethereum.v1.Events

all_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.0 ethcommon:all_events
Stores icon
Stores

store
store_payer_volume

e88f6700df7983fcc6d0ced37640a27750ae21e3
store <add,bigint> store_payer_volume (
)

Accumulates total payment volume per payer address. Key: {payer_address}

substreams gui x402-base-pulse@v2.0.0 store_payer_volume

store
store_payer_count

cbe4573ffa83dbc9056ee8eb88f29ab49ab033c2
store <add,int64> store_payer_count (
)

Counts total payments per payer address. Key: {payer_address}

substreams gui x402-base-pulse@v2.0.0 store_payer_count

store
store_recipient_volume

c06879aad0dc4e3b2a5296196f5039375ccfc835
store <add,bigint> store_recipient_volume (
)

Accumulates total revenue per recipient (resource server). Key: {recipient_address}

substreams gui x402-base-pulse@v2.0.0 store_recipient_volume

store
store_recipient_count

925ff5ea2c52fe1b8ea20848f1100377fcdde01f
store <add,int64> store_recipient_count (
)

Counts total payments per recipient. Key: {recipient_address}

substreams gui x402-base-pulse@v2.0.0 store_recipient_count

store
store_facilitator_volume

a54102542eb9fb9d1f6bdae8637fc9882e8c88f8
store <add,bigint> store_facilitator_volume (
)

Accumulates total volume settled per facilitator. Key: {facilitator_address}

substreams gui x402-base-pulse@v2.0.0 store_facilitator_volume

store
store_facilitator_count

f9e324a4b01891f11a7a14df7173f2f11ad48938
store <add,int64> store_facilitator_count (
)

Counts total settlements per facilitator. Key: {facilitator_address}

substreams gui x402-base-pulse@v2.0.0 store_facilitator_count

store
store_facilitator_gas

a882fdc204414261cb5e656ca515f23c611f323a
store <add,bigint> store_facilitator_gas (
)

Accumulates total gas spent per facilitator. Key: {facilitator_address}

substreams gui x402-base-pulse@v2.0.0 store_facilitator_gas
Block Indexes icon
Block Indexes

blockIndex
ethcommon:index_events

87255243f80f5d4755cd826ec57bf70696a4d7b6

index_events sets the following keys on the block:

  • Event signatures evt_sig:0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef (signature in hex, prefixed by 0x)
  • Event address evt_addr:0x0123456789abcdef0123456789abcdef01234567 (address in hex, prefixed by 0x)
substreams gui x402-base-pulse@v2.0.0 ethcommon:index_events
Protobuf

Protobuf Docs Explorer

sf.ethereum.substreams.v1
sf.ethereum.type.v2
x402.v1