SkillAgentSearch skills...

Pumpfun Bonkfun Bot

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

Install / Use

npx skills add chainstacklabs/pumpfun-bonkfun-bot

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<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>

A Solana trading bot for pump.fun and letsbonk.fun. Its core feature is sniping new tokens: it watches for token creation, buys, and exits on a strategy you configure. learning-examples/ contains standalone scripts covering every piece of the flow — listeners, price math, manual buys and sells — useful on their own even if you never run the bot.

For the full walkthrough, see Solana: Creating a trading and sniping pump.fun bot. It explains the concepts well but lags behind the code, so treat this README as the source of truth for setup and configuration.

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 the 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: The Issues section is regularly targeted by scam bots that try to redirect you to an external site and drain your funds. A GitHub Action tags the common patterns, which is not 100% accurate. Deleted comments in issues are scam bots after your private keys — genuine outside devs are welcome and appreciated.

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


Getting started

1. Prerequisites

Install uv, a fast Python package manager. The project needs Python 3.11+; uv uses an existing install if it's new enough, otherwise it fetches one for you.

2. Clone and install

git clone https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
cd pumpfun-bonkfun-bot

uv sync                        # create .venv and install dependencies
source .venv/bin/activate      # Unix/macOS — Windows: .venv\Scripts\activate
uv pip install -e .            # install the bot as an editable package

3. Set your credentials

cp .env.example .env

Fill in .env:

| Variable | Purpose | |---|---| | SOLANA_NODE_RPC_ENDPOINT | HTTPS RPC endpoint | | SOLANA_NODE_WSS_ENDPOINT | WebSocket endpoint (for logs / blocks listeners) | | SOLANA_PRIVATE_KEY | Base58 private key of the trading wallet | | GEYSER_ENDPOINT, GEYSER_API_TOKEN, GEYSER_AUTH_TYPE | Only for the geyser listener |

Public RPC nodes will not work for this workload — see throughput below.

4. Configure a bot

Each YAML file in bots/ is one bot instance. They ship with commented defaults; start from the one matching the listener you want:

| File | Listener | Ships with | |---|---|---| | bot-sniper-1-geyser.yaml | geyser — fastest, needs a Geyser endpoint | pump_fun | | bot-sniper-2-logs.yaml | logslogsSubscribe, supported everywhere | pump_fun | | bot-sniper-3-blocks.yaml | blocksblockSubscribe, not supported by every provider | pump_fun | | bot-sniper-4-pp.yaml | pumpportal — third-party aggregator | lets_bonk |

Set platform: "pump_fun" or platform: "lets_bonk". pump.fun supports all four listeners; letsbonk.fun supports blocks, geyser, and pumpportal but not logs. The bot validates the pairing at startup and refuses to run an invalid one.

Set enabled: false to keep a config around without running it. Every bot with enabled: true starts when you run the bot.

5. Run

pump_bot                   # as an installed package
uv run src/bot_runner.py   # or directly

Logs land in logs/{bot_name}_{timestamp}.log.

Configuration reference

The YAML files are commented inline. The sections that matter most:

  • tradebuy_amount (in SOL), slippage, exit_strategy (time_based, tp_sl, manual), and extreme_fast_mode, which skips the bonding-curve price check and buys a fixed token amount instead. Faster, less precise. See Extreme fast mode for the zero-RPC behavior and its two knobs, trust_create_event and curve_refresh_budget.
  • priority_fees — fixed or dynamic. Dynamic costs an extra RPC call, which slows the buy.
  • filterslistener_type, max_token_age, name/creator matching, marry_mode (buy only, never sell), yolo_mode (trade continuously).
  • retries — attempts and the wait windows around creation, buy, and the next token.
  • cleanup — when to close leftover token accounts: disabled, on_fail, after_sell, post_session.
  • node.max_rps — cap requests per second to match your provider's plan.

Extreme fast mode: zero-RPC buys

With extreme_fast_mode: true the bot buys a fixed token amount (extreme_fast_token_amount) instead of fetching the curve price first. For tokens detected through the on-chain CreateEvent — the geyser, logs and blocks listeners — the buy is built entirely from the event: the canonical creator, mayhem/cashback flags and quote mint are all in it, so no RPC call happens between detecting the token and submitting the buy. That is the point of the mode; a single account read costs ~40–50 ms even on a good endpoint, a tenth of a slot.

The pumpportal listener can't do this — its payload carries none of those fields — so it performs one batched account read (bonding curve + mint in a single slot-consistent getMultipleAccounts) before buying. If the curve isn't readable within trade.curve_refresh_budget seconds (default 2.0), the token is skipped: a buy built from guessed accounts reverts on-chain with NotAuthorized (6000) or ConstraintSeeds (2006) and still costs the fee. The same skip applies to any token whose event data was incomplete.

trade.trust_create_event: false turns the zero-RPC path off and forces the pre-buy read for every listener — the safe fallback if pump.fun changes what the CreateEvent carries.

Machine checks: learning-examples/verify_extreme_fast_zero_rpc.py (the zero-RPC contract per listener) and learning-examples/verify_pumpportal_buy_path.py (the refresh/skip path). Neither moves funds.

Non-SOL quote assets

pump.fun supports quote assets other than SOL, USDC first. Amounts are in that mint's own whole units, so usdc: 1.0 is one USDC and is not comparable to buy_amount:

trade:
  buy_amount: 0.0001    # SOL-paired coins
  quote_amounts:
    usdc: 1.0           # USDC-paired coins

filters:
  allowed_quote_mints: ["sol", "usdc"]   # omit to allow any configured quote

Keys accept the aliases sol / wsol / usdc or a raw base58 mint. A coin whose quote mint has no configured amount is skipped with a log line rather than bought with a wrongly-scaled amount. SOL always falls back to buy_amount, so existing configs keep working untouched. Buying a USDC-paired coin needs USDC in the wallet plus a little SOL for fees and ATA rent.

Learning examples

Standalone scripts, runnable with uv run <path>. No bot config needed — they read .env directly.

| Path | What it covers | |---|---| | listen-new-tokens/ | One listener per method (logs, blocks, geyser, pumpportal) plus compare_listeners.py to race them | | listen-migrations/ | Detect a token graduating from the bonding curve to PumpSwap, via the migration wrapper program or new pool accounts | | bonding-curve-progress/ | Curve state, progress polling, and a live watch for coins close to graduating — over WebSocket (get_graduating_tokens.py) or Geyser (get_graduating_tokens_geyser.py), both taking --min-progress | | pumpswap/ | Manual buy/sell against the PumpSwap AMM, and pool discovery | | letsbonk-buy-sell/ | Manual exact-in / exact-out buys and sells on letsbonk.fun | | copy-trading/ | Watch another wallet's transactions | | manual_buy.py, manual_sell.py, fetch_price.py | The minimal pump.fun trade and price path. manual_buy.py --cu-optimized adds a SetLoadedAccountsDataSizeLimit instruction | | mint_and_buy_v2.py | Create a coin and buy it in one go | | decode_from_*.py, calculate_discriminator.py | Decoding account data, transactions, and Anchor discriminators | | cleanup_accounts.py | Close leftover empty token accounts |

Most of these take the mint or curve address as the first argument, and print usage if you leave it off. The decode_from_*.py scripts fall back to the saved fixtures beside them (raw_*.json), which are recaptured from mainnet rather than hand-edited — a stale fixture makes a working decoder look broken and a broken one look fine.

Two examples double as verification scripts to run after any pump.fun program upgrade:

uv run learning-examples/verify_v2_account_layout.py    # offline: account layouts, PDAs, encoding
uv run learning-examples/simulate_v2_trades.py <MINT>   # mainnet simulation, no funds moved
uv run learning-examples/verify_tx_status_checks.py     # offline: every example 

Related Skills

View on GitHub
GitHub Stars968
CategoryDevelopment
Updated1d ago
Forks343

Languages

Python

Security Score

100/100

Audited on Aug 7, 2026

No findings