GitPedia

Pumpfun bonkfun bot

A fully functional pump.fun / letsbonk.fun trading and sniping bot not relying on any 3rd party APIs

From chainstacklabsΒ·Updated June 27, 2026Β·View on GitHubΒ·

Chainstack is the leading suite of services connecting developers with Web3 infrastructure The project is written primarily in Python, distributed under the Apache License 2.0 license, first published in 2024. Key topics include: bonkbot, bonkfun, letsbonk, letsbonkfun, pumpdotfun.

<img width="1200" alt="Labs" src="https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png"> <p> <h3 align="center">Chainstack is the leading suite of services connecting developers with Web3 infrastructure</h3> </p> <p align="center"> β€’ <a target="_blank" href="https://chainstack.com/">Homepage</a> β€’ <a target="_blank" href="https://chainstack.com/protocols/">Supported protocols</a> β€’ <a target="_blank" href="https://chainstack.com/blog/">Chainstack blog</a> β€’ <a target="_blank" href="https://docs.chainstack.com/quickstart/">Blockchain API reference</a> β€’ <br> β€’ <a target="_blank" href="https://console.chainstack.com/user/account/create">Start for free</a> β€’ </p>

The project allows you to create bots for trading on pump.fun and letsbonk.fun. Its core feature is to snipe new tokens. Besides that, learning examples contain a lot of useful scripts for different types of listeners (new tokens, migrations) and deep dive into calculations required for trading.

For the full walkthrough, see Solana: Creating a trading and sniping pump.fun bot.

For near-instantaneous transaction propagation, you can use the Chainstack Solana Trader nodes.

For instant updates from the network, you can enable Yellowstone gRPC Geyser plugin (Jito ShredStream enabled by default).

The official maintainers are in the MAINTAINERS.md file. Leave your feedback by opening Issues.

Also by Chainstack β€” if you prefer a terminal interface or want to give an AI agent trading capabilities:

  • pumpfun-cli β€” CLI for trading, launching, and managing tokens on pump.fun; buy, sell, wallet management, and smart routing between bonding curve and PumpSwap AMM.
  • pumpclaw β€” agent skill that equips AI assistants (OpenClaw, Claude Code, Cursor, Codex) with the ability to operate pumpfun-cli.

🚨 SCAM ALERT: Issues section is often targeted by scam bots willing to redirect you to an external resource and drain your funds. I have enabled a GitHub actions script to detect the common patterns and tag them, which obviously is not 100% accurate. This is also why you will see deleted comments in the issuesβ€”I only delete the scam bot comments targeting your private keys. Not everyone is a scammer though, sometimes there are helpful outside devs who comment and I absolutely appreciate it.

⚠️ NOT FOR PRODUCTION: This code is for learning purposes only. We assume no responsibility for the code or its usage. Modify for your needs and learn from it (examples, issues, and PRs contain valuable insights).


πŸš€ Getting started

Prerequisites

  • Install uv, a fast Python package manager.

If Python is already installed, uv will detect and use it automatically.

Installation

1️⃣ Clone the repository

bash
git clone https://github.com/chainstacklabs/pump-fun-bot.git cd pump-fun-bot

2️⃣ Set up a virtual environment

bash
# Create virtual environment uv sync # Activate (Unix/macOS) source .venv/bin/activate # Activate (Windows) .venv\Scripts\activate

Virtual environments help keep dependencies isolated and prevent conflicts.

3️⃣ Configure the bot

bash
# Copy example config cp .env.example .env # Unix/macOS # Windows copy .env.example .env

Edit the .env file and add your Solana RPC endpoints and private key.

Edit .yaml templates in the bots/ directory. Each file is a separate instance of a trading bot. Examine its parameters and apply your preferred strategy.

For example, to run the pump.fun bot, set platform: "pump_fun"; to run the bonk.fun bot, set platform: "lets_bonk".

4️⃣ Install the bot as a package

bash
uv pip install -e .

Why -e (editable mode)? Lets you modify the code without reinstalling the packageβ€”useful for development!

Running the bot

bash
# Option 1: run as installed package pump_bot # Option 2: run directly uv run src/bot_runner.py

You're all set! πŸŽ‰


Note on throughput & limits

Solana is an amazing piece of web3 architecture, but it's also very complex to maintain.

Chainstack is daily (literally, including weekends) working on optimizing our Solana infrastructure to make it the best in the industry.

That said, all node providers have their own setup recommendations & limits, like method availability, requests per second (RPS), free and paid plan specific limitations and so on.

So please make sure you consult the docs of the node provider you are going to use for the bot here. And obviously the public RPC nodes won't work for the heavier use case scenarios like this bot.

For Chainstack, all of the details and limits you need to be aware of are consolidated here: Throughput guidelines <β€” we are always keeping this piece up to date so you can rely on it.

Built-in RPC Rate Limiting

The bot now includes built-in RPC rate limiting to prevent hitting provider limits:

  • Token bucket algorithm: Smoothly controls request rate while allowing short bursts
  • Configurable max RPS: Set max_rps parameter in SolanaClient (defaults to 25 RPS)
  • Automatic retry logic: Handles 429 (Too Many Requests) errors with exponential backoff
  • Shared session management: Reuses connections for improved performance

This helps ensure reliable operation within your node provider's rate limits without manual throttling.

IDLs

The IDLs under idl/ are vendored from pump-fun/pump-public-docs. To refresh, copy pump.json, pump_amm.json, pump_fees.json from that repo into pump_fun_idl.json, pump_swap_idl.json, pump_fees.json respectively, and reference the upstream commit hash in your commit message.

The IDL is incomplete. It doesn't list two PDAs that the on-chain program actually requires:

  • bonding-curve-v2 β€” required on every BC buy (18 accounts) and sell (16/17 accounts). Seed: ["bonding-curve-v2", mint] under the pump program.
  • pool-v2 β€” required on every PumpSwap buy/sell. Seed: ["pool-v2", base_mint] under the pump-amm program. Without it, pump-amm throws AnchorError 6023 (Overflow) after the trade transfers complete β€” a misleading error code for a missing-account issue.

Always cross-check your account lists against a recent successful on-chain tx (getSignaturesForAddress + getTransaction) before trusting the IDL.

2026-04-28 program upgrade

Pump.fun shipped a breaking program upgrade on 2026-04-28 16:00 UTC (BREAKING_FEE_RECIPIENT.md). The bot is updated for it:

  • BC buy ix is now 18 accounts (was 17). Trailing account is one of 8 BREAKING_FEE_RECIPIENTS (mutable), AFTER bonding-curve-v2.
  • BC sell ix is now 16 accounts non-cashback / 17 cashback (was 15/16). Same trailing fee recipient.
  • PumpSwap buy/sell get +2 accounts appended after pool-v2: a fee recipient (readonly) and its quote-mint ATA (mutable). Counts: buy = 26 non-cashback / 27 cashback; sell = 24 / 26. Cashback pools insert user_volume_accumulator_quote_ata (writable) BEFORE pool-v2 on buys; sells insert both that ATA and user_volume_accumulator (both writable) BEFORE pool-v2. Detect cashback via pool data byte 244.

The 8 fee recipients are randomized per tx in code (per pump.fun's recommendation to spread program-tx throughput).

Changelog

Quick note on a couple on a few new scripts in /learning-examples:

(this is basically a changelog now)

Also, here's a quick doc: Listening to pump.fun migrations to Raydium

Bonding curve state check

get_bonding_curve_status.py β€” checks the state of the bonding curve associated with a token. When the bonding curve state is completed, the token is migrated to Raydium.

To run:

uv run learning-examples/bonding-curve-progress/get_bonding_curve_status.py TOKEN_ADDRESS

Listening to the Pump AMM migration

When the bonding curve state completes, the liquidity and the token graduate to Pump AMM (PumpSwap).

listen_logsubscribe.py β€” listens to the migration events of the tokens from bonding curves to AMM and prints the signature of the migration, the token address, and the liquidity pool address on Pump AMM.

listen_blocksubscribe_old_raydium.py β€” listens to the migration events of the tokens from bonding curves to AMM and prints the signature of the migration, the token address, and the liquidity pool address on Pump AMM (previously, tokens migrated to Raydium).

Note that it's using the blockSubscribe method that not all providers support, but Chainstack does and I (although obviously biased) found it pretty reliable.

To run:

uv run learning-examples/listen-migrations/listen_logsubscribe.py

uv run learning-examples/listen-migrations/listen_blocksubscribe_old_raydium.py

The following two new additions are based on this question associatedBondingCurve #26

You can take the compute the associatedBondingCurve address following the Solana docs PDA description logic. Take the following as input as seed (order seems to matter):

  • bondingCurve address
  • the Solana system token program address: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
  • the token mint address

And compute against the Solana system associated token account program address: ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL.

The implications of this are kinda huge:

  • you can now use logsSubscribe to snipe the tokens and you are not limited to the blockSubscribe method
  • see which one is faster
  • not every provider supports blockSubscribe on lower tier plans or at all, but everyone supports logsSubscribe

The following script showcase the implementation.

Compute associated bonding curve

compute_associated_bonding_curve.py β€” computes the associated bonding curve for a given token.

To run:

uv run learning-examples/compute_associated_bonding_curve.py and then enter the token mint address.

Listen to new tokens

listen_logsubscribe_abc.py β€” listens to new tokens and prints the signature, the token address, the user, the bonding curve address, and the associated bonding curve address using just the logsSubscribe method. Basically everything you need for sniping using just logsSubscribe (with some limitations) and no extra calls like doing getTransaction to get the missing data. It's just computed on the fly now.

To run:

uv run learning-examples/listen-new-tokens/listen_logsubscribe_abc.py

So now you can run compare_listeners.py see which one is faster.

uv run learning-examples/listen-new-tokens/compare_listeners.py

Also here's a doc on this: Solana: Listening to pump.fun token mint using only logsSubscribe


Pump.fun bot development roadmap (March - April 2025, mostly completed)

As of March 21, 2025, the bot from the refactored/main-v2 branch is signficantly better over the main version, so the suggestion is to FAFO with v2.

As of April 30, 2025, all changes from refactored/main-v2 are merged into the main version.

StageFeatureCommentsImplementation status
Stage 1: General updates & QoLLib updatesUpdating to the latest librariesβœ…
Error handlingImproving error handlingβœ…
Configurable RPSAbility to set RPS in the config to match your provider's and plan RPS (preferably Chainstack 🀩)βœ…
Dynamic priority feesAbility to set dynamic priority feesβœ…
Review & optimize json, jsonParsed, base64Improve speed and traffic for calls, not just getBlock. Helpful overview.βœ…
Stage 2: Bonding curve and migration managementlogsSubscribe integrationIntegrate logsSubscribe instead of blockSubscribe for sniping minted tokens into the main botβœ…
Dual subscription methodsKeep both logsSubscribe & blockSubscribe in the main bot for flexibility and adapting to Solana node architecture changesβœ…
Transaction retriesDo retries instead of cooldown and/or keep the cooldownβœ…
Bonding curve status trackingChecking a bonding curve status progress. Predict how soon a token will start the migration processβœ…
Account closure scriptScript to close the associated bonding curve account if the rest of the flow txs failsβœ…
PumpSwap migration listeningpump_fun migrated to their own DEX β€” PumpSwap, so we need to FAFO with that instead of Raydium (and attempt logSubscribe implementation)βœ…
Stage 3: Trading experienceTake profit/stop lossImplement take profit, stop loss exit strategiesβœ…
Market cap-based sellingSell when a specific market cap has been reachedNot started
Copy tradingEnable copy trading functionalityNot started
Token analysis scriptScript for basic token analysis (market cap, creator investment, liquidity, token age)Not started
Archive node integrationUse Solana archive nodes for historical analysis (accounts that consistently print tokens, average mint to raydium time)Not started
Geyser implementationLeverage Solana Geyser for real-time data stream processingβœ…
Stage 4: Minting experienceToken mintingAbility to mint tokens (based on user request - someone minted 18k tokens)βœ…

Contributors

Showing top 8 contributors by commit count.

View all contributors on GitHub β†’

This article is auto-generated from chainstacklabs/pumpfun-bonkfun-bot via the GitHub API.Last fetched: 6/29/2026