{"id":30360453,"url":"https://github.com/chainstacklabs/pumpfun-bonkfun-bot","last_synced_at":"2026-05-15T13:35:28.481Z","repository":{"id":256107475,"uuid":"854340390","full_name":"chainstacklabs/pumpfun-bonkfun-bot","owner":"chainstacklabs","description":"A fully functional pump.fun / letsbonk.fun trading and sniping bot not relying on any 3rd party APIs","archived":false,"fork":false,"pushed_at":"2026-04-27T16:09:16.000Z","size":1142,"stargazers_count":928,"open_issues_count":8,"forks_count":332,"subscribers_count":27,"default_branch":"main","last_synced_at":"2026-04-27T16:14:11.892Z","etag":null,"topics":["bonkbot","bonkfun","letsbonk","letsbonkfun","pumpdotfun","sniper","solana","trading"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainstacklabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":"MAINTAINERS.md","copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2024-09-09T01:47:00.000Z","updated_at":"2026-04-27T16:09:45.000Z","dependencies_parsed_at":"2024-09-09T03:26:16.886Z","dependency_job_id":"47e298ff-6f3a-4b33-b80d-38d02fa5a76d","html_url":"https://github.com/chainstacklabs/pumpfun-bonkfun-bot","commit_stats":null,"previous_names":["chainstacklabs/pump-fun-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chainstacklabs/pumpfun-bonkfun-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fpumpfun-bonkfun-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fpumpfun-bonkfun-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fpumpfun-bonkfun-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fpumpfun-bonkfun-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainstacklabs","download_url":"https://codeload.github.com/chainstacklabs/pumpfun-bonkfun-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainstacklabs%2Fpumpfun-bonkfun-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33068702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bonkbot","bonkfun","letsbonk","letsbonkfun","pumpdotfun","sniper","solana","trading"],"created_at":"2025-08-19T14:02:33.518Z","updated_at":"2026-05-15T13:35:28.475Z","avatar_url":"https://github.com/chainstacklabs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cimg width=\"1200\" alt=\"Labs\" src=\"https://user-images.githubusercontent.com/99700157/213291931-5a822628-5b8a-4768-980d-65f324985d32.png\"\u003e\n\n\u003cp\u003e\n \u003ch3 align=\"center\"\u003eChainstack is the leading suite of services connecting developers with Web3 infrastructure\u003c/h3\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  • \u003ca target=\"_blank\" href=\"https://chainstack.com/\"\u003eHomepage\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/protocols/\"\u003eSupported protocols\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://chainstack.com/blog/\"\u003eChainstack blog\u003c/a\u003e •\n  \u003ca target=\"_blank\" href=\"https://docs.chainstack.com/quickstart/\"\u003eBlockchain API reference\u003c/a\u003e • \u003cbr\u003e \n  • \u003ca target=\"_blank\" href=\"https://console.chainstack.com/user/account/create\"\u003eStart for free\u003c/a\u003e •\n\u003c/p\u003e\n\nThe 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.\n\nFor the full walkthrough, see [Solana: Creating a trading and sniping pump.fun bot](https://docs.chainstack.com/docs/solana-creating-a-pumpfun-bot).\n\nFor near-instantaneous transaction propagation, you can use the [Chainstack Solana Trader nodes](https://docs.chainstack.com/docs/trader-nodes).\n\nFor instant updates from the network, you can enable [Yellowstone gRPC Geyser plugin](https://docs.chainstack.com/docs/yellowstone-grpc-geyser-plugin) (Jito ShredStream enabled by default).\n\nThe official maintainers are in the [MAINTAINERS.md](MAINTAINERS.md) file. Leave your feedback by opening **Issues**.\n\n\u003e **Also by Chainstack** — if you prefer a terminal interface or want to give an AI agent trading capabilities:\n\u003e - [**pumpfun-cli**](https://github.com/chainstacklabs/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.\n\u003e - [**pumpclaw**](https://github.com/chainstacklabs/pumpclaw) — agent skill that equips AI assistants (OpenClaw, Claude Code, Cursor, Codex) with the ability to operate pumpfun-cli.\n\n---\n\n**🚨 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.\n\n**⚠️ 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).\n\n---\n\n\n## 🚀 Getting started\n\n### Prerequisites\n- Install [uv](https://github.com/astral-sh/uv), a fast Python package manager.\n\n\u003e If Python is already installed, `uv` will detect and use it automatically.\n\n### Installation\n\n#### 1️⃣ Clone the repository\n```bash\ngit clone https://github.com/chainstacklabs/pump-fun-bot.git\ncd pump-fun-bot\n```\n\n#### 2️⃣ Set up a virtual environment\n```bash\n# Create virtual environment\nuv sync\n\n# Activate (Unix/macOS)\nsource .venv/bin/activate  \n\n# Activate (Windows)\n.venv\\Scripts\\activate\n```\n\u003e Virtual environments help keep dependencies isolated and prevent conflicts.\n\n#### 3️⃣ Configure the bot\n```bash\n# Copy example config\ncp .env.example .env  # Unix/macOS\n\n# Windows\ncopy .env.example .env\n```\nEdit the `.env` file and add your **Solana RPC endpoints** and **private key**.\n\nEdit `.yaml` templates in the `bots/` directory. Each file is a separate instance of a trading bot. Examine its parameters and apply your preferred strategy.\n\nFor example, to run the pump.fun bot, set `platform: \"pump_fun\"`; to run the bonk.fun bot, set `platform: \"lets_bonk\"`.\n\n#### 4️⃣ Install the bot as a package\n```bash\nuv pip install -e .\n```\n\u003e **Why `-e` (editable mode)?** Lets you modify the code without reinstalling the package—useful for development!\n\n### Running the bot\n\n```bash\n# Option 1: run as installed package\npump_bot\n\n# Option 2: run directly\nuv run src/bot_runner.py\n```\n\n\u003e **You're all set! 🎉** \n\n---\n\n## Note on throughput \u0026 limits\n\nSolana is an amazing piece of web3 architecture, but it's also very complex to maintain.\n\nChainstack is daily (literally, including weekends) working on optimizing our Solana infrastructure to make it the best in the industry.\n\nThat said, all node providers have their own setup recommendations \u0026 limits, like method availability, requests per second (RPS), free and paid plan specific limitations and so on.\n\nSo 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.\n\nFor Chainstack, all of the details and limits you need to be aware of are consolidated here: [Throughput guidelines](https://docs.chainstack.com/docs/limits) \u003c— we are _always_ keeping this piece up to date so you can rely on it.\n\n### Built-in RPC Rate Limiting\n\nThe bot now includes built-in RPC rate limiting to prevent hitting provider limits:\n\n- **Token bucket algorithm**: Smoothly controls request rate while allowing short bursts\n- **Configurable max RPS**: Set `max_rps` parameter in `SolanaClient` (defaults to 25 RPS)\n- **Automatic retry logic**: Handles 429 (Too Many Requests) errors with exponential backoff\n- **Shared session management**: Reuses connections for improved performance\n\nThis helps ensure reliable operation within your node provider's rate limits without manual throttling.\n\n## IDLs\n\nThe IDLs under [`idl/`](idl/) are vendored from [pump-fun/pump-public-docs](https://github.com/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.\n\n\u003e **The IDL is incomplete.** It doesn't list two PDAs that the on-chain program actually requires:\n\u003e - `bonding-curve-v2` — required on every BC `buy` (18 accounts) and `sell` (16/17 accounts). Seed: `[\"bonding-curve-v2\", mint]` under the pump program.\n\u003e - `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.\n\u003e\n\u003e Always cross-check your account lists against a recent successful on-chain tx (`getSignaturesForAddress` + `getTransaction`) before trusting the IDL.\n\n## 2026-04-28 program upgrade\n\nPump.fun shipped a breaking program upgrade on **2026-04-28 16:00 UTC** ([BREAKING_FEE_RECIPIENT.md](https://github.com/pump-fun/pump-public-docs/blob/main/docs/BREAKING_FEE_RECIPIENT.md)). The bot is updated for it:\n\n- BC `buy` ix is now **18 accounts** (was 17). Trailing account is one of 8 `BREAKING_FEE_RECIPIENTS` (mutable), AFTER `bonding-curve-v2`.\n- BC `sell` ix is now **16 accounts non-cashback / 17 cashback** (was 15/16). Same trailing fee recipient.\n- 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.\n\nThe 8 fee recipients are randomized per tx in code (per pump.fun's recommendation to spread program-tx throughput).\n\n## Changelog\n\nQuick note on a couple on a few new scripts in `/learning-examples`:\n\n*(this is basically a changelog now)*\n\nAlso, here's a quick doc: [Listening to pump.fun migrations to Raydium](https://docs.chainstack.com/docs/solana-listening-to-pumpfun-migrations-to-raydium)\n\n## Bonding curve state check\n\n`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.\n\nTo run:\n\n`uv run learning-examples/bonding-curve-progress/get_bonding_curve_status.py TOKEN_ADDRESS`\n\n## Listening to the Pump AMM migration\n\nWhen the bonding curve state completes, the liquidity and the token graduate to Pump AMM (PumpSwap).\n\n`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.\n\n`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).\n\nNote that it's using the [blockSubscribe]([url](https://docs.chainstack.com/reference/blocksubscribe-solana)) method that not all providers support, but Chainstack does and I (although obviously biased) found it pretty reliable.\n\nTo run:\n\n`uv run learning-examples/listen-migrations/listen_logsubscribe.py`\n\n`uv run learning-examples/listen-migrations/listen_blocksubscribe_old_raydium.py`\n\n**The following two new additions are based on this question [associatedBondingCurve #26](https://github.com/chainstacklabs/pump-fun-bot/issues/26)**\n\nYou can take the compute the associatedBondingCurve address following the [Solana docs PDA](https://solana.com/docs/core/pda) description logic. Take the following as input *as seed* (order seems to matter):\n\n- bondingCurve address\n- the Solana system token program address: `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`\n- the token mint address\n\nAnd compute against the Solana system associated token account program address: `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`.\n\nThe implications of this are kinda huge:\n* you can now use `logsSubscribe` to snipe the tokens and you are not limited to the `blockSubscribe` method\n* see which one is faster\n* not every provider supports `blockSubscribe` on lower tier plans or at all, but everyone supports `logsSubscribe`\n\nThe following script showcase the implementation.\n\n## Compute associated bonding curve\n\n`compute_associated_bonding_curve.py` — computes the associated bonding curve for a given token.    \n\nTo run:\n\n`uv run learning-examples/compute_associated_bonding_curve.py` and then enter the token mint address.\n\n## Listen to new tokens\n\n`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](https://github.com/chainstacklabs/pump-fun-bot/issues/87)) and no extra calls like doing `getTransaction` to get the missing data. It's just computed on the fly now.\n\nTo run:\n\n`uv run learning-examples/listen-new-tokens/listen_logsubscribe_abc.py`\n\nSo now you can run `compare_listeners.py` see which one is faster.\n\n`uv run learning-examples/listen-new-tokens/compare_listeners.py`\n\nAlso here's a doc on this: [Solana: Listening to pump.fun token mint using only logsSubscribe](https://docs.chainstack.com/docs/solana-listening-to-pumpfun-token-mint-using-only-logssubscribe)\n\n---\n\n# Pump.fun bot development roadmap (March - April 2025, mostly completed)\n\n~~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.~~\n\nAs of April 30, 2025, all changes from **refactored/main-v2** are merged into the **main** version.\n\n| Stage | Feature | Comments | Implementation status |\n|-------|---------|----------|---------------------|\n| **Stage 1: General updates \u0026 QoL** | Lib updates | Updating to the latest libraries | ✅ |\n| | Error handling | Improving error handling | ✅ |\n| | Configurable RPS | Ability to set RPS in the config to match your provider's and plan RPS (preferably [Chainstack](https://console.chainstack.com/) 🤩) | ✅ |\n| | Dynamic priority fees | Ability to set dynamic priority fees | ✅ |\n| | Review \u0026 optimize `json`, `jsonParsed`, `base64` | Improve speed and traffic for calls, not just `getBlock`. [Helpful overview](https://docs.chainstack.com/docs/solana-optimize-your-getblock-performance#json-jsonparsed-base58-base64).| ✅ | \n| **Stage 2: Bonding curve and migration management** | `logsSubscribe` integration | Integrate `logsSubscribe` instead of `blockSubscribe` for sniping minted tokens into the main bot | ✅ |\n| | Dual subscription methods | Keep both `logsSubscribe` \u0026 `blockSubscribe` in the main bot for flexibility and adapting to Solana node architecture changes | ✅ |\n| | Transaction retries | Do retries instead of cooldown and/or keep the cooldown | ✅ |\n| | Bonding curve status tracking | Checking a bonding curve status progress. Predict how soon a token will start the migration process | ✅ | \n| | Account closure script | Script to close the associated bonding curve account if the rest of the flow txs fails | ✅ |\n| | PumpSwap migration listening | pump_fun migrated to their own DEX — [PumpSwap](https://x.com/pumpdotfun/status/1902762309950292010), so we need to FAFO with that instead of Raydium (and attempt `logSubscribe` implementation) | ✅ |\n| **Stage 3: Trading experience** | Take profit/stop loss | Implement take profit, stop loss exit strategies | ✅ |\n| | Market cap-based selling | Sell when a specific market cap has been reached | Not started |\n| | Copy trading | Enable copy trading functionality | Not started |\n| | Token analysis script | Script for basic token analysis (market cap, creator investment, liquidity, token age) | Not started |\n| | Archive node integration | Use Solana archive nodes for historical analysis (accounts that consistently print tokens, average mint to raydium time) | Not started |\n| | Geyser implementation | Leverage Solana Geyser for real-time data stream processing | ✅ |\n| **Stage 4: Minting experience** | Token minting | Ability to mint tokens (based on user request - someone minted 18k tokens) | ✅ |\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Fpumpfun-bonkfun-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainstacklabs%2Fpumpfun-bonkfun-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainstacklabs%2Fpumpfun-bonkfun-bot/lists"}