An automated Solana token trading bot that detects new tokens, validates them through multiple criteria, and executes buy/sell trades via Jupiter aggregator. Features real-time monitoring, risk management, and Telegram notifications.
- This bot involves significant financial risk. Only use funds you can afford to lose.
- Automated trading can result in substantial losses. Past performance doesn't guarantee future results.
- Always test with small amounts first and understand the risks involved.
- Keep your private keys secure and never share them.
- Automated Token Detection: Listens for new tokens via webhook integration
- Multi-Layer Validation:
- Token age verification (max 2 minutes old)
- Liquidity validation (min $5M USD)
- Market cap and FDV ratio checks
- Risk score assessment via RugCheck API
- Volume and transaction validation
- Jupiter Integration: Uses Jupiter aggregator for optimal swap routes
- Risk Management: Configurable stop-loss and profit targets
- Telegram Notifications: Real-time trade alerts and price updates
- Dual Operation Modes:
- Full sniper bot with buy/sell automation
- Sell-only mode for existing positions
- Node.js (v16 or higher)
- Solana wallet with sufficient SOL balance
- High-quality RPC endpoint (recommended: QuickNode, Helius, or similar)
- API access to:
- DexScreener API
- RugCheck API
- Telegram Bot API (optional)
-
Clone the repository:
git clone <repository-url> cd solana-token-sniper-bot
-
Install dependencies:
npm install
-
Configure environment variables:
cp env.example .env
-
Edit the
.envfile with your configuration (see Configuration section below)
Create a .env file with the following variables:
# Required: Your wallet's private key in base58 format
WALLET_PRIVATE_KEY=your_wallet_private_key_here
# Required: High-quality RPC endpoint
RPC_URL=https://your-rpc-endpoint.com
# Jupiter API base URL (usually default is fine)
METIS_JUPITER_BASE_URL=https://quote-api.jup.ag
# Optional: Telegram notifications
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
# Optional: gRPC settings (not currently used)
GRPC_URL=
GRPC_TOKEN=The bot includes several configurable parameters in the source files:
SLIPPAGE_BPS: 100 (1% slippage)AMOUNT_TO_TRADE: 0.1 SOL per tradePRICE_CHECK_INTERVAL: 5000ms (5 seconds)MAX_HOLD_TIME: 300000ms (5 minutes)
maxAgeInMinutes: 2 minutesminLiquidityUsd: $5,000,000minMarketCap: $100,000minMarketCapToFdvRatio: 0.9maxRiskScore: 1minFirst5MinVolume: $500minFirst5MinTxns: 10 transactions
TARGET_SELL_USD: $0.0017 (sell target price)STOP_LOSS_USD: $0 (stop loss price)CHECK_INTERVAL_MS: 20000ms (20 seconds)SLIPPAGE_BPS: 200 (2% slippage)
The main bot listens for webhook notifications of new tokens:
node jupitor-helius-sniper.jsThe bot will:
- Start an Express server on port 3000 (or PORT env variable)
- Listen for webhook POST requests at
/webhook - Validate incoming tokens against multiple criteria
- Execute buy orders for validated tokens
- Monitor positions and execute sell orders based on conditions
For monitoring and selling existing positions:
node jupitor-sell.jsNote: Configure the OUTPUT_MINT variable in the file to match your token's mint address.
The sniper bot expects webhook data in this format:
[
{
"tokenTransfers": [
{
"mint": "token_mint_address_here"
}
]
}
]Set up your webhook provider to send POST requests to:
http://your-server:3000/webhook
Edit the configuration constants at the top of each file:
- Amount per trade: Change
AMOUNT_TO_TRADEinjupitor-helius-sniper.js - Profit/loss targets: Modify the exit conditions in the price monitoring loop
- Validation criteria: Adjust
VALIDATION_CONFIGobject parameters - Timing intervals: Update
PRICE_CHECK_INTERVALandMAX_HOLD_TIME
The validateToken function in jupitor-helius-sniper.js can be extended with additional checks:
// Add custom validation logic
if (customCondition) {
console.log('Custom validation failed');
return false;
}- Quote API:
https://quote-api.jup.ag/v6/quote - Swap API:
https://quote-api.jup.ag/v6/swap - Used for fetching optimal swap routes and executing trades
- Endpoint:
https://api.dexscreener.com/latest/dex/tokens/{token_address} - Used for token validation and price monitoring
- No API key required
- Endpoint:
https://api.rugcheck.xyz/v1/tokens/{token_address}/report/summary - Used for risk score assessment
- No API key required
- Setup: Create a bot via @BotFather on Telegram
- Get Chat ID: Send a message to your bot and call the getUpdates API
- Used for trade notifications and price alerts
- Ensure your wallet has enough SOL for trades plus transaction fees
- Check that
AMOUNT_TO_TRADEdoesn't exceed your balance
- Verify your RPC endpoint is working and not rate-limited
- Check Jupiter API status
- Reduce trade size if liquidity is insufficient
- Verify your server is accessible from the internet
- Check firewall settings and port forwarding
- Ensure webhook URL is correctly configured in your provider
- Increase slippage tolerance (
SLIPPAGE_BPS) - Check network congestion and adjust priority fees
- Verify token is actually tradeable on Jupiter
- Enable detailed logging: Add console.log statements to track execution flow
- Test with small amounts: Start with minimal SOL amounts
- Monitor RPC calls: Check for rate limiting or connection issues
- Verify token addresses: Ensure mint addresses are correct and valid
-
Private Key Security:
- Never commit private keys to version control
- Use hardware wallets when possible
- Store private keys in secure, encrypted storage
-
RPC Security:
- Use reputable RPC providers
- Keep RPC URLs private to avoid rate limiting
-
Environment Security:
- Run the bot in a secure environment
- Keep dependencies updated
- Monitor for unusual activity
-
Financial Security:
- Start with small test amounts
- Set reasonable risk limits
- Never invest more than you can afford to lose
The bot provides extensive logging for monitoring:
- Token detection and validation results
- Trade execution confirmations with transaction links
- Price monitoring updates
- Error messages and retry attempts
- Telegram notifications for key events
Monitor the console output and set up log rotation for production use.
- Ensure compliance with local financial regulations
- Understand tax implications of automated trading
- This software is provided as-is without warranties
- Users are responsible for their own trading decisions and results
This is a specialized trading bot. Please thoroughly test any modifications before deploying with real funds.
Use at your own risk. No warranties provided.
Remember: Cryptocurrency trading involves substantial risk. This bot is a tool that requires careful configuration and monitoring. Always test thoroughly and understand the risks before deploying with significant funds.