Solana: Listen to pump.fun mints via logsSubscribe
Capture newly created pump.fun tokens in real time by subscribing to Solana program logs with logsSubscribe and decoding mint event data.
TLDR:
This script captures newly created pump.fun tokens by subscribing solely to program logs (logsSubscribe).
On seeing the “Create” instruction, it decodes the token name, symbol, URI, mint address, bonding curve address, and user, then computes the associated bonding curve address.
This eliminates the need for extra RPC calls (like blockSubscribe or getTransaction), giving real-time data to enable fast sniping of newly minted tokens.
Compare it with blockSubscribe in separate scripts to see which offers quicker event detection in your setup.
This guide shows you how to listen for pump.fun token creation events in real time using only the logsSubscribe method.In the pumpfun-bonkfun-bot repository, the cookbook/pumpfun/listen/pumpfun_listen_tokens_logsubscribe.py script demonstrates how to capture the new token’s name, symbol, mint address, user (creator), bonding curve address, and associated bonding curve address—no methods like blockSubscribe or extra RPC calls like getTransaction are required.There’s difference in speed in how blockSubscribe and logsSubscribe work. Also, blockSubscribe is available on all Chainstack plans, but with other providers, it may not be available on the free tier plans or even lower tier paid plans.There is also difference in how blockSubscribe and logsSubscribe work, hence this article and example.
blockSubscribe — extracts and decodes transactions as the are streamed in the blocks produced. And the script in the bot decodes them on the fly. This means that we get all the necessary data to do our sniping using the blockSubscribe method.
logsSubscribe — only prints the pump.fun program logs, in our case—for token mints. The problem is we can get and decode from the logs the new token’s name, symbol, mint address, user (creator), and bonding curve address. But the logs do not contain the associated bonding curve address, which we need to do a sniping/buying transaction.
The script discussed in this article (cookbook/pumpfun/listen/pumpfun_listen_tokens_logsubscribe.py) solves the issue by computing the associated bonding curve address from the bonding curve address on the fly and prints it. This way it makes it possible to snipe tokens on pump.fun using the logsSubscribe method only. which in general has better availability across providers and may work faster for you.
Note on blockSubscribe limitations: While blockSubscribe provides transaction data, it has known stability issues with high-traffic programs—including connection errors (1006, 1009) and data skipping. For the most reliable real-time data streaming, Geyser is recommended by the Solana team. See our Geyser guide for the fastest and most stable implementation. Learn more about Yellowstone Geyser.
The script subscribes to Solana logs mentioning the pump.fun program (PUMP_PROGRAM).
Whenever the program logs an Instruction: Create event, the script looks at the Program data: line in the logs.
It decodes the data on-the-fly and extracts:
The token name
The token symbol
The token URI
The token mint address
The bonding curve address
The user (creator) address
It then computes the associated bonding curve address (similar to how an associated token account is derived) via Pubkey.find_program_address().
By using logsSubscribe, you can get new token details almost immediately, which is especially handy if you want to “snipe” tokens the moment they are created.
Deploy a reliable Solana RPC endpoint to get started.Start for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Print details Outputs the transaction signature, plus the fields noted above, along with the computed associated bonding curve.
Because we rely on logs only, we do not need extra calls like getTransaction. This approach is ideal if you want to immediately act on the new token creation events in your trading or monitoring workflows.
The repository’s cookbook/pumpfun/listen/ directory has a listener for each method — pumpfun_listen_tokens_logsubscribe.py (logs only), pumpfun_listen_tokens_blocksubscribe.py, pumpfun_listen_tokens_geyser.py, and pumpfun_listen_tokens_pumpportal.py — and tools/compare_listeners.py runs them side by side and reports which detects a new token first:
uv run tools/compare_listeners.py
Use it to see which method delivers the event data faster in your environment.