Package Logo
x402_solana_pulse
x402_solana_pulse@v1.0.0
Total Downloads
1
Published
6 hours ago
Network
solana solana
Publisher
User Avatar PaulieB14

Readme

x402 Solana Pulse

Real-time payment protocol analytics for Coinbase x402 on Solana

Track every x402 payment settlement on Solana. This Substreams detects when facilitators sponsor SPL Token TransferChecked settlements for HTTP 402 payments, extracting payer, recipient, mint, amount, facilitator, and memo from each transaction.

Companion to x402-base-pulse — same model, Solana native.


How It Works

The x402 protocol enables internet-native payments using the HTTP 402 status code. The Solana settlement path is defined by the SVM exact scheme:

  1. Server responds with HTTP 402 + payment requirements (mint, payTo, amount, feePayer)
  2. Client constructs a transaction containing a TransferChecked to the resource server's ATA, signs it, and returns the partially-signed tx
  3. Facilitator verifies the transaction, provides the final feePayer signature, and submits it to Solana
  4. Solana executes an SPL Token (or Token-2022) TransferChecked + SPL Memo instruction
  5. This Substreams captures those transactions by looking for the x402 SVM settlement shape

Detection heuristic

Solana has no on-chain FacilitatorRegistry. Instead, x402 settlements are identified by three signals observed together in a transaction:

  • Contains an SPL Token or Token-2022 TransferChecked instruction
  • Contains an SPL Memo instruction (payment reference / nonce)
  • Transaction fee_payer is distinct from the TransferChecked authority — i.e. the facilitator sponsors, the payer signs

Modules

Module Kind Description
map_x402_settlements Map Detects x402 settlements in each Solana block and extracts payer / recipient / mint / amount / facilitator / memo
store_payer_volume Store Accumulates total amount spent per payer pubkey
store_payer_count Store Counts payments per payer
store_recipient_volume Store Accumulates total received per resource server (ATA owner)
store_recipient_count Store Counts payments per recipient
store_facilitator_volume Store Accumulates volume settled per facilitator
store_facilitator_count Store Counts settlements per facilitator
store_facilitator_fees Store Accumulates tx fees (lamports) paid per facilitator
store_first_seen Store Records first-seen block timestamp per payer / recipient / 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, fees, counts)
db_out Map Outputs DatabaseChanges for the PostgreSQL sink

Programs Indexed

Program Pubkey
SPL Token TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
SPL Token-2022 TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
SPL Memo v2 MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr
SPL Memo v1 Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo

Quick Start

# Stream settlements
substreams run x402-solana-pulse map_x402_settlements \
  -e mainnet.sol.streamingfast.io:443 \
  -s 280000000 -t +1000

# GUI mode
substreams gui x402-solana-pulse map_x402_settlements \
  -e mainnet.sol.streamingfast.io:443 \
  -s 280000000

# Sink to PostgreSQL
substreams-sink-sql run "psql://localhost/x402" \
  x402-solana-pulse-v1.0.0.spkg \
  -e mainnet.sol.streamingfast.io:443

SQL Output

Tables

Table Key Description
settlements signature-instruction_index Every settlement with payer, recipient, mint, amount, facilitator, fee, memo
payers payer_address Aggregated spend and payment count per payer pubkey
recipients recipient_address Revenue and payment count per resource server
facilitators facilitator_address Volume settled, settlement count, lamport fees per facilitator

Views

View Description
daily_stats Daily protocol-wide volume, unique participants, fees
top_payers Ranked by total spend
top_recipients Ranked by total revenue
facilitator_economics Volume settled vs fee cost per facilitator
whale_payments Payments ≥ 100 USDC (atomic units)
recent_settlements Latest 100 settlements

Build

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

References

Network

  • Chain: Solana mainnet
  • Endpoint: mainnet.sol.streamingfast.io:443
  • Initial block: 280,000,000 (adjustable)

Documentation

Modules

Maps icon
Maps

map
map_x402_settlements

6c65e6aa6aa833b8aa527fef62783bf624c7eff8
map map_x402_settlements (
blocksf.solana.type.v1.Block
)  -> x402.v1.Settlements

Extracts x402 payment settlements on Solana by detecting the SVM exact scheme settlement shape: a transaction that contains an SPL Token (or Token-2022) TransferChecked instruction paired with an SPL Memo instruction, where the transaction fee payer is distinct from the TransferChecked authority (the facilitator sponsors, the payer signs). Per the x402 SVM exact scheme: https://github.com/coinbase/x402/blob/main/specs/schemes/exact/scheme_exact_svm.md

substreams gui x402-solana-pulse@v1.0.0 map_x402_settlements

map
map_payer_stats

6596668ccdad1c4d84bbdd85b4365d523d14a95b
map map_payer_stats (
store_payer_volumeDELTAS<add,bigint>
store_payer_countGET<add,int64>
store_first_seenGET<set_if_not_exists,int64>
)  -> x402.v1.PayerStats
substreams gui x402-solana-pulse@v1.0.0 map_payer_stats

map
map_recipient_stats

bcdb8b7f80028322daa1558b1a09e2fbbabc7a5c
map map_recipient_stats (
store_recipient_volumeDELTAS<add,bigint>
store_recipient_countGET<add,int64>
store_first_seenGET<set_if_not_exists,int64>
)  -> x402.v1.RecipientStats
substreams gui x402-solana-pulse@v1.0.0 map_recipient_stats

map
map_facilitator_stats

d6b4bfc1af2ca0d36e465205dc180c755317c489
map map_facilitator_stats (
store_facilitator_volumeDELTAS<add,bigint>
store_facilitator_feesGET<add,bigint>
store_first_seenGET<set_if_not_exists,int64>
)  -> x402.v1.FacilitatorStats
substreams gui x402-solana-pulse@v1.0.0 map_facilitator_stats

map
db_out

eca6119077ca915a18cab0e3f0f0417dee0760f2
Default param : min_amount=0
substreams gui x402-solana-pulse@v1.0.0 db_out
Stores icon
Stores

store
store_payer_volume

e99df77a6bbdca37b3ed4de737d5a7747d984c10
store <add,bigint> store_payer_volume (
)

Accumulates total payment volume per payer. Key: {payer_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_payer_volume

store
store_payer_count

f96864c32ef232b55e4b48c0df39a97cccf510c2
store <add,int64> store_payer_count (
)

Counts total payments per payer. Key: {payer_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_payer_count

store
store_recipient_volume

7e919f5df97cba50143c312d4c0297be36e5ed43
store <add,bigint> store_recipient_volume (
)

Accumulates total revenue per recipient. Key: {recipient_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_recipient_volume

store
store_recipient_count

ec07feb518ccb8cbaa30aec743e2afb0bbeb17e3
store <add,int64> store_recipient_count (
)

Counts total payments per recipient. Key: {recipient_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_recipient_count

store
store_facilitator_volume

4a1e8e54de0e0502e893badf1d8bf63d21dec450
store <add,bigint> store_facilitator_volume (
)

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

substreams gui x402-solana-pulse@v1.0.0 store_facilitator_volume

store
store_facilitator_count

0785484a05478f76f7df4cbce4be7fc9ed0393ad
store <add,int64> store_facilitator_count (
)

Counts total settlements per facilitator. Key: {facilitator_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_facilitator_count

store
store_facilitator_fees

8dff3d1456ec97028c99c9a83dce7cfbfdf578f5
store <add,bigint> store_facilitator_fees (
)

Accumulates total tx fees (lamports) spent per facilitator. Key: {facilitator_pubkey}

substreams gui x402-solana-pulse@v1.0.0 store_facilitator_fees

store
store_first_seen

8500d6b6eeb5cdac3faec86ca6f12b66b2d94c0f
store <set_if_not_exists,int64> store_first_seen (
)

Records first-seen block timestamp per entity. Key: payer:{p}, recipient:{r}, facilitator:{f}

substreams gui x402-solana-pulse@v1.0.0 store_first_seen
Protobuf

Protobuf Docs Explorer

x402.v1