What Is Lighthouse Router?
Lighthouse Router is a Rust-based Solana DEX routing library built by evanphi7 for developers who need deterministic off-chain route discovery instead of a hosted aggregator. Lighthouse Router is one of the best Solana DEX Routing Tools for Rust developers and Solana quant engineers; it normalizes Raydium AMM v4, Orca Whirlpool, and Phoenix into a single routing graph, ships with a lighthouse CLI, and targets Rust 1.74+ and Solana 1.18.
Lighthouse Router exists to quote swaps without reimplementing pool math, account decoding, and shortest-path search in every script. It is Apache 2.0, dependency-light, and aimed at people who want reproducible route selection for quoting, simulation, and arbitrage scans rather than execution.
Quick Overview
A short snapshot helps separate this from execution-oriented aggregators and from single-venue SDKs.
| Attribute | Details |
|---|---|
| Type | Solana DEX Routing Tools |
| Best For | Rust developers and Solana quant engineers |
| Language/Stack | Rust 1.74+, Solana 1.18, Solana RPC, Raydium AMM v4, Orca Whirlpool, Phoenix |
| License | Apache 2.0 |
| GitHub Stars | N/A |
| Pricing | Open-Source |
| Last Release | N/A |
The stack choice matters because Lighthouse Router is built around account decoding and local graph search, not a remote quote API. That makes it a fit for deterministic scripts, CI jobs, and research pipelines where you want the math in your own process.
Who Should Use Lighthouse Router?
- Rust backend engineers writing Solana swap quoters who want a local library instead of calling a third-party route API.
- Indie hackers building trading bots, dashboards, or portfolio tools that need multi-hop quote discovery with predictable dependencies.
- Quant engineers scanning for negative cycles or marginal-price arbitrage across Raydium, Orca, and Phoenix state.
- Protocol integrators who need pool decoding and route ranking inside a larger Rust service.
Not ideal for:
- Teams that want end-to-end trade execution, CPI wiring, or bundled settlement. Lighthouse Router stops at route discovery and quoting.
- Users who need broad venue coverage across the entire Solana liquidity landscape. Lighthouse Router currently focuses on Raydium AMM v4, Orca Whirlpool, and Phoenix.
- Production systems that require slippage controls and transaction building out of the box. Those pieces live in a different layer.
Key Features of Lighthouse Router
- Pool decoders for major Solana venues — Lighthouse Router decodes Raydium AMM v4, Orca Whirlpool, and Phoenix order-book state into a common model. That removes the boilerplate of reading each account layout by hand.
- Constant-product and concentrated-liquidity quote math — The crate includes tested math for CPMM and Whirlpool-style pricing. That matters when you need local quotes that match pool state instead of guessing from UI prices.
- Depth-limited multi-hop routing — The router builds a token graph and searches for the best path up to a configurable hop limit. The
--max-hopsflag defaults to3, which keeps search time bounded in scripts and CLIs. - Bellman-Ford negative-cycle detection — Lighthouse Router can scan for marginal-price arbitrage using negative-cycle detection. That gives you a direct signal for price inconsistency without writing a separate graph algorithm.
Quotertrait abstraction — Every venue adapter implementsmints(),quote(), andis_active(). This keeps the routing layer generic while letting each DEX expose its own state shape.AnyPoolruntime sum type — The graph stores pools as a single enum-like runtime type, so the router does not need to stay generic over every venue. That keeps the CLI and library API straightforward to compose.- Parallel RPC fetch and TTL cache — The architecture fetches accounts in parallel from Solana RPC, then caches decoded pools with a TTL. That reduces repeated account decoding when you are re-quoting in a loop.
Lighthouse Router vs Alternatives
| Tool | Best For | Key Differentiator | Pricing |
|---|---|---|---|
| Lighthouse Router | Local Solana route discovery and arb scans | Off-chain graph search with direct pool math in Rust | Open-Source |
| Jupiter | Production swap aggregation | Broad liquidity aggregation and execution routing | Free |
| Orca Whirlpool | Single-venue concentrated liquidity | Native Whirlpool pool semantics and direct venue access | Free |
| Raydium AMM | AMM pool interaction | Strong constant-product venue depth and pool primitives | Free |
Pick Lighthouse Router when you want the routing logic in your own process and you care about deterministic quoting. Pick Jupiter when your main goal is best execution across many venues and you are happy to depend on an external aggregator.
Pick Orca Whirlpool when you only need one venue and want direct Whirlpool semantics. Pick Raydium AMM when you are already operating on Raydium pool state and do not need multi-venue path search.
If you are instrumenting route experiments or debugging path selection, pair Lighthouse Router with OpenTrace for traces and metrics around the script itself. If your workflow is shell-first, browse all CLI Tools for adjacent command-line utilities that fit the same operational style.
How Lighthouse Router Works
Lighthouse Router follows a simple pipeline: fetch live account data, decode venue-specific pool state, normalize it into AnyPool, then run graph search over token mints. The important design choice is that the router owns the math locally, so the same Rust process that loads pools can also quote routes and scan for arbitrage.
The core abstraction is the Quoter trait. A venue adapter exposes its mint set, quote function, and activity status, while the graph layer stays agnostic to whether the pool came from Raydium, Orca, or Phoenix.
cargo install --path .
lighthouse quote --from EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --to So11111111111111111111111111111111111111112 --amount 1000000000 --max-hops 3
That command installs the CLI and asks it to quote a USDC-to-SOL route through at most three hops. Expect the router to fetch pool state from the RPC endpoint, decode the supported venues, and return the best route it can construct from the current graph.
The architecture favors explicit failure over optimistic guesses. The Whirlpool quoter refuses to quote when a swap would cross a tick range it cannot model safely, and Phoenix is treated as a typed model that you wire from phoenix-sdk rather than a full opinionated client.
Pros and Cons of Lighthouse Router
Pros:
- Deterministic local routing — The quote path runs in your process, so results depend on your RPC data and code, not on a hosted routing service.
- Small surface area — The crate stays focused on pool math, decoders, graph search, and a CLI. That makes it easier to audit than a full trading stack.
- Good fit for research — The negative-cycle scanner and depth-limited router are useful for backtests, arb probes, and route comparison scripts.
- Transparent failure modes — If a venue cannot be modeled safely, Lighthouse Router refuses to lie about the quote. That is a better default than returning a bad number.
- Rust-first integration — The library API is idiomatic Rust, so it plugs into services, agents, and CLI tools without a glue layer.
Cons:
- Not an execution engine — Lighthouse Router does not build swap transactions, manage CPI, or handle settlement.
- Limited venue coverage — It currently focuses on Raydium AMM v4, Orca Whirlpool, and Phoenix, so it is not a full Solana liquidity map.
- Whirlpool edge cases remain conservative — The single-tick-range limitation means some swaps are intentionally rejected rather than approximated.
- Phoenix needs external wiring — You must feed the typed Phoenix model from
phoenix-sdkor equivalent account loading. - RPC quality affects output — Bad RPC data, stale slots, or account fetch failures will directly affect route quality.
Getting Started with Lighthouse Router
The fastest way to try Lighthouse Router is to add the crate or install the CLI from source, then point it at a Solana RPC endpoint. The repository defaults to https://api.mainnet-beta.solana.com if SOLANA_RPC_URL is unset.
cargo add lighthouse-router
cargo install --path .
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com lighthouse quote --from EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v --to So11111111111111111111111111111111111111112 --amount 1000000000 --max-hops 3
After the command runs, Lighthouse Router fetches pool accounts, decodes the supported venue types, builds the token graph, and prints the best route it can find. If you are using the library API, the next step is usually loading pools from your own source and calling Graph::build(pools) before best_route(...).
For arbitrage research, start from the included examples in examples/quote.rs and examples/find_arb.rs. Those examples are useful because they do not require a production trade engine, only RPC access and pool state.
Verdict
Lighthouse Router is the strongest option for local Solana route discovery when you want Rust-native control over pool math and graph search. Its biggest strength is deterministic quoting across Raydium, Orca, and Phoenix; its main caveat is that it stops short of execution and stays conservative on edge cases. Use it for scripting, research, and arb scanning, and keep Jupiter for full routing execution.


