Run Your Solana Bot: Complete Setup Guide

Sound familiar? That's why I built my first Solana sniper bot last year. Now it's sniping launches before most humans even refresh. This guide? It's me walking you through running one - from zero to live trades. We'll use a Telegram bot setup 'cause it's dead simple and mobile friendly. No PhD required.

Okay, first things first. A Solana bot like this watches for new tokens (usually on Raydium or Pump.fun), buys fast with your settings, and can even auto sell on take profit or stop loss. Fees? Expect ~0.000005 SOL per tx on Solana, plus priority fees like 0.0001-0.01 SOL to jump the queue. Jito tips? Another 0.005 SOL bump for MEV protection. Why does this matter? Slow tx = you lose to faster bots.

Get Your Wallet Ready - Don't Skip This

Grab Phantom or Solflare. Fund it with 0.5-2 SOL for testing. Export your private? Yeah, but never share it. In my experience, use a burner wallet first - main one for when you're confident.

Now, create a new Solana keypair if you're paranoid. Run this in terminal:

  1. Install Solana CLI: sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
  2. solana keygen new --outfile ~/my wallet.json. Note the seed phrase.
  3. Check balance: solana balance --keypair ~/my wallet.json

The thing is, bots sign tx with this. Mess up? Funds gone. Test on devnet first: solana airdrop 2 --url devnet.

Pro Tip on Priority Fees

Priority fee = your bribe for faster inclusion. Set it to 0.00025 SOL micro lamports usually. Too low? Stuck in mempool. I once lost 5k 'cause of 0 fee during a launch frenzy.

Spin Up That Telegram Bot - 5 Minutes Flat

Telegram's perfect for this. Mobile control, notifications, no VPS hassle yet.

  • Search BotFather in Telegram.
  • Hit /newbot. Name it "MySniperBot". Username like "mysnipersolbot".
  • Copy the token. Paste in a .env file later. Lose it? Start over.
  • /setcommands for /start, /snipe, /settings, /position.

Done? Test by messaging your bot /start. Should reply. If not, token wrong.

Code Time - Node.js Setup (Easiest Path)

I usually go Node 'cause Solana libs are mature. VS Code open? Let's roll.

  1. mkdir solana bot && cd solana bot && npm init -y
  2. Install deps: npm i typescript ts node @solana/web3.js @solana/spl token bs58 dotenv node telegram bot api axios mongoose fs
  3. Create .env:
    BOTTOKEN=yourbotfather_token
    PRIVATEKEY=yourbase58privatekey
    RPC_URL=https://api.mainnet beta.solana.com // Upgrade to Helius or Quicknode later

Potential issue: Free RPC throttles. Solution? Get a paid one like Chainstack Trader Node (~$50/mo for low latency). Why? Bots need <50ms response or you eat sandwich fees.

The Core Code - Copy, Tweak, Run

Here's the beating heart from my setup. index.ts file. It handles /start, snipe config, swaps via Jupiter (easiest aggregator).

import TelegramBot from 'node telegram bot api';
import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js';
import bs58 from 'bs58';
import dotenv from 'dotenv';
dotenv.config(); const token = process.env.BOT_TOKEN!;
const bot = new TelegramBot(token, { polling: true }); const rpc = process.env.RPC_URL!;
const connection = new Connection(rpc, 'confirmed'); const privateKey = bs58.decode(process.env.PRIVATE_KEY!);
const wallet = Keypair.fromSecretKey(privateKey); let userConfigs = new Map(); // ChatId -> config bot.onText(/\/start/, (msg) => { const chatId = msg.chat.id; const config = { slippage: 50, // % amount: 0.1, // SOL priorityFee: 0.00025, jitoTip: 0.005, tp: null, // Take profit % sl: null // Stop loss % }; userConfigs.set(chatId, config); bot.sendMessage(chatId, Yo! Wallet: ${wallet.publicKey.toString()}\nUse /snipe <tokenaddress> to buy!, { replymarkup: { inlinekeyboard: [[{text: 'Settings', callbackdata: 'settings'}]] } });
}); bot.onText(/\/snipe (.+)/, async (msg, match) => { const chatId = msg.chat.id; const tokenAddr = match; const config = userConfigs.get(chatId) || {amount: 0.1, slippage: 50}; try { // Jupiter swap quote & tx const quoteUrl = https://quote api.jup.ag/v6/quote?inputMint=So11111111111111111111111111111111111111112&outputMint=${tokenAddr}&amount=${Math.floor(config.amount  1e9)}&slippageBps=${config.slippage  100}; const quote = await (await fetch(quoteUrl)).json(); const swapUrl = https://quote api.jup.ag/v6/swap; const swapRes = await fetch(swapUrl, { method: 'POST', headers: {'Content Type': 'application/json'}, body: JSON.stringify({ quoteResponse: quote, userPublicKey: wallet.publicKey.toString(), wrapAndUnwrapSol: true }) }); const { swapTransaction } = await swapRes.json(); // Deserialize, sign, send const tx = Transaction.from(Buffer.from(swapTransaction, 'base64')); tx.sign(wallet); const sig = await connection.sendRawTransaction(tx.serialize()); await connection.confirmTransaction(sig); bot.sendMessage(chatId, Snipe'd! Tx: ${sig}); } catch (e) { bot.sendMessage(chatId, Swap failed: ${e.message}); }
}); bot.on('callback_query', async (query) => { const chatId = query.message!.chat.id; if (query.data === 'settings') { bot.sendMessage(chatId, 'Set amount? Reply with SOL like 0.5'); // Add handlers for config updates.. } bot.answerCallbackQuery(query.id);
}); console.log('Bot running..');

Save as index.ts. Run: npx ts node index.ts. Boom, live. Test /snipe a real token like USDC.

Wait, errors? "Invalid keypair"? Check base58 encode. "RPC timeout"? Better endpoint. In my experience, add retries:

for (let i=0; i<3; i++) { try { / send tx / break; } catch { await new Promise(r=>setTimeout(r, 1000)); }
}

Config Deep Dive - Don't Trade Blind

Slippage at 50%? Fine for memes, risky for stables. Amount 0.1 SOL starts small. TP 2x, SL 20%? Set via buttons.

SettingGood ForMy DefaultRisks
SlippageVolatile launches30-70%Too high = sandwich
Priority FeeContested pools0.0005 SOLOverpay = losses
Jito TipMEV bundles0.005 SOLSkip = front run
AmountPosition size0.05-0.5 SOLAll in = wrecked

Why Jito? Bundles your buy sell atomic, no sandwich. Integrate via their API - add to tx instructions.

Make It Snipe Automatically - The Real Magic

Manual /snipe sucks for launches. Add a listener for new Raydium pools.

Hook Geyser gRPC or Yellowstone (Helius). But start simple: Poll Dexscreener API every 5s for new pairs.

  1. npm i ws // For websockets
  2. Add to code:
// Poll new tokens
setInterval(async () => { const newTokens = await fetch('https://api.dexscreener.com/latest/dex/pairs/solana').then(r=>r.json()); newTokens.pairs.slice(0,5).forEach(async (pair: any) => { if (pair.age < 60) { // <1min old // Auto snipe if configured bot.telegram.sendMessage(YOUR_CHAT, /snipe ${pair.baseToken.address}); } });
}, 5000);

Issue: Rate limits. Fix: Paid API keys. Sound familiar? Yeah, free tiers die quick.

Deploy 24/7 - No Laptop Sleep

Local run? Fine for tests. Live? Heroku free tier or Render ($7/mo).

  • Heroku: heroku create my sol bot, git push heroku main.
  • Add Procfile: worker: npx ts node index.ts
  • Env vars in dashboard.

AWS EC2? Beefier, ~$50/mo t3.medium. Ubuntu 22.04, pm2 for process mgmt: npm i -g pm2; pm2 start "npx ts node index.ts" --name sniper.

Hardware note: Bot itself? Any laptop. But RPC node? 16-core CPU, 256GB RAM, NVMe if self hosting. Don't - use providers.

Troubleshoot Like a Pro

Tx fails? Simulate first: connection.simulateTransaction(tx). Logs everything.

Common crap:

  • Insufficient funds: Add 0.01 SOL buffer.
  • Slippage exceeded: Pumped too fast. Lower amount.
  • Bot silent: Polling died. Add error handlers, Telegram alerts.
  • Front run? Up Jito tip to 0.01 SOL, use private mempool.

Honestly, log to MongoDB for positions. Track PNL: Entry 0.1 SOL, exit 0.3 SOL = 200% win.

Scale It - Referrals, Multi Wallet, TP/SL

Add /refer @friend for 1% fee kickback. Track users in DB.

Auto TP/SL: After buy, monitor price via Birdeye API. If 2x, sell half.

// Pseudo
setInterval(checkPositions, 10000);
async function checkPositions() { // Fetch balances, compare to entry, swap if hit
}

Multi wallet? Array of keypairs, rotate on fails.

In my experience, start with 0.05 SOL snipes. Scale after 10 wins. Bots wrecked me first time - over slippage ate 50%. Now? Consistent 5-20x flips weekly.

Security - Or Lose Everything

Private in .env? Gitignore it. VPS? Firewall ports, 2FA.

Restrict bot: Only your chatId. Check msg.from.id === YOUR_ID.