How to detect new pump.fun tokens in real time (and stream every trade)
You do not need a paid data feed to see pump.fun launches the moment they happen. The pump.fun program writes every launch and every trade into its transaction logs, and any Solana WebSocket endpoint will stream those logs to you.
The idea
Solana lets you subscribe to the logs of every transaction that mentions an address. Mention the pump.fun program (6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P) and you receive every launch, buy and sell as it lands:
{ "jsonrpc": "2.0", "id": 1, "method": "logsSubscribe",
"params": [ { "mentions": ["6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"] },
{ "commitment": "processed" } ] }
Where the events are
Each notification carries the transaction's log lines. The program's events are the lines that start with Program data: followed by base64. The first eight bytes of the decoded data say which event it is:
| Event | First 8 bytes (hex) | What follows |
|---|---|---|
| Create | 1b72a94ddeeb6376 | name, symbol, uri (each a 4-byte length then UTF-8), then mint, bonding curve and creator (32 bytes each) |
| Trade | bddb7fd34ee661ee | mint (32), SOL amount (8), token amount (8), is-buy (1), trader (32), timestamp (8), virtual SOL (8), virtual tokens (8) |
From a Trade event you also get the market cap right after the trade: virtual SOL ÷ virtual tokens × one billion.
Three details people miss
- Failed transactions still log. If the notification's
erris not null, the events in it never happened. Drop them. - Events can appear twice. The program logs some events once itself and once through a self-call, so the same bytes show up twice in one transaction. De-duplicate within the transaction.
- The socket dies quietly. A Solana WebSocket can stop delivering without closing. Reconnect on silence, not only on close.
Working code
pump-stream handles the subscription, the decoding and the three details above, with no dependencies and no API key:
npx github:blixvip/pump-stream launches
npx github:blixvip/pump-stream trades --min 1
import { streamPump } from "pump-stream";
streamPump({
onLaunch: (coin) => console.log("new", coin.symbol, coin.name, coin.mint, "by", coin.creator),
onTrade: (t) => {
if (t.side === "buy" && t.sol >= 2) console.log(t.trader, "bought", t.sol, "SOL of", t.mint);
},
});
On the free public endpoint it decoded 1,205 trades and 9 launches in a 14-second test. To follow a single coin, pass mint: the subscription then mentions the mint and carries a fraction of the traffic.
What you get for a launch
The Create event gives you the name, ticker, mint, bonding curve and creator. The picture, description and social links are behind uri, a link to a JSON file, which you fetch separately.
Is this a sniper bot?
No. This is the listening half. It never signs a transaction and never needs a private key. Be careful with repositories that ask for one: many "pump.fun sniper" projects on GitHub exist to steal wallets.