Building Solana Trading Bots in Rust: The `madeonsol` Crate, Async-First on `tokio` + `rustls`
The official MadeOnSol Rust SDK ships on crates.io. Full API surface parity with the TypeScript SDK, built on tokio + reqwest + rustls — no OpenSSL, cross-compiles cleanly, and the right fit for latency-sensitive Solana trading bots.

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.
The MadeOnSol Rust SDK is live on crates.io. Full REST surface parity with the TypeScript SDK — KOL feed, leaderboard, coordination, pairs, hot, trending, entry-order, timing, PnL, deployer alerts + leaderboards, wallet tracker, alpha wallet intelligence — packaged as an async client you can drop into a tokio runtime.
If you've been running your Solana trading bot in Node and wondering whether Rust is worth the rewrite, this post walks through the specifics: when Rust makes the difference, what ships in the crate, and how it plugs into the trading-loop architecture.
When Rust actually matters for Solana bots
For most people building around the MadeOnSol API — KOL alert bots, dashboards, trade journaling — TypeScript or Python is fine. You're bound by network latency, not by local compute. A Node-based bot sniping pump.fun will not be materially slower to signal than a Rust one.
Rust becomes the right choice in a few specific scenarios:
- Co-located execution. You're running signing and transaction submission in the same process as signal handling and want a single async Rust runtime. This can simplify a latency-sensitive architecture, but network/RPC latency still dominates many paths.
- Memory-constrained deployments. A compiled Rust service can have a smaller runtime footprint than a comparable Node/Python deployment, but measure your own binary and workload rather than relying on a generic MB claim.
- Predictable local runtime behavior. Rust avoids garbage collection and gives tight control over allocation and concurrency. That can reduce one source of jitter; it does not guarantee that a remote trade lands within a fixed latency.
- Cross-compilation. Shipping the bot to an ARM VPS, a RISC-V edge node, or a Docker image without node_modules is a
cargo build --release --target=...away.
Outside those cases, stick with the TypeScript SDK. It's faster to iterate and the runtime difference isn't where your bot will win or lose.
What's in the crate
cargo add madeonsol
Design choices worth noting:
tokioasync runtime. All methods returnFutures — no blocking calls, no separate sync/async client split.reqwestHTTP client withrustls. No OpenSSL dependency. Cross-compiles to Alpine containers, ARM boards, and static binaries without system-library pain.- Typed response structs. Every endpoint returns a concrete type that mirrors the live REST payload. Serde deserialization, so field mismatches fail at compile time (for required fields) or at parse time (for optionals).
- Structured errors. Server-side error bodies are surfaced as typed variants, not just HTTP status codes. If a call fails because your tier is insufficient, you get that specific reason.
- Same
msk_Bearer auth as every other SDK. One key across TS, Python, Rust, MCP, ElizaOS.
The covered surface: KOL endpoints (feed, leaderboard, coordination, pairs, hot, trending, entry-order, timing, PnL, compare, wallet profile), deployer-hunter (alerts, leaderboards, profiles, trajectory, best-tokens, recent-bonds), wallet tracker (watchlist CRUD, trades, summary), alpha wallet intelligence (leaderboard, wallet profile, linked wallets), token intel, and x402 discovery. Copy-trade CRUD ships via the REST surface on parity.
Install and auth
Add to Cargo.toml:
[dependencies]
madeonsol = "0.28" # published version verified 2026-09-26
tokio = { version = "1", features = ["full"] }
anyhow = "1"
Bootstrap the client:
use madeonsol::Client;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::new(std::env::var("MADEONSOL_API_KEY")?);
// ... use the client
Ok(())
}
Grab an msk_ key from the developer portal — free tier gives you 200/day to prototype without a credit card.
Workflow sketches
The shape of the client is simple: one type per endpoint group, methods returning typed responses. Specifics (method names, option structs) are on docs.rs/madeonsol — I won't invent names here. What's worth showing is how Rust changes the architecture of your bot loop.
Pattern 1: Streaming decision loop
The hottest path on most Solana trading bots is: get signal → score it → decide. In Rust that loop runs without GC hitches:
use tokio::time::{sleep, Duration};
async fn decide_loop(client: &madeonsol::Client) -> anyhow::Result<()> {
loop {
let feed = client.kol_feed()
.limit(20)
.action("buy")
.min_sol(1.0)
.await?;
for trade in &feed.trades {
if should_act(trade) {
spawn_execution(trade.token_mint.clone()).await;
}
}
sleep(Duration::from_secs(10)).await;
}
}
tokio::spawn lets you fan out per-trade analysis onto the runtime without blocking the poll loop. In Node you'd use Promise.all and hope the GC doesn't chew through the cold loop you just queued.
Pattern 2: WebSocket stream with reconnect
For push-delivery (copy-trade signals, KOL trades, coordination alerts), the idiomatic Rust pattern pairs the SDK's REST calls for token generation with tokio-tungstenite for the WS layer:
use futures_util::{SinkExt, StreamExt};
use tokio_tungstenite::connect_async;
async fn run_stream(client: &madeonsol::Client, channels: Vec<&str>) -> anyhow::Result<()> {
let mut backoff = Duration::from_secs(2);
loop {
match connect_and_listen(client, &channels).await {
Ok(()) => backoff = Duration::from_secs(2),
Err(e) => {
eprintln!("stream err {e:?}; reconnect in {backoff:?}");
tokio::time::sleep(backoff).await;
backoff = (backoff * 3 / 2).min(Duration::from_secs(60));
}
}
}
}
See the stream-token reconnect guide for the full pattern. Stream tokens no longer expire on a 24-hour timer. Fetch the current token before a connection/reconnect; repeated fetches normally return the same token. An in-band token_refresh is associated with an explicit rotation, not a scheduled lifecycle event.
Pattern 3: Trade execution alongside signal detection
This is where Rust actually earns the rewrite. Some teams choose to separate signal ingestion and transaction signing into different processes; others keep both in one Node process. Rust gives you another option: keep the networking, decision logic and signing in one typed async runtime without requiring IPC.
In Rust you don't have that split. Pull a signal from the MadeOnSol SDK, hand it to solana-client for blockhash, hand it to jito-sdk-rust for bundle submission — all inside one tokio::spawn closure, all on the same runtime. Do not treat that as a fixed signal-to-landed latency promise: blockhash/RPC access, leader timing, priority fees, bundle acceptance and network conditions dominate the end-to-end number.
async fn on_signal(signal: CopyTradeSignal) -> anyhow::Result<()> {
let keypair = load_keypair()?;
let tx = build_buy_tx(&keypair, &signal.token_mint, signal.suggested_sol_amount).await?;
let sig = jito_submit(tx).await?;
tracing::info!(signal_id = signal.signal_id, signature = %sig, "landed");
Ok(())
}
Structured tracing via tracing + correlation on the signal_id field makes post-hoc analysis trivial. Every signal has a server-generated id (added to the WS payload as of v1.1) — pair that with your tx signature and you have the full audit trail.
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.
Error handling in practice
Rust's Result<T, E> forces you to handle every failure mode at the call site, which is exactly what you want for a trading bot:
match client.kol_pnl(&wallet).period("30d").await {
Ok(pnl) if pnl.summary.closed_positions >= 30 => decide(pnl),
Ok(_) => skip_reason("insufficient sample"),
Err(madeonsol::Error::TierRequired { .. }) => upgrade_prompt(),
Err(madeonsol::Error::RateLimit { retry_after }) => backoff(retry_after),
Err(e) => log::error!("pnl fetch: {e:?}"),
}
The typed error variants let you distinguish "this should retry" from "this will never work on my current tier" — which in a long-running bot is the difference between graceful degradation and a tight retry loop against a hopeless request.
Exact variant names live in the crate docs. Check docs.rs/madeonsol for the current enum.
Deployment footprint
A release build with strip = "symbols" and lto = "fat" produces a single deployable binary; the actual binary and container size depends on your dependencies, target and link settings. Docker image:
FROM rust:1.75 AS build
WORKDIR /app
COPY . .
RUN cargo build --release
FROM gcr.io/distroless/cc-debian12
COPY --from=build /app/target/release/my-bot /
ENTRYPOINT ["/my-bot"]
A distroless final image removes a shell and package manager and can substantially reduce the runtime image surface. Measure the final image produced by your own dependency graph rather than relying on a universal size. This is the kind of deployment you can't get from a Node or Python app without meaningful effort. Once it's running, wire the API's health into your alerting — our guide on the public status endpoint and uptime monitoring with UptimeRobot or StatusCake covers the setup.
SDK version compatibility
The Rust SDK ships independently of the TS/Python/MCP/Eliza packages. Version it explicitly in Cargo.toml:
madeonsol = "0.28"
The crate is still pre-1.0, so read release notes before a minor-version upgrade. If you need fully reproducible builds, pin the currently published version exactly and let Dependabot/Renovate propose upgrades:
madeonsol = "=0.28.0"
The changelog lives on madeonsol.com/changelog.
When not to use Rust
Be honest: the Rust SDK is not the better choice for:
- Quick prototypes. TypeScript is often faster to iterate for teams already in the JS ecosystem. Prototype in the language your team can validate fastest, then move hot paths only if measurements justify it.
- MCP / Claude / Cursor integrations. The MCP server runs in Node. Use
mcp-server-madeonsoldirectly rather than wrapping Rust in a subprocess. - Jupyter / data-science workflows. Python is the right tool there. Use
madeonsol-x402on PyPI. - LangChain / AI agent toolchains. Also Python. The langchain_tools module in
madeonsol-x402is designed for this.
For that prototyping phase, our walkthrough on building KOL alert bots, deployer checks, and convergence scanners with the TypeScript SDK covers the same endpoints without the compile step.
Rust is for production execution paths where the runtime characteristics materially matter. The TypeScript SDK already has all the data.
Resources
madeonsolon crates.io — installdocs.rs/madeonsol— generated API reference- GitHub: madeonsol/madeonsol-rs — source + issues
- Full API reference — REST endpoints the SDK wraps
- Stream-token reconnect loop — pair with SDK for WS delivery
- Developer portal — generate an API key
Most Solana bots don't need Rust. The ones that do are not well-served by anything else.
September 2026 refresh
The Rust guide was updated to the published madeonsol 0.28.0 crate and the permanent WebSocket token lifecycle. Several absolute performance claims were also removed: MadeOnSol does not benchmark your bot's memory footprint, GC behavior or signal-to-landed transaction time, so those numbers should come from your own workload rather than from an SDK article.
Sources: current package registry, crates.io, API reference, and the stream reconnect guide.
Tools mentioned
Compare features and read reviews.
Live health scores, average ratings, and direct links on MadeOnSol.

FluxRPC
gRPC, WebSockets, and full RPC in one plan from $38/mo. No credits, no multipliers, no add-ons and nothing gated behind a higher tier.

extrnode
Decentralized Solana RPC gateway with auto-failover across a node cluster

Ankr
Decentralized Web3 infrastructure with Solana RPC endpoints

Nodit
Enterprise Web3 data and RPC infrastructure with indexed APIs, nodes, and event streams.

Caldera
High-performance blockchain infrastructure and rollup deployment platform
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.

Developer Tools
Copy-Trade Solana KOL Wallets: Build a Paper-Trading Bot in 5 Minutes
Watch live smart-money trades on Solana and paper-trade them in real time: open a virtual position when a tracked KOL buys, close when they sell, and track PnL from the market-cap multiple. This tutorial walks the open-source kol-copytrade-bot-starter — ~300 lines, one dependency, free API key — and shows how to filter by KOL win rate, deployer tier, and multi-KOL confirmation before risking anything real.

API Guides
DexScreener API Alternative: 5 Things It Can't Do (That MadeOnSol Can)
DexScreener's free API is a current-state read layer: a focused public endpoint set, no historical data, and no WebSocket. If you've hit those walls, here's what the MadeOnSol API gives you instead, and what each plan lets you build.

API Guides
Solana Deployer API: Track 900K+ Token Creators by Bonding Rate
The MadeOnSol Deployer Hunter API gives you programmatic access to 1.1M+ indexed Pump.fun token deployers (85K+ reputation-scored) by historical bonding rate, tier, and trajectory — plus real-time alerts when elite deployers launch. Here's the full endpoint surface.

Developer Tools
What Is a Solana API? A Developer's Guide to Building on Solana Data (2026)
Understand what Solana APIs are, what types exist, and how developers use them to build trading bots, portfolio trackers, and analytics dashboards. Covers RPC, enhanced APIs, data APIs, and when to use each.

Guides
How to Get pump.fun Token Trades via API: the Per-Mint Trade Tape (2026)
One GET returns every buy and sell on a pump.fun token, newest first, with the executed price, the pool price at that slot, the wallet and the early-buyer rank. Cursor paging, buy/sell and wallet filters, and what the coverage block tells you before you trust the numbers.

Guides
How to Stream New Solana Token Launches over WebSocket: Deploys, Graduations, Surges (2026)
One socket, three channels: sniper:deploys pushes every pump.fun launch a few hundred milliseconds before the chain confirms it, token:graduations pushes every bonding-curve completion, token:surges pushes young tokens running 3×, 6× or 8× against their launch cap. Handshake, real frames, filters, and what each channel does not tell you.
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