Okay, so most people jumping into Solana bots? They grab some random GitHub repo, plug in their wallet, and hit run without testing on devnet first. Boom. Wallet drained or stuck in a loop of failed txs eating up 0.000005 SOL per try. In my experience, that's how you lose 0.5 SOL in an hour just from spam.
But here's the right way. Start small. Test everything on testnet with fake SOL. You'll spot the bugs before they cost you real money. Why does this matter? Solana's fast as hell-millisecond edges decide if you snag a 10x or get rekt.
I usually start with a sniper. Proven for memes. But if you're lazy, Trojan bot on Telegram does copy trading out the box. No code needed.
Thing is, Telegram bots like Trojan are fire for beginners. But they take 0.1-0.5% fees per trade. And if the bot glitches? You're waiting on support.
Now, if you want control, code it. Python or TS. I use TS 'cause Solana libs are solid. Grab QuickNode for RPC-free tier works, but upgrade to Metis for Jupiter swaps. Costs like $9/month.
First, common screw up: Using public RPCs. Your tx queues behind 10k others. Latency kills. Get a Trader Node or Yellowstone Geyser for streams. Sub-100ms pings.
Okay, env setup. Install Node.js 18+. Yarn init. Add these deps:
yarn add @solana/web3.js @solana/spl token @jup ag/core bs58 dotenv Your .env file? Like this:
SOLANA_RPC=https://your quicknode solana mainnet url
JUPITER_RPC=https://your metis jupiter url
SECRETKEY=yourbase58walletsecret
FIRST_PRICE=0.1036 # SOL in lamports, adjust
TARGET_GAIN=1.5 # percent
INPUT_TOKEN=USDC
INPUT_AMT=10000000 # 10 USDC in lamports Here's a working ArbBot skeleton. It watches prices via Jupiter quotes, swaps when you hit 1.5% gain threshold. Loops every 5s.
import { Connection, Keypair, LAMPORTSPERSOL } from '@solana/web3.js';
// .. other imports interface BotConfig { solanaEndpoint: string; jupiterEndpoint: string; secretKey: Uint8Array; // etc
} class SolanaBot { connection: Connection; wallet: Keypair; targetGain = 0.015; // 1.5% nextThreshold: number; constructor(config: BotConfig) { this.connection = new Connection(config.solanaEndpoint); this.wallet = Keypair.fromSecretKey(config.secretKey); // init balances, price watch } async checkAndSwap() { // Get Jupiter quote const quote = await this.getJupiterQuote(); if (quote.outAmount > this.nextThreshold) { await this.executeSwap(quote); this.updateNextTrade(); // Flip direction, calc new thresh } } async getJupiterQuote() { // Call Jupiter V6 API for SOL/USDC or whatever // Return parsed outAmount } async executeSwap(quote: any) { // Build tx with slippage 0.5% // Simulate first // Sign & send with priority fee 0.0001 SOL // Confirm in slot } start() { setInterval(() => this.checkAndSwap(), 5000); }
}
Run it: const bot = new SolanaBot(config); bot.start();. Boom. Monitors SOL/USDC arb. Buys low, sells 1.5% up. Logs to JSON.
Pro tip: Add retry logic. If sim fails (bad liquidity), back off 2s. Solana drops txs if slippage maxed.
Strategy 1: Pump.fun Sniper. Watch Geyser for new pools. Buy if liquidity > 10 SOL in first 30s, volume spiking. Sell at 2x or 5min trailing stop.
In my experience, filter by socials-use Birdeye API for Twitter mentions. No pump, no play.
| Strategy | Entry Trigger | Exit | Risk | Example Gain |
|---|---|---|---|---|
| Sniper | New Raydium pool, liq >10 SOL | 2x or -20% stop | High | 5-50x |
| Copy Whale | Wallet buys >5 SOL | Trail 10% behind | Med | 2-5x |
| Arb | Jupiter quote >0.5% diff | Instant flip | Low | 0.2-1% per |
| Grid | Range bound token | Every 1% grid | Low | 10-20% daily |
Look, arbitrage is safest but tiny edges. Sniping? Jackpot or rug. I mix 'em-80% grid for base, 20% sniper bets.
What's next? Failed txs. Happens 30% time on pumps. Solution: Simulate every tx. If revert, tweak slippage up 1%, retry x3. Log slot numbers for debug.
Rate limits suck too. QuickNode caps 100 req/s. Hit it? Bot stalls. Fix: Async queues, backoff exponential.
Honestly, biggest killer? Rugs. New token, dev sells 50%. Filter: Check top holder < 20% supply post launch. Use Solscan API.
Slippage: Set dynamic-1% calm, 15% pump. But over 20%? Skip. You're chasing knives.
Fees add up. 100 tx/day at 0.000005 SOL = 0.0005 SOL. Negligible. But failed ones stack.
Security? Never hardcode keys. Use env. Run on VPS, not laptop. 2FA wallet. Testnet first always.
Sol balance low? Bot dies if < 0.01 SOL. Auto air drop script or alert.
"Transaction expired"? Bump compute units to 200k. Or stale blockhash-refresh every 150 slots.
No confirms? Switch RPC. Public ones lag confirmations.
Last Friday, I sniped a Pump.fun launch. Geyser pinged new pool with 25 SOL liq. Bot bought 1 SOL worth at mc $50k. Pumped to $500k in 10min. Sold half at 5x, trailed rest. Net +3.2 SOL after fees. Sound familiar? That's the edge.
Tweaks: Added volume filter > $100k/5min. Cut fakes 70%.
One wallet? Cute. Run 5-10 via PM2. Different keys. Diversify entries.
Discord alerts: Webhook on buys/sells. Check phone, manual override.
AI twist? Pipe Birdeye data to Claude, rank tokens by "hype score." Fancy but works.
Deploy: AWS Lightsail, $5/month. Cron restarts every 24h. Logs to file.
But wait-taxes. US here, track every swap. CSV export from bot. Tools like Koinly eat it.
Want whale status? Parse wallet txs real time. Copy if they buy newbies with history.
Trend filter: MA on volume. Skip if below 20-period avg.
Exit smart: Volume drop 50%? Sell. Not just pumps.
In my experience, the bots that last? Chill ones. Not 24/7 sniping. Run 4h sessions on UTC evenings-most action then.
(