Output
sf.substreams.sink.database.v1.DatabaseChanges

Package ref
x402-solana-pulse@v1.2.0Run package
CLI
Run db_out from the command line.
substreams run x402-solana-pulse@v1.2.0 db_out -e solanasubstreams auth or directly on thegraph.market (see docs).README
Real-time payment protocol analytics for Coinbase x402 on Solana
Track every x402 payment settlement on Solana — both schemes. This Substreams detects facilitator-sponsored settlements for HTTP 402 payments and extracts payer, recipient, mint, amount, facilitator and memo from each one.
| Scheme | Shape on chain | Covered |
|---|---|---|
exact | SPL Token TransferChecked at top level | since v1.0 |
upto | payment-channels program, transfer as a CPI | new in v1.2 |
Every row carries scheme, so you can filter to one or trust the total. That matters more than it
sounds: upto settlements have no top-level TransferChecked at all, so any Solana x402 indexer
that only walks top-level instructions silently undercounts them and looks complete while doing it.
Companion to x402-base-pulse — same model, Solana native.
The x402 protocol enables internet-native payments using the HTTP 402 status code. The Solana settlement path is defined by the SVM exact scheme:
TransferChecked to the resource server's ATA, signs it, and returns the partially-signed txfeePayer signature, and submits it to SolanaTransferChecked + SPL Memo instructionupto scheme is shaped differentlyupto settles through the payment-channels program
(CHNLxYvVA28MJP9PrFuDXccuoGXAx7jBacfLEkahyGsX) rather than a direct transfer. Observed on
mainnet, the transaction looks like:
top-level : [ComputeBudget, ComputeBudget, PAYMENT_CHANNELS, Memo]
inner CPI : SPL TransferChecked <- the actual token movement
Two consequences worth knowing before you query:
upto volume rather than an error.scheme='upto' and carry the PDA in both payer and channel, so you always know which one you
are holding instead of mistaking a channel for a wallet.Solana has no on-chain FacilitatorRegistry. This substreams uses a two-layer approach:
1. Strict spec match (any facilitator, known or new): Matches the SVM exact scheme layout verbatim — 3–6 top-level instructions consisting of ComputeBudget SetLimit, ComputeBudget SetPrice, TransferChecked, then optional Memo / Lighthouse. Fee payer must differ from the TransferChecked authority. This captures any spec-compliant facilitator automatically, including new ones that haven't been added to the allowlist.
2. Relaxed match for known facilitators: For the 21 facilitator pubkeys mirrored from x402scan's registry, we accept looser layouts (TransferChecked + Memo anywhere in top-level instructions) so non-spec variants still get indexed. Known facilitators include: Coinbase, PayAI, Dexter, Daydreams, OpenX402, AnySpend, CodeNut, Corbits, Aurracloud, Bitrefill, Cascade, OpenFacilitator, Relai, UltravioletaDAO, X402Jobs.
SELECT scheme, COUNT(*) AS settlements, SUM(amount::numeric) AS volume
FROM settlements
GROUP BY scheme;
Channel activity, for upto only:
SELECT channel, COUNT(*) AS settlements, SUM(amount::numeric) AS volume
FROM settlements
WHERE scheme = 'upto'
GROUP BY channel
ORDER BY volume DESC;
Every settlement has facilitator_name (empty if unknown) and facilitator_known (boolean). To find new facilitators to add to the allowlist:
SELECT facilitator, COUNT(*) AS tx_count, SUM(amount) AS volume
FROM settlements
WHERE facilitator_known = false
GROUP BY facilitator
ORDER BY tx_count DESC
LIMIT 20;
High-volume unknown fee-payers are candidates. Verify on Solscan, then add to KNOWN_FACILITATORS in src/lib.rs and publish a new version.
| 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 |
| Program | Pubkey |
|---|---|
| SPL Token | TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA |
| SPL Token-2022 | TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb |
| SPL Memo v2 | MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr |
| SPL Memo v1 | Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo |
# 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
| 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 |
| 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 |
cargo build --target wasm32-unknown-unknown --release
substreams pack substreams.yaml
mainnet.sol.streamingfast.io:443Modules
Output
sf.substreams.sink.database.v1.DatabaseChanges
Output
x402.v1.FacilitatorStatsOutput
x402.v1.PayerStatsOutput
x402.v1.RecipientStatsExtracts 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
Output
x402.v1.SettlementsInputs
Store value
int64
Update policy
add
Inputs
Accumulates total tx fees (lamports) spent per facilitator. Key: {facilitator_pubkey}
Store value
bigint
Update policy
add
Inputs
Accumulates total volume settled per facilitator. Key: {facilitator_pubkey}
Store value
bigint
Update policy
add
Inputs
Records first-seen block timestamp per entity. Key: payer:{p}, recipient:{r}, facilitator:{f}
Store value
int64
Update policy
set_if_not_exists
Inputs
Store value
int64
Update policy
add
Inputs
Store value
bigint
Update policy
add
Inputs
Store value
int64
Update policy
add
Inputs
Store value
bigint
Update policy
add
Inputs