Simple sniper for new tokens on Base using Uniswap V2. It listens for liquidity events, applies basic safety checks, computes a position size, and executes buys/sells. Includes a Telegram bot for viewing positions and placing sells.
- Base chain
- Uniswap V2 router on Base
- Event listeners for LP burn and pair creation
- Basic token safety checks via
token_scanner.py - Position logging to Parquet and Telegram notifications
- Telegram commands:
/positions,/sell
- Python 3.10+
- A Base JSON-RPC endpoint (e.g., QuickNode)
- Telegram bot token
Recommended Python packages (install into your venv):
pip install web3 pandas requests python-telegram-bot==13.* pyarrow- Copy the example env file and fill in values
cp .env.example .env- Required environment variables
- WALLET_ADDRESS: Your EOA address on Base
- PRIVATE_KEY: Private key for WALLET_ADDRESS (0x-prefixed hex)
- QUICKNODE_URL_BASE: Base RPC URL (QuickNode or any reliable Base RPC)
- TELEGRAM_BOT_TOKEN: Token for
telegram_bot.py(BotFather) - BOT_TOKEN: Token used inside
sniper_bot.pyfor Telegram notifications (can be same as TELEGRAM_BOT_TOKEN)
Optional
- TENDERLY_KEY: If you enable transaction simulation
- BASESCAN_API_KEY: Used by
token_scanner.pyfor contract checks - ETHERSCAN_API_KEY: Only if you later re-enable Ethereum support
- Git hygiene
The repo includes
.gitignoreand.env.example. Data artifacts likepurchases.parquetandstate.pklare ignored.
Run each component in separate terminals as needed.
- Buy listener (snipes new tokens)
python sniper_buy_bot.pyBy default sniper_buy_bot.py instantiates the bot with test_mode=True. Set to False to broadcast real transactions.
- Sell monitor (takes profit / stop loss based on simple rules)
python sniper_sell_bot.py- Telegram bot (positions and sell commands)
python telegram_bot.pyCommands:
- /positions — shows current positions and PnL
- /sell base <token_address> <sell_percentage> — e.g.
/sell base 0xabc... 0.5
- Slippage, thresholds, and sizing are in
sniper_bot.py(seecompute_buy_size,buy_token,sell_token). - Purchases are logged to
purchases.parquetin the repo root. - Links in messages point to
basescan.org. - Safety checks are basic heuristics; review
token_scanner.pyand adjust to your risk tolerance.
- PRIVATE_KEY environment variable is not set: ensure
.envis loaded in your shell or export vars explicitly. - Missing parquet dependencies:
pip install pyarrow. - Telegram issues: verify
TELEGRAM_BOT_TOKENand that the bot has a conversation with your account. - RPC errors: confirm
QUICKNODE_URL_BASEis reachable and synced.
- Never commit real private keys. Use environment variables.
- Consider running from a dedicated wallet and small balances.
This code is for educational purposes only. Trading tokens can be highly risky. Use at your own risk.
MIT