- This Python-based Solana bot monitors the pump.fun on-chain program to detect new tokens, automatically buys them, and optionally sells them soon after. The same bot also supports letsbonk.fun via a config switch.
- It decodes transaction data using the pump.fun Anchor IDL, fetching token details like mint addresses and bonding curves.
- You configure one or more bot instances as
.yamlfiles in thebots/directory (strategy, slippage, priority fees, exit rules) and run them withpump_bot. - Learning examples provide reference scripts on Anchor discriminators, price fetching, and subscribing to Solana websockets via
logsSubscribe,blockSubscribe, and Geyser.
Run Solana nodes on Chainstack
You can run global, regional, or specialized nodes with warp transactions with Chainstack.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.Overview
The project uses the pump.fun IDL to interact with the program and the accounts. It’s very useful to know that the pump.fun program and all the associated accounts is built with the Anchor framework, as a lot of the decoding comes back to Anchor, like the 8 byte instruction signatures/discriminators. The other thing important to know is that the tokens created with pump.fun are 6 decimal tokens, which is different from the default Solana 9 decimal SPL tokens. The bot subscribes over WebSocket to a Solana mainnet RPC node and extracts all the newly minted coins created by the pump.fun main program ID 6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P. It can listen withlogsSubscribe (supported by every provider), blockSubscribe, or a Geyser stream for the lowest latency.
Once a new coin is minted, the bot buys it and then exits according to your configured strategy. When a token’s bonding curve completes, its liquidity graduates to PumpSwap—pump.fun’s own AMM. You set the behavior per bot instance in a .yaml config file; see Configure and run the bot.
Implementation
The bot is installed and run with uv. Your secrets—RPC HTTP and WebSocket endpoints, the wallet private key, and optional Geyser credentials—go in a.env file, and each bot instance is a .yaml file in the bots/ directory. The core logic has two paths: a listener that detects new tokens, and the buy/sell execution.
Listener
To construct a buy (and later a sell) transaction, the bot needs the global program and account addresses plus the new token’s variables:mint— the created token addressbondingCurve— the bonding curve account for the new token; this account defines the token priceassociatedBondingCurve— the associated token account that holds the tokens bought and sold against the bonding curve
logsSubscribe— subscribes to the pump.fun program logs and derives theassociatedBondingCurveon the fly (it is a PDA of thebondingCurve, the token program, and themint). This works on every provider and is the default path.blockSubscribe— subscribes to full blocks filtered to the pump.fun program’screateinstruction and extracts the addresses. Reliable on Chainstack, but not every provider supports it.- Geyser — a gRPC stream for the lowest latency. See the Geyser implementation guide and Yellowstone Geyser.
Earlier versions of the bot relied on
blockSubscribe, which has stability issues with busy programs and isn’t available on every plan. The bot now defaults to logsSubscribe (deriving the associated bonding curve locally) and supports Geyser for production. See Solana: Listening to pump.fun token mint using only logsSubscribe.Buy and sell
Using themint and your wallet address (from the private key in .env), the bot creates an associated token account to hold the token, fetches the price from the bondingCurve account, and submits the buy. The sell path is the reverse and simpler—it fetches the price and submits a sell.
A couple of notes:
- The Anchor instruction discriminators are precalculated. See
learning-examples/calculate_discriminator.py. extreme_fast_mode(in the bot config) skips the bonding-curve stabilization wait and the RPC price check and buys a fixed token amount directly—faster, but less precise. With it off, the bot waits and price-checks first so the new token’s data has propagated across the cluster.
Configure and run the bot
Install
Configure
Copy.env.example to .env and add your Solana RPC endpoints and wallet private key. Then edit or copy a .yaml template in bots/—each file is a separate bot instance. Key settings:
platform—"pump_fun"(default) or"lets_bonk"to trade on letsbonk.fun insteadtrade.buy_amount,trade.buy_slippage,trade.sell_slippage— position size and slippage tolerancetrade.exit_strategy—"time_based","tp_sl"(take-profit/stop-loss), or"manual"trade.extreme_fast_mode— skip the price check and buy a fixed token amount for speedpriority_fees—enable_fixedwith afixed_amount, orenable_dynamic(estimates viagetRecentPrioritizationFees); see Solana: priority fees for faster transactionsfilters— restrict trading to tokens matching a name/symbol or created by a specific addressgeyser— endpoint and auth token for the Geyser listener
Run
bots/ runs as its own instance, so you can run several strategies at once.
This bot is for learning, not production. Also by Chainstack: pumpfun-cli (a terminal client for trading, launching, and managing tokens, with smart routing between the bonding curve and PumpSwap) and pumpclaw (an agent skill that lets AI assistants like Claude Code and Codex operate pumpfun-cli).
Learning examples
Thelearning-examples directory has many scripts for understanding how the bot works and how to interact with Solana. Highlights:
listen-new-tokens/listen_logsubscribe_abc.py— snipes new tokens using onlylogsSubscribe, deriving the associated bonding curve on the fly (no extragetTransactioncall)listen-new-tokens/compare_listeners.py— runs the listener methods side by side to see which detects new tokens firstbonding-curve-progress/get_bonding_curve_status.py— checks whether a token’s bonding curve is still active or has completedlisten-migrations/listen_logsubscribe.py— detects graduations to PumpSwap; see Listening to pump.fun migrations to PumpSwapcompute_associated_bonding_curve.py— derives the associated bonding curve PDA for a tokencalculate_discriminator.py— calculates Anchor instruction discriminators from the IDL inidl/pumpswap/— manual buy and sell examples against the PumpSwap AMMmanual_buy.py/manual_sell.py— manual buy and sell with parameters you provide
idl/ are vendored from pump-fun/pump-public-docs; refresh them from there when the program changes.
