Automated TypeScript script that buys back PumpFun tokens and adds 50/50 liquidity to the pool. Now with Telegram bot support for multi-user access!
- 🤖 Telegram Bot - Allow multiple users to run the script via Telegram
- 🔄 Automated Cycles - Automatically collects creator fees at the start of each cycle
- 💰 Smart Allocation - Uses 50% of SOL balance for buyback and liquidity cycles
- 💧 Liquidity Management - Adds 50/50 liquidity (tokens + SOL) to the pool
- 🔥 LP Token Burning - Automatically burns LP tokens after liquidity deposit
- 🛡️ Error Handling - Robust retry logic and error handling
- ⚙️ Multi-User Support - Each user can configure their own coin
npm install- Copy
.env.exampleto.env:
cp .env.example .env- Edit
.envand add your credentials:
RPC_ENDPOINT=https://api.mainnet-beta.solana.com
PRIVATE_KEY=your_private_key_here
MINT_ADDRESS=your_token_mint_address_here
SLIPPAGE=0.15
Optional Configuration:
SLIPPAGE- Slippage tolerance (default: 0.15 = 15%). Increase for volatile tokens (e.g., 0.20 for 20%)LP_TOKEN_MINT- LP token mint address (default: 5DXmqgrTivkdwg43UMU1YSV5WAvVmgvjBxsVP1aLV4Dk)MIN_BALANCE_SOL- Minimum SOL balance to trigger auto-run cycle (default: 0.5 SOL)CHECK_INTERVAL_MS- Interval between balance checks in milliseconds (default: 60000 = 60 seconds)AUTO_RUN- Enable/disable auto-run mode (default: true). Set tofalseto run once and exit
The private key can be provided in two formats:
- JSON array:
[1,2,3,4,...](64 numbers) - Base58 string: Your base58 encoded private key
- Get a Telegram Bot Token from @BotFather
- Create a
.envfile:TELEGRAM_BOT_TOKEN=your-bot-token-here RPC_ENDPOINT=https://api.mainnet-beta.solana.com
- Build and start:
npm run build npm start
- Open Telegram, find your bot, and send
/start - Use
/setupto configure your coin (private key & mint address) - Use
/runto execute a cycle or/start_autofor automatic cycles
Bot Commands:
/start- Welcome message and help/setup- Configure your coin (private key & mint address)/run- Execute a single liquidity cycle/start_auto- Start automatic cycles (runs every 2 minutes)/stop- Stop automatic cycles/status- Check your current configuration/help- Show help message
For running with environment variables (single coin):
npm run devnpm run build
npm startThe script runs continuously, executing cycles at regular intervals:
- Cycle Execution: Runs the full liquidity cycle every 60 seconds (configurable)
- Fee Collection: At the start of each cycle, collects any available creator fees
- Balance Check: After fee collection, checks if sufficient balance exists
- Conditional Execution: If balance is sufficient, proceeds with buyback and liquidity
- Repeat: Waits for next check interval and repeats
Set AUTO_RUN=false in .env to run once and exit.
- Collect Creator Fees: Collects any available creator fees from the pool
- Balance Check: Checks the SOL balance (after fee collection)
- Allocation:
- 49% SOL for token swap
- 49% SOL for liquidity
- 2% SOL reserved for fees
- Token Swap: Swaps 49% of SOL for tokens using PumpFun swap
- Liquidity Deposit: Deposits tokens + remaining SOL (50/50) into the liquidity pool
- LP Token Burn: Burns all received LP tokens by sending them to the burn address
⚠️ Never commit your.envfile - it contains sensitive private keys- The script uses 15% slippage tolerance by default (configurable)
- Auto-run mode runs continuously - use Ctrl+C to stop
- Ensure you have sufficient SOL for transactions (minimum 0.5 SOL recommended for auto-run)
- All transactions are confirmed before proceeding to next step
- The script will automatically retry on errors during monitoring
For running the bot on a server 24/7, see DEPLOYMENT.md for detailed instructions.
Quick Start with PM2:
npm install -g pm2
npm run build
pm2 start dist/index.js --name pumpfun-bot
pm2 save
pm2 startup@pump-fun/pump-swap-sdk- PumpFun swap SDK@pump-fun/pump-sdk- PumpFun SDK (for creator fee collection)@solana/web3.js- Solana Web3 library@solana/spl-token- SPL Token librarynode-telegram-bot-api- Telegram Bot APIdotenv- Environment variable management
- Private keys are stored in memory only and cleared when the bot restarts
- Never share your bot token or private keys
- Each user's data is isolated in memory
- For production use, consider adding encryption for stored private keys