A Next.js application for buying multiple Solana tokens in bulk with a single transaction flow. Built with TypeScript, Tailwind CSS, and the Solana Web3.js ecosystem.
- 🚀 Bulk Token Purchase: Buy up to 10 different tokens in one transaction flow
- 💰 Equal Distribution: Automatically splits your SOL amount equally among selected tokens
- 🔗 Jupiter Integration: Uses Jupiter API for optimal swap routes and pricing
- 🎯 Flexible Input: Paste multiple mint addresses separated by lines, commas, or spaces
- ⚙️ Customizable Settings: Adjust slippage tolerance and priority fees
- 📱 Responsive Design: Works on desktop and mobile devices
- 🔐 Wallet Integration: Supports Phantom, Solflare, Torus, and Ledger wallets
- 📊 Trending Token Tracker: Automated 24/7 monitoring of trending tokens with win/loss tracking
- 🎯 Win Rate Analysis: Track performance of trending tokens with automated summaries
- 🏆 Leaderboards: Top 5 performers identified every 24 hours
- 📈 Real-time Dashboard: Live P&L tracking for monitored tokens with manual price refresh
- 💰 Enhanced Price Updates: Smart caching system with rate limiting protection
- 🔧 Debug Mode: Comprehensive API testing and logging tools
- 🔔 Discord Notifications: Receive token updates and summaries in your Discord channel
- Connect Wallet: Connect your Solana wallet (Phantom, Solflare, etc.)
- Enter SOL Amount: Specify how much SOL you want to spend total
- Add Token Addresses: Paste up to 10 token mint addresses
- Configure Settings: Set slippage tolerance and priority fees
- Execute Purchase: The app will:
- Split your SOL equally among all tokens
- Get quotes from Jupiter for each token
- Create and sign all transactions
- Execute purchases and show results
-
Clone the repository:
git clone <repository-url> cd solana-bulk-buy
-
Install dependencies:
npm install
-
Set up environment variables (optional):
cp .env.local.example .env.local # Edit .env.local with your preferred RPC URL -
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
- Connect your Solana wallet
- Enter the total SOL amount you want to spend (e.g.,
0.1) - Paste token mint addresses in the text area:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 - Click "Buy X Tokens" to execute the purchase
- Slippage Tolerance: How much price movement you're willing to accept (0.1% - 5%)
- Priority Fee: Additional fee to prioritize your transactions (None - High)
The app accepts mint addresses in multiple formats:
- One per line
- Comma-separated
- Space-separated
- Mixed formats
Example:
EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 So11111111111111111111111111111111111111112
- Frontend: Next.js 14 with App Router
- Styling: Tailwind CSS
- Wallet Integration: Solana Wallet Adapter
- Swap API: Jupiter Aggregator
- Blockchain: Solana Web3.js
BulkTokenBuyer: Main component handling the purchase flowWalletProvider: Solana wallet connection providerjupiter.ts: Jupiter API integration utilitiessolana.ts: Solana connection and configuration
- Quote Phase: Get swap quotes for each token from Jupiter
- Transaction Creation: Create versioned transactions for each swap
- Signing: Sign all transactions using wallet adapter
- Execution: Send transactions to Solana network
- Confirmation: Wait for transaction confirmations and display results
RPC_URL: Custom Solana RPC endpoint (optional)DISCORD_WEBHOOK_URL: Discord webhook URL for token update notificationsENABLE_DISCORD_NOTIFICATIONS: Set to 'true' to enable Discord notificationsTRENDING_TRACKER_SECRET: Secret key for trending tracker API endpoints (optional)
The application can send token updates to a Discord channel using webhooks:
-
Create a Discord webhook:
- In Discord, go to Server Settings > Integrations > Webhooks
- Click "New Webhook", give it a name and select a channel
- Copy the webhook URL
-
Configure environment variables:
# Add these to your .env.local file DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-id/your-webhook-token ENABLE_DISCORD_NOTIFICATIONS=true -
Notification Content:
- Token updates (added, updated, removed)
- Price movements
- Top 5 tokens by organic score
- Summary statistics
- Network: Mainnet Beta
- Slippage: 1%
- Priority Fee: 0.0001 SOL
- Max Tokens: 10 per transaction
- Always verify token mint addresses before purchasing
- Start with small amounts when testing
- Be aware of slippage on low-liquidity tokens
- Check transaction signatures on Solscan after execution
- "Insufficient balance": Ensure you have enough SOL for purchases + fees
- "No valid quotes": Some tokens may not have liquidity on Jupiter
- "Transaction failed": Network congestion or slippage exceeded
- "Invalid mint address": Check that addresses are valid Solana token mints
- Check the browser console for detailed error messages
- Verify transactions on Solscan
- Ensure your wallet is connected to Mainnet
The Trending Token Tracker is an automated system that monitors trending tokens from Jupiter API, tracks their price performance over 24-hour periods, and generates comprehensive win/loss statistics.
- 5-minute price updates: Automatic tracking of token prices every 5 minutes
- Manual price refresh: "Refresh Stats + Prices" button for on-demand updates
- Smart caching: Rate-limited price API with 2-minute cache and batch processing
- Loss detection: Tokens dropping >50% are automatically marked as "lost"
- Winner identification: Top 5 performers each 24 hours are marked as "won"
- Win rate calculation:
wins / (wins + losses) * 100 - Real-time dashboard: Live monitoring at
/dev/trending-tracker - Debug tools: Testing buttons and detailed console logging
- Database Setup: Run
trending_tracker_migration.sqlin Supabase SQL Editor - Deploy: System runs automatically via Vercel cron jobs
- Access Dashboard: Navigate to
/dev/trending-tracker
/api/trending/track– 5-minute price updates (automated cron, POST)/api/trending/summary– 24-hour summaries (automated cron, POST)/api/trending/stats– Front-end stats feed (public GET)/api/trending/mode– Switch between simulation ↔ live trading (PUT)/api/trending/token– On-demand trade-comparison for a token (GET)/api/trending/price-monitor– 1-minute price monitor invoked by Go cron (POST)
Use the PUT /api/trending/mode endpoint with your secret key.
curl -X PUT \
'https://<your-domain>/api/trending/mode?key=$TRENDING_TRACKER_SECRET' \
-H 'Content-Type: application/json' \
-d '{
"isSimulated": false,
"keypairPath": "/home/ubuntu/trading-keypair.json" # optional if TRADING_KEYPAIR_JSON env var is set
}'Fields
| Name | Type | Description |
|---|---|---|
isSimulated |
boolean | true = paper-trading only, false = live trading |
keypairPath |
string? | Server-side path to keypair file (omit if using env var) |
The system will broadcast 🔥 LIVE TRADING or 💻 SIMULATION messages in Discord after each toggle.
A lightweight Go cron service calls /api/trending/price-monitor every minute to refresh prices for active live trades and issue Discord alerts when the change exceeds a threshold.
Environment variables:
PRICE_MONITOR_INTERVAL=60 # seconds between checks (default 60)
PRICE_ALERT_THRESHOLD=0.5 # % change (absolute) required to trigger alert (default 0.5)node scripts/test-trending-tracker.js allFor complete setup instructions, see TRENDING_TRACKER_SETUP.md.
src/
├── app/ # Next.js app router
│ ├── api/trending/ # Trending tracker APIs
│ └── dev/ # Development tools & dashboards
├── components/ # React components
├── types/ # TypeScript type definitions
├── utils/ # Utility functions
└── hooks/ # Custom React hooks (future)
npm run build
npm start- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details
This software is provided as-is. Always verify transactions and use at your own risk. The developers are not responsible for any financial losses.
The system now includes comprehensive duplicate prevention to avoid repeatedly buying the same tokens. This prevents issues like "BONKGUY" being purchased multiple times, which could lead to insufficient balance errors.
Add these to your .env.local file to configure duplicate prevention:
# Duplicate Prevention Settings
TOKEN_PURCHASE_COOLDOWN_HOURS=24 # Hours to wait before re-purchasing same token (default: 24)
MAX_PURCHASES_PER_TOKEN=2 # Maximum times to purchase same token (default: 2)
# Trading Safety Limits
MAX_SOL_AT_RISK=1.0 # Maximum SOL that can be at risk across all positions (default: 1.0)
MIN_SOL_BALANCE=0.1 # Minimum SOL balance to maintain (default: 0.1)- Active Trade Detection: Prevents concurrent purchases of the same token
- Wallet Holdings Check: Skips tokens where wallet already holds significant amounts (≥1000 tokens)
- Purchase History Tracking: Prevents re-purchasing tokens within cooldown period
- Maximum Purchase Limits: Enforces maximum number of purchases per token
- Minimum Gap Between Attempts: Requires at least 2 hours between purchase attempts
- BONKGUY purchased 3 times: System will now prevent 4th purchase due to
MAX_PURCHASES_PER_TOKEN=2limit - Insufficient balance errors: Better error messages and prevention of repeated failed attempts
- Wallet already holding tokens: System checks wallet balance before attempting new purchases
- Recent purchase cooldown: Prevents immediate re-purchases of tokens that just completed trading cycles
The system provides detailed logging for duplicate prevention:
🔍 Performing enhanced duplicate check for TOKEN🚫 Skipping TOKEN due to duplicate prevention: REASON✅ Enhanced duplicate check passed for TOKEN
This ensures transparency in trading decisions and helps debug any issues with the duplicate prevention system.