Skip to main content
TLDR
  • 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 .yaml files in the bots/ directory (strategy, slippage, priority fees, exit rules) and run them with pump_bot.
  • Learning examples provide reference scripts on Anchor discriminators, price fetching, and subscribing to Solana websockets via logsSubscribe, blockSubscribe, and Geyser.
The pump.fun project is generating millions of USD in fees and in the volume as evidenced by pump.fun DefiLlama project page. On top of that, there are project clones popping up. There are no API endpoints provided by pump.fun itself. At the same time, there are a few third-party projects out there that have figured out how to interact with the pump.fun on-chain programs & accounts and what these are, and they now provide the APIs. In this project, you’ll get to be able to directly interact with the pump.fun program & accounts.

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.
See the full project code, including learning examples, in the respective GitHub repository.

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 with logsSubscribe (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 address
  • bondingCurve — the bonding curve account for the new token; this account defines the token price
  • associatedBondingCurve — the associated token account that holds the tokens bought and sold against the bonding curve
The bot can obtain these addresses three ways, fastest last:
  • logsSubscribe — subscribes to the pump.fun program logs and derives the associatedBondingCurve on the fly (it is a PDA of the bondingCurve, the token program, and the mint). This works on every provider and is the default path.
  • blockSubscribe — subscribes to full blocks filtered to the pump.fun program’s create instruction 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 the mint 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.
pump.fun ships breaking on-chain program upgrades—for example, the 2026-04-28 fee-recipient change altered the buy/sell account lists. When the program changes, account lists and IDLs must be updated, so always cross-check against a recent successful transaction and pull the latest from the repository before running.

Configure and run the bot

Install

git clone https://github.com/chainstacklabs/pump-fun-bot.git
cd pump-fun-bot
uv sync
source .venv/bin/activate
uv pip install -e .

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 instead
  • trade.buy_amount, trade.buy_slippage, trade.sell_slippage — position size and slippage tolerance
  • trade.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 speed
  • priority_feesenable_fixed with a fixed_amount, or enable_dynamic (estimates via getRecentPrioritizationFees); see Solana: priority fees for faster transactions
  • filters — restrict trading to tokens matching a name/symbol or created by a specific address
  • geyser — endpoint and auth token for the Geyser listener

Run

# Run as the installed package
pump_bot

# Or run directly
uv run src/bot_runner.py
Each enabled bot in 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

The learning-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 only logsSubscribe, deriving the associated bonding curve on the fly (no extra getTransaction call)
  • listen-new-tokens/compare_listeners.py — runs the listener methods side by side to see which detects new tokens first
  • bonding-curve-progress/get_bonding_curve_status.py — checks whether a token’s bonding curve is still active or has completed
  • listen-migrations/listen_logsubscribe.py — detects graduations to PumpSwap; see Listening to pump.fun migrations to PumpSwap
  • compute_associated_bonding_curve.py — derives the associated bonding curve PDA for a token
  • calculate_discriminator.py — calculates Anchor instruction discriminators from the IDL in idl/
  • pumpswap/ — manual buy and sell examples against the PumpSwap AMM
  • manual_buy.py / manual_sell.py — manual buy and sell with parameters you provide
The IDLs in idl/ are vendored from pump-fun/pump-public-docs; refresh them from there when the program changes.

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on July 7, 2026