Build a Solana Memecoin Sniper Bot with the DEX Firehose (2026 Guide)
Subscribe to recent Pump.fun buys, filter trade signals, handle replay safely, and decide when a separate execution service should act.

Disclosure: This article contains affiliate links. If you sign up through them, MadeOnSol may earn a commission at no extra cost to you. This never affects our rankings, ratings, or reviews.
A trading bot needs a timely signal, rules for deciding what that signal means, and a separate execution path. This tutorial builds the first two parts with the DEX Firehose: a Node.js process that watches recent Pump.fun buys and logs candidates. It does not place trades. A buy in a young token is evidence of activity, not proof that a launch is safe or that your order will be profitable.
The DEX Firehose is available on the Ultra plan and above. Check the current pricing page for plan details; prices and supported programs can change. Our DEX data overview describes other uses for the feed. If you are planning a larger infrastructure project, see the Solana grants and funding guide.
What “fresh” means in this feed
The dex:trades channel reports parsed trades. It is not a token-creation event stream. token_age_max_seconds: 300 keeps trades for mints whose persisted first-seen time is within five minutes, when that lookup is available. It does not guarantee that you captured the first trade. A dex:trades frame includes the traded mint, wallet, action, size, venue and transaction signature.
Create an Ultra API key and store it as MADEONSOL_KEY. Install the WebSocket client with npm install ws, then save this as signal-bot.mjs:
import WebSocket from "ws";
const apiKey = process.env.MADEONSOL_KEY;
if (!apiKey) throw new Error("Set MADEONSOL_KEY");
const tokenResponse = await fetch("https://madeonsol.com/api/v1/stream/token", {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}` },
});
if (!tokenResponse.ok) throw new Error(`Token request: ${tokenResponse.status}`);
const { token } = await tokenResponse.json();
if (!token) throw new Error("Token response had no token");
// Send credentials in a header to avoid putting them in the URL.
const ws = new WebSocket("wss://madeonsol.com/ws/v1/dex-stream", {
headers: { Authorization: `Bearer ${token}` },
});
const seen = new Set(); // Use bounded, persistent storage for a long-running bot.
ws.on("open", () => {
ws.send(JSON.stringify({
type: "subscribe",
sub_id: "fresh-pumpfun",
replay: 50,
replay_order: "asc",
filters: {
dex: "pumpfun",
token_age_max_seconds: 300,
action: "buy",
min_sol: 0.5,
},
}));
});
ws.on("message", (raw) => {
let msg;
try { msg = JSON.parse(raw.toString()); }
catch { return; }
if (msg.type === "error" || msg.type === "warning") {
console.error("Firehose:", msg);
return;
}
if (msg.type === "replay_done") {
console.log("Replay status:", msg.complete, msg.reason ?? "complete");
return;
}
if (msg.channel !== "dex:trades" || !msg.data) return;
const trade = msg.data;
const key = `${msg.sub_id}:${trade.tx_signature}`;
if (seen.has(key)) return;
seen.add(key);
// Replayed trades provide context, but must never trigger an execution path.
if (msg.replay === true) return;
console.log(JSON.stringify({
mint: trade.mint,
wallet: trade.wallet,
dex: trade.dex,
action: trade.action,
sol_amount: trade.sol_amount,
sol_amount_basis: trade.sol_amount_basis ?? "native_sol",
tx_signature: trade.tx_signature,
observed_at: msg.ts,
}));
});
ws.on("error", (error) => console.error("WebSocket:", error));
ws.on("close", (code) => console.error("WebSocket closed:", code));
Run node signal-bot.mjs. The stream token returned by /stream/token does not expire on a timer; it stops working when access lapses or the token or API key is rotated or revoked. Handle reconnects with backoff and obtain a new token when credentials change. The 50-trade replay is a recent in-memory view, not a durable historical backfill. Inspect replay_done for partial delivery or a buffer with fewer matches.
Building a product on Solana or Robinhood Chain data?
Skip the Geyser pipeline — embed KOL flow, deployer reputation, and the all-DEX firehose over REST, WebSocket, or webhooks. The Business tier (€400/mo) is the self-serve embed license at 500k calls/day — Enterprise adds white-label & redistribution.
Filter signals without overclaiming
The example filters by venue, age, buy action and a 0.5 SOL minimum. A larger trade can still be a wash trade or part of a coordinated bundle. Our article on bundle buys explains one way apparent early demand can be misleading.
You can add a deployer tier:
ws.send(JSON.stringify({
type: "subscribe",
sub_id: "tracked-deployers",
filters: {
dex: "pumpfun",
token_age_max_seconds: 300,
deployer_tier: ["elite", "good"],
action: "buy",
min_sol: 0.5,
},
}));
The tier is a historical classification from Deployer Hunter, not a prediction or endorsement. An unknown creator may be unranked, so a strict tier filter excludes many new mints. You can inspect creator history through the deployer API guide.
For two alert levels, send independent named subscriptions on the same connection:
ws.send(JSON.stringify({
type: "subscribe",
sub_id: "watch",
filters: { dex: "pumpfun", token_age_max_seconds: 600, min_sol: 0.3 },
}));
Frames carry sub_id. The same trade can match more than one subscription, so identify a delivery by sub_id and tx_signature. Decide at the application level whether two matching subscriptions should count as one candidate.
Keep execution separate
The old version of this guide included a swap example using Jupiter's /v6/quote and /v6/swap endpoints. Those endpoint examples should not be copied into a live trading bot. Select a current execution API, verify its authentication, quote and swap flow against its own documentation, and test with small amounts. A signal also needs checks for liquidity, pool routing, token controls, slippage, fees, repeated orders and exit conditions before it becomes an order.
Do not sign from inside the WebSocket message handler. Queue candidates for a separate worker, make order decisions idempotent by mint and strategy, and keep replayed trades out of the order queue. Our trading bot infrastructure overview shows how parsed trades and wallet context fit into a larger system.
Operational details
- Replay is not a fresh-signal filter. The server applies synchronous filters to replayed trades, but age, deployer tier and market-cap lookups are not reapplied as historical conditions. Never place an order from
replay: true. - Capture can have gaps. Reconnect, inspect close/error frames and
replay_done, and record the last observed transaction signature. The in-memory replay window cannot promise complete recovery after a long outage. - Use the effective filter acknowledgement. A subscription without an explicit
min_soluses a default minimum. Set your intended threshold and read thesubscribedresponse. - Treat sizes carefully. Some stablecoin-funded trades report a SOL-equivalent
sol_amount; inspectsol_amount_basisandstable_quotewhere present before applying size-based logic. - Avoid blocking the socket. Keep message handling quick, use a bounded queue, and monitor slow-consumer closes. Keep a bounded deduplication store in production rather than the unbounded
Setshown for this short-lived example. - Expect incomplete enrichment. A new mint can lack a deployer classification; a first trade can miss a market-cap filter while supply loads. Absence of a signal is not proof of absence of activity.
For the ingestion architecture behind the feed, read our gRPC pipeline walkthrough. It also discusses deduplication; consumers should still deduplicate deliveries by transaction signature.
Further research
For extra context, compare candidate wallets with smart-money entry signals and inspect buyer quality before acting. For a comparison with Helius and Bitquery, see the Solana gRPC alternatives guide. Neither a fast signal nor an attractive creator tier removes token, liquidity or execution risk.
Tools mentioned
Compare features and read reviews.
Live health scores, average ratings, and direct links on MadeOnSol.
Raydium
Leading AMM and liquidity protocol powering Solana DeFi

Lifinity
Proactive market maker DEX with oracle-driven pricing

uwuu
Fastest Solana copy-trading bot — mirror profitable wallets in under 400ms

Dexlab
No-code Solana token minting with DEX swaps, a Telegram bot, and an API

Based
Multi-chain trading bot with sniping, copy trading, and anti-MEV protection
Build your own trading bot
KOL copy-trading, deployer sniping, and DEX trade streaming — all via API.
import { MadeOnSol } from "madeonsol";
const client = new MadeOnSol({ apiKey: "msk_your_key" });
// Mirror KOL trades in real-time
const { trades } = await client.kol.feed({ action: "buy" });
// Set up webhooks for instant alerts
const webhook = await client.webhooks.create({
url: "https://your-bot.com/hook",
events: ["kol:trade", "deployer:alert"],
});Building a product on Solana or Robinhood Chain data?
MadeOnSol isn't an RPC or another generic token API — it's Solana & Robinhood Chain memecoin intelligence that's painful to build in-house, pulled from dual-region gRPC shred streams and our own Robinhood Chain node, pushed to your app as events land.
Signals you'd otherwise build
KOL & smart-money flow from 2,000+ labeled wallets, deployer reputation, coordination clusters, linked-wallet entity resolution, and an all-DEX firehose.
Embed it in your product
The Business tier (€400/mo, self-serve) licenses you to display MadeOnSol data inside your own product — 500k calls/day, 15 WS + 6 firehose connections. Enterprise above adds white-label & redistribution rights and custom endpoints.
Evaluate first, commit later
Test everything on a free ULTRA key — no commitment. If it fits, we scope volume or white-label pricing.
Keep reading
More from the blog.

Guides
Robinhood Chain KOL Signals in Your AI Agent: Pay Per Call with x402 and USDG
A working walkthrough: have an AI agent buy live Robinhood Chain KOL trade signals per call, paying in USDG via x402 — no API key, no signup. About 30 lines with viem and fetch.

Guides
Robinhood Chain x402 Starter: Clone, Run, and Pay for RHC Data in USDG
A minimal starter repo that pays a MadeOnSol Robinhood Chain endpoint per call in USDG via x402 — clone it, drop in a wallet key, and you're querying live KOL data in a minute. No API key.

Guides
How to Use DEXScreener for Solana Trading: Complete Guide (2026)
Master DEXScreener for Solana trading. Learn how to find new tokens, read charts, set alerts, filter by liquidity, and spot opportunities before others. Step-by-step guide with pro tips. Updated May 2026.

Guides
How to Build Solana Trading Tools with the MadeOnSol SDK
Use the MadeOnSol TypeScript SDK to build KOL trade alerts, deployer reputation checkers, and multi-wallet convergence scanners — with real code examples.

Guides
How to Read Solana Token Charts: Technical Analysis for Beginners
Learn the fundamentals of technical analysis for Solana tokens. Covers candlestick patterns, volume analysis, support and resistance, moving averages, RSI, MACD, and how to spot pump-and-dumps on charts.

Guides
How to Use Pump.fun: Complete Beginner Guide (2026)
Learn how to use Pump.fun from start to finish. This guide covers creating tokens, buying and selling on the bonding curve, graduation mechanics, fees, risks, and safety tips for navigating the biggest memecoin launchpad on Solana.
Enjoyed this article?
Explore the live data.
Real-time KOL trades, Pump.fun deployer intel, and 1,200+ ranked Solana & Robinhood Chain tools — free to explore.
Open the KOL Tracker