{"id":50886184,"url":"https://github.com/bitman09/pumpfun-sniper-bot","last_synced_at":"2026-06-15T17:03:58.748Z","repository":{"id":266302680,"uuid":"897966407","full_name":"bitman09/pumpfun-sniper-bot","owner":"bitman09","description":"The Solana Pump.fun sniper trading bot is an advanced automated tool designed for seamless #buy-#sell execution, optimizing real-time #trading efficiency and profitability on the #Pumpfun platform.","archived":false,"fork":false,"pushed_at":"2026-05-20T15:00:49.000Z","size":470,"stargazers_count":29,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-20T20:02:20.785Z","etag":null,"topics":["buy-sell","pump-fun","pumpfun-sniper","pumpfun-trading-bot","realtime-trading","sniper-bot","solana","solana-trade-bot","trading-bot"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitman09.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-03T14:54:24.000Z","updated_at":"2026-05-20T19:09:14.000Z","dependencies_parsed_at":"2026-05-20T20:03:36.508Z","dependency_job_id":null,"html_url":"https://github.com/bitman09/pumpfun-sniper-bot","commit_stats":null,"previous_names":["bitman310/pumpfun-buy-sell-bot","bitman09/pumpfun-buy-sell-bot","bitman09/pumpfun-sniper-bot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bitman09/pumpfun-sniper-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitman09%2Fpumpfun-sniper-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitman09%2Fpumpfun-sniper-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitman09%2Fpumpfun-sniper-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitman09%2Fpumpfun-sniper-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitman09","download_url":"https://codeload.github.com/bitman09/pumpfun-sniper-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitman09%2Fpumpfun-sniper-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34372156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["buy-sell","pump-fun","pumpfun-sniper","pumpfun-trading-bot","realtime-trading","sniper-bot","solana","solana-trade-bot","trading-bot"],"created_at":"2026-06-15T17:03:57.795Z","updated_at":"2026-06-15T17:03:58.740Z","avatar_url":"https://github.com/bitman09.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pump.fun Sniper\n\nA low-latency Solana Pumpfun Sniper bot that watches **Pump.fun** token launches in real time over a **Geyser** WebSocket feed, applies configurable filters, buys on the bonding curve, and exits automatically via take-profit, stop-loss, or timeout.\n\nBuilt with TypeScript, Anchor, and the official Pump.fun program IDL. Supports **Token-2022** mints (including transfer-fee harvest on cleanup).\n\n---\n\n## Table of contents\n\n- [How it works](#how-it-works)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Quick start](#quick-start)\n- [Configuration](#configuration)\n- [Exit logic](#exit-logic)\n- [Transaction submission](#transaction-submission)\n- [Scripts](#scripts)\n- [Project structure](#project-structure)\n- [Security](#security)\n- [Troubleshooting](#troubleshooting)\n- [Disclaimer](#disclaimer)\n\n---\n\n## How it works\n\n```mermaid\nsequenceDiagram\n    participant Geyser as Geyser WebSocket\n    participant Bot as index.ts\n    participant RPC as Solana RPC\n    participant PF as Pump.fun program\n\n    Geyser-\u003e\u003eBot: New tx on Pump.fun program\n    Bot-\u003e\u003eBot: Detect InitializeMint2 log\n    Bot-\u003e\u003eBot: Parse dev buy (SOL + tokens)\n    Bot-\u003e\u003eBot: Optional filters (social, dev buy, mcap)\n    alt SIMULATION_MODE=true\n        Bot-\u003e\u003eBot: Log only, no tx\n    else Live trading\n        Bot-\u003e\u003ePF: Buy on bonding curve\n        loop Every 500ms\n            Bot-\u003e\u003eRPC: Quote sell output (SOL)\n            Bot-\u003e\u003eBot: TP / SL / timeout?\n        end\n        Bot-\u003e\u003ePF: Sell full position\n    end\n```\n\n1. **Subscribe** — Opens a Geyser `transactionSubscribe` stream filtered to the Pump.fun program (`6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`).\n2. **Detect** — When logs contain `Instruction: InitializeMint2`, the bot treats the transaction as a new launch and extracts mint, bonding curve, and dev wallet from account keys.\n3. **Parse** — Reads the creator’s initial buy from inner instructions (`parseDevBuyFromInnerInstructions`) and resolves the token program (legacy SPL vs Token-2022).\n4. **Filter** — Optional checks: social links (X / Telegram / website), dev buy size band, minimum market cap wait.\n5. **Trade** — If `SIMULATION_MODE=false`, submits a buy then monitors unrealized SOL value until take-profit, stop-loss, or timeout triggers a sell.\n\nDetection latency is logged in milliseconds (`Date.now() - firstTime` at buy time).\n\n---\n\n## Features\n\n| Area | Capability |\n|------|------------|\n| **Speed** | Geyser `processed` commitment — reacts before typical polling RPC |\n| **Safety** | `SIMULATION_MODE` — full pipeline without sending transactions |\n| **Filters** | Dev buy min/max, market cap gate, X / Telegram / website validation |\n| **Risk** | Take-profit %, stop-loss %, position timeout (seconds) |\n| **Execution** | NextBlock, bloXroute, or standard RPC + compute budget priority fee |\n| **Tokens** | Token-2022 + legacy SPL; bonding curve PDA / creator vault from on-chain layout |\n| **Cleanup** | `npm run burn` — burn leftover balances and close ATAs (reclaim rent) |\n\n---\n\n## Requirements\n\n- **Node.js** 18+ (22 recommended per `devDependencies`)\n- A funded Solana wallet (base58-encoded secret key)\n- **Helius** (or compatible) endpoints:\n  - HTTP RPC + WebSocket RPC for reads, confirms, and quotes\n  - **Atlas Geyser** WebSocket for `transactionSubscribe` (see [Helius Geyser docs](https://docs.helius.dev/))\n- Optional paid infra for competitive inclusion:\n  - [NextBlock](https://nextblock.io/) API key (`NEXT_BLOCK_API`)\n  - [bloXroute](https://bloxroute.com/) auth header\n\nYou need enough SOL for buys, priority / tip fees, and rent for new ATAs.\n\n---\n\n## Quick start\n\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd pumpfun-sniper\nnpm install\ncp .env.example .env\n```\n\nEdit `.env`:\n\n1. Set `PRIVATE_KEY` (base58 secret key — **never commit this**).\n2. Set `RPC_ENDPOINT`, `RPC_WEBSOCKET_ENDPOINT`, and `GEYSER_RPC` with your provider API keys.\n3. Keep `SIMULATION_MODE=true` until filters and sizing look correct in logs.\n4. Set `NEXTBLOCK_MODE=true` and `NEXT_BLOCK_API` if you use NextBlock (default in `.env.example`).\n\nRun in simulation (recommended first):\n\n```bash\nnpm run dev\n```\n\nWhen ready for live trades:\n\n```bash\n# In .env\nSIMULATION_MODE=false\n\nnpm start\n```\n\n---\n\n## Configuration\n\nCopy `.env.example` to `.env`. All variables below are read at startup; missing required values exit the process.\n\n### Wallet \u0026 RPC\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `PRIVATE_KEY` | Yes | Base58-encoded wallet secret key |\n| `RPC_ENDPOINT` | Yes | HTTP RPC URL (e.g. Helius mainnet) |\n| `RPC_WEBSOCKET_ENDPOINT` | Yes | WebSocket RPC URL |\n| `GEYSER_RPC` | Yes | Geyser WebSocket URL (e.g. `wss://atlas-mainnet.helius-rpc.com/?api-key=...`) |\n\n### Trading\n\n| Variable | Default (example) | Description |\n|----------|-------------------|-------------|\n| `SIMULATION_MODE` | `true` | `true` = detect and log only; `false` = send buy/sell |\n| `BUY_AMOUNT` | `0.005` | SOL spent per snipe |\n| `SLIPPAGE` | `100` | Slippage in **percent** (100 = 100%) applied to max SOL on buy |\n| `TAKE_PROFIT` | `20` | Exit when sell quote ≥ `BUY_AMOUNT × (100 + TAKE_PROFIT) / 100` SOL |\n| `STOP_LOSS` | `10` | Exit when sell quote ≤ `BUY_AMOUNT × (100 - STOP_LOSS) / 100` SOL |\n| `TIME_OUT` | `60` | Max seconds to wait (market cap monitor or sell monitor) |\n| `CHECK_MARKET_CAP` | `false` | Wait until bonding-curve market cap ≥ `MARKET_CAP` before buying |\n| `MARKET_CAP` | `30` | Target market cap in **SOL** when `CHECK_MARKET_CAP=true` |\n\n### Dev buy filter\n\n| Variable | Description |\n|----------|-------------|\n| `CHECK_DEV_BUY` | `true` to enforce min/max on creator’s initial buy |\n| `MIN_DEV_BUY_AMOUNT` | Minimum dev buy in SOL; empty / unset = `0` |\n| `MAX_DEV_BUY_AMOUNT` | Maximum dev buy in SOL; empty / `none` / `unset` = no cap |\n\n### Social filters\n\nWhen enabled, metadata is fetched via Metaplex (with retries). The token is skipped if links fail validation.\n\n| Variable | Validation |\n|----------|------------|\n| `CHECK_X` | `twitter` must contain `https://x.com` |\n| `CHECK_TG` | `telegram` must contain `https://t.me` |\n| `CHECK_WEBSITE` | `website` must be non-empty |\n\n### Transaction fees \u0026 routing\n\n| Variable | Description |\n|----------|-------------|\n| `NEXTBLOCK_MODE` | `true` — submit via NextBlock (`fra.nextblock.io`) + tip transfer |\n| `NEXT_BLOCK_API` | NextBlock authorization header / API key |\n| `NEXT_BLOCK_FEE` | SOL tip to NextBlock address on each tx |\n| `BLOXROUTE_MODE` | `true` — submit via bloXroute trader API |\n| `BLOXROUTE_FEE` | bloXroute tip amount |\n| `BLOXROUTE_AUTH_HEADER` | bloXroute `Authorization` value |\n| `PRIORITY_FEE` | SOL used to derive compute-unit price on buy/sell (see `ComputeBudgetProgram.setComputeUnitPrice`) |\n\n**Routing priority:** If `NEXTBLOCK_MODE=true`, NextBlock is used. Else if `BLOXROUTE_MODE=true`, bloXroute is used. Otherwise the bot uses `connection.sendRawTransaction` with the configured priority fee.\n\n\u003e **Note:** `JITO_MODE` / `JITO_FEE` appear in `.env.example` but are **not** wired in `src/constants/constants.ts` (commented out). Jito helper code exists under `src/executor/jito.ts` but is not used by the main sniper loop.\n\n### Not yet implemented\n\nThese keys exist in `.env.example` but are **not** read by the application today:\n\n- `DEV_MODE`, `DEV_WALLET_ADDRESS`\n- `TICKER_MODE`, `TOKEN_TICKER`\n- `POSITION_CONTROL`, `POSITION_NUMBER` (position limit in `index.ts` is partially present but env wiring is commented out)\n\nDo not rely on them until added to `src/constants/constants.ts` and `src/index.ts`.\n\n---\n\n## Exit logic\n\nAfter a successful buy, `monitorSellPosition` polls every **500 ms**:\n\n1. Loads your token balance (retries with backoff).\n2. Quotes SOL out via bonding curve (`getSellPrice`).\n3. Compares quote to thresholds (computed at startup from `BUY_AMOUNT`):\n\n```\nTake-profit threshold (TP) = BUY_AMOUNT × (100 + TAKE_PROFIT) / 100\nStop-loss threshold (LS)  = BUY_AMOUNT × (100 - STOP_LOSS) / 100\n```\n\n4. Sells when:\n   - `outAmount \u003e= TP` → take profit\n   - `outAmount \u003c= LS` → stop loss\n   - Elapsed time ≥ `TIME_OUT` → timeout exit\n   - Balance is zero → stop monitoring\n\nExample: `BUY_AMOUNT=0.005`, `TAKE_PROFIT=20`, `STOP_LOSS=10` → TP at **0.006 SOL** quoted out, SL at **0.0045 SOL** quoted out.\n\n---\n\n## Transaction submission\n\n```text\nBuy / Sell transaction\n├── Compute budget (250k units + priority fee from PRIORITY_FEE)\n├── Create ATA idempotently if needed\n├── Anchor Pump.fun buy/sell instruction\n└── Submit via:\n    ├── NextBlock API (NEXTBLOCK_MODE) + tip\n    ├── bloXroute (BLOXROUTE_MODE) + tip\n    └── RPC sendRawTransaction + confirm\n```\n\nBuy and sell share the same routing flags. Ensure only one “fast path” mode matches your infrastructure setup.\n\n---\n\n## Scripts\n\n| Command | Description |\n|---------|-------------|\n| `npm run dev` | Run sniper with `ts-node` |\n| `npm start` | Same as `dev` |\n| `npm run build` | Compile TypeScript to `dist/` |\n| `npm run burn` | Burn all token balances and close empty ATAs (rent reclaim) |\n| `npm run encrypt` | Obfuscate compiled `dist/` → `dist-encrypt/` (optional release build) |\n\n### Burn utility\n\n`src/burn.ts` scans SPL and Token-2022 accounts, burns non-zero balances, harvests withheld fees on Token-2022 mints, and closes accounts. Useful after many snipes to recover rent.\n\n```bash\nnpm run burn\n```\n\nRequires only `PRIVATE_KEY` and `RPC_ENDPOINT` in `.env`.\n\n---\n\n## Project structure\n\n```text\nsrc/\n├── index.ts                 # Geyser listener, filters, buy/sell orchestration\n├── burn.ts                  # Token burn + ATA cleanup\n├── constants/\n│   └── constants.ts         # Env → exported config\n├── executor/\n│   ├── bloXroute.ts         # bloXroute submission\n│   ├── jito.ts              # Jito bundle helper (not active in main flow)\n│   └── legacy.ts\n├── pumputils/\n│   ├── idl/                 # Pump.fun Anchor IDL\n│   ├── utils/               # buyToken, sellToken, pricing, bonding curve\n│   └── bloxutils/           # bloXroute quote helpers\n└── utils/\n    ├── parseDevBuy.ts       # Dev buy extraction from Geyser payload\n    └── utils.ts             # Env helpers, JSON debug helpers\n```\n\nPump.fun program ID (subscribe filter): `6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P`\n\n---\n\n## Security\n\n- **Never** commit `.env` or share `PRIVATE_KEY`.\n- Use a **dedicated hot wallet** with only the SOL you are willing to lose.\n- Start with **`SIMULATION_MODE=true`** and small `BUY_AMOUNT`.\n- Verify RPC and Geyser URLs point to mainnet (or devnet) intentionally.\n- Review third-party tip endpoints (NextBlock / bloXroute) on their official docs.\n- This software does not encrypt keys at rest; OS-level disk encryption and access control are your responsibility.\n\n---\n\n## Troubleshooting\n\n| Symptom | Things to check |\n|---------|------------------|\n| Process exits immediately | Required env var missing — console prints `X is not set` |\n| No detections | Geyser URL valid? API key has Geyser access? Firewall allows WSS |\n| `WebSocket is open` but nothing else | Pump.fun activity; filter logs for `InitializeMint2` |\n| Buys always skipped | `CHECK_*` filters too strict; dev buy outside min/max; mcap timeout |\n| `Transaction failed` | Low slippage vs volatile curve; insufficient SOL; bonding curve complete |\n| Sell never fires | `TIME_OUT` too high; TP/SL thresholds unrealistic for `BUY_AMOUNT` |\n| Token-2022 errors on burn | Run `npm run burn` — includes harvest-before-close for fee mints |\n| High latency | Use Geyser + NextBlock/bloXroute; colocate RPC region with validator geography |\n\nEnable debug by inspecting Solscan links printed for each detection (`signature`, `mint`).\n\n---\n\n## Disclaimer\n\nThis project is for **educational and research purposes**. Trading memecoins on Pump.fun is extremely risky: rugs, honeypots, failed transactions, and total loss of funds are common. The authors provide no financial advice and no guarantee of profitability or correctness. **You are solely responsible** for compliance with local laws, taxes, and platform terms of service.\n\nUse at your own risk.\n\n---\n\n## License\n\nISC (see `package.json`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitman09%2Fpumpfun-sniper-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitman09%2Fpumpfun-sniper-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitman09%2Fpumpfun-sniper-bot/lists"}