Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

chainstacklabs/pumpfun-bonkfun-bot

Repository files navigation

Labs

Chainstack is the leading suite of services connecting developers with Web3 infrastructure

HomepageSupported protocolsChainstack blogBlockchain API reference
Start for free

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, seeSolana: Creating a trading and sniping pump.fun bot.

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

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

The official maintainers are in theMAINTAINERS.md file. Leave your feedback by openingIssues.


🚨 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

  • Installuv, a fast Python package manager.

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

Installation

1️⃣ Clone the repository

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

2️⃣ Set up a virtual environment

# Create virtual environmentuv 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

# Copy example configcp .env.example .env# Unix/macOS# Windowscopy .env.example .env

Edit the.env file and add yourSolana RPC endpoints andprivate key.

Edit.yaml templates in thebots/ 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, setplatform: "pump_fun"; to run the bonk.fun bot, setplatform: "lets_bonk".

4️⃣ Install the bot as a package

uv pip install -e.

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

Running the bot

# Option 1: run as installed packagepump_bot# Option 2: run directlyuv 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 arealways keeping this piece up to date so you can rely on it.

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 questionassociatedBondingCurve #26

You can take the compute the associatedBondingCurve address following theSolana docs PDA description logic. Take the following as inputas 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 uselogsSubscribe to snipe the tokens and you are not limited to theblockSubscribe method
  • see which one is faster
  • not every provider supportsblockSubscribe on lower tier plans or at all, but everyone supportslogsSubscribe

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 thelogsSubscribe method. Basically everything you need for sniping using justlogsSubscribe (with somelimitations) and no extra calls like doinggetTransaction 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 runcompare_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 therefactored/main-v2 branch is signficantly better over themain version, so the suggestion is to FAFO with v2.

As of April 30, 2025, all changes fromrefactored/main-v2 are merged into themain 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 (preferablyChainstack 🤩)Not started
Dynamic priority feesAbility to set dynamic priority fees
Review & optimizejson,jsonParsed,base64Improve speed and traffic for calls, not justgetBlock.Helpful overview.
Stage 2: Bonding curve and migration managementlogsSubscribe integrationIntegratelogsSubscribe instead ofblockSubscribe for sniping minted tokens into the main bot
Dual subscription methodsKeep bothlogsSubscribe &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 attemptlogSubscribe 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)

Development timeline

  • Development begins: Week of March 10, 2025
  • Implementation approach: Gradual rollout in separate branch
  • Priority: Stages progress from simple to complex features
  • Completion guarantee: Full completion of Stage 1, other stages dependent on feedback and feasibility

About

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

Topics

Resources

License

Stars

Watchers

Forks

Contributors7

Languages


[8]ページ先頭

©2009-2025 Movatter.jp