Prerequisites: A Helius API key (Business or Professional plan for Mainnet LaserStream) and Node.js 18+. Familiarity with Account Subscriptions and Transaction Monitoring helps but isnโt required.
Setup
Create a fresh project, install the SDK +bs58 (used to decode transaction signatures), and set your API key:
The script
Save this asindex.ts, then run npx ts-node index.ts:
What the script does
One subscription, two filter blocks
A singlesubscribe(...) call carries two named filter groups:
- The
accountsfilter receives every account owned by the Pump.fun program (bonding curves, mint state, etc.) every time their data changes. - The
transactionsfilter receives every transaction that interacts with the Pump.fun program. Thevote: false, failed: falseflags drop votes and failed transactions before they reach your handler.
Reading the raw fields
A couple of values in the payload need a small conversion before theyโre easy to use:tx.signatureis aBuffer. Run it throughbs58.encode(...)to get the base58 signature youโd see in an explorer or in agetTransactionresponse.tx.meta.feeis a u64 stored as a string so values aboveNumber.MAX_SAFE_INTEGERdonโt lose precision in JavaScript. Wrap it inNumber(...)before doing arithmetic. The same string-for-u64 convention applies to several block-level fields too โ see Slot & Block Monitoring for the full data shape.
Rolling stats
AsetInterval prints a snapshot every 60 seconds: total transactions, successes versus failures, throughput, unique fee payers, and total fees in SOL. Press Ctrl+C for one last snapshot before the script exits.
Extending the script
A few directions to take this further:- Decode instruction discriminators to label trades as
buy/sell/createโ see Decoding Transaction Data for the parsing pattern. - Persist the rolling stats to a database (Postgres, Redis, ClickHouse) instead of in-memory
Set/ counters. - Alert on thresholds โ large fee payers, sudden volume spikes, new bonding-curve accounts.
- Replay missed activity on startup by setting
fromSlotonSubscribeRequest(up to 24 hours back โ see Historical Replay). - Combine with Slot & Block Monitoring for block-level context.
Next Steps
Transaction Monitoring
The general transaction-filtering patterns this script uses.
Decoding Transaction Data
Parse the binary transaction payload into readable Solana transactions.
Account Subscriptions
Watch specific account state changes with filters.
Historical Replay
Replay up to 24h of past Pump.fun activity from a starting slot.