[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":14,"stars30d":14,"stars90d":14,"forks30d":14,"starsTrendScore":14,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":16,"archived":17,"fork":17,"defaultBranch":18,"hasWiki":17,"hasPages":17,"topics":19,"createdAt":9,"pushedAt":9,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":14,"starSnapshotCount":14,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},114,"lighthouse-router","evanphi7\u002Flighthouse-router","evanphi7","Off-chain DEX route discovery on Solana — pool decoders, multi-hop quoting, and arbitrage cycle detection",null,"Rust",455,311,5,0,7.48,"Other",false,"main",[],"2026-06-12 02:00:08","# Lighthouse Router\n\nOff-chain DEX route discovery for Solana. Built so that I'd stop hand-rolling\nthe same constant-product math in every script I write.\n\n![Rust](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frust-1.74+-orange?style=flat-square)\n![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-blue?style=flat-square)\n![Solana](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fsolana-1.18-9945FF?style=flat-square)\n\n## Why?\n\nWhen you want to quote a swap across Solana DEXs without delegating it to a\nthird-party router, you end up reimplementing pool math, account decoding,\nand shortest-path search. This crate is the small set of primitives I use\nfor that, kept honest by tests.\n\nIt is **not** a Jupiter replacement. It is small, dependency-light, and\npredictable. If you need cross-program invocation, MEV bundle building, or\nslippage protection in production: keep using something else.\n\n## What's in here\n\n- Pool decoders for Raydium AMM v4, Orca Whirlpool, and Phoenix order books\n  (the last is a typed model — feed it from `phoenix-sdk`).\n- Constant-product and concentrated-liquidity quote math, with tests.\n- A token graph and a depth-limited router for multi-hop quotes.\n- Bellman-Ford negative-cycle detection for marginal-price arbitrage scans.\n- A `lighthouse` CLI that wires it all up against an RPC endpoint.\n\n## Architecture\n\n```\n┌────────────────┐     ┌──────────────────┐     ┌──────────────┐\n│  Solana RPC    │ ──► │  client::fetch_  │ ──► │  decoders    │\n│  (mainnet\u002FRPC) │     │  many (parallel) │     │  raydium \u002F   │\n└────────────────┘     └──────────────────┘     │  orca \u002F      │\n                                                │  phoenix     │\n                                                └──────┬───────┘\n                                                       │ AnyPool\n                                                       ▼\n                              ┌────────────┐   ┌───────────────┐\n                              │  cache     │ ◄─┤  pool::Quoter │\n                              │  (TTL)     │   └──────┬────────┘\n                              └────────────┘          │\n                                                      ▼\n                                              ┌───────────────┐\n                                              │  graph::Graph │\n                                              └──┬──────────┬─┘\n                                                 │          │\n                                       router::best_route   │\n                                                            ▼\n                                                arbitrage::find_negative_cycle\n```\n\nThe `Quoter` trait is the seam between pool decoding and routing — every\nDEX integration needs to provide `mints()`, `quote()`, and `is_active()`.\n`AnyPool` is the runtime sum type the graph stores, so the router doesn't\nneed to be generic over each concrete venue.\n\n## Install & Run\n\n```bash\ncargo add lighthouse-router      # as a library\n# or, for the CLI:\ncargo install --path .\n```\n\nQuote a route:\n\n```bash\nlighthouse quote \\\n  --from EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \\\n  --to   So11111111111111111111111111111111111111112  \\\n  --amount 1_000_000_000 \\\n  --max-hops 3\n```\n\n## Library usage\n\n```rust\nuse lighthouse_router::{best_route, AnyPool, Graph, Pool};\n\nlet pools: Vec\u003CAnyPool> = load_pools_from_somewhere();\nlet graph = Graph::build(pools);\n\nlet route = best_route(&graph, usdc_mint, sol_mint, 1_000_000, 3)?;\nprintln!(\"out = {}\", route.amount_out);\nfor step in &route.steps {\n    println!(\"  {} via {}\", step.pool_idx, step.venue);\n}\n```\n\nSee `examples\u002Fquote.rs` and `examples\u002Ffind_arb.rs` for runnable end-to-end\nexamples that don't need an RPC connection.\n\n## Configuration\n\n| Flag                | Default                                | Notes                                |\n|---------------------|----------------------------------------|--------------------------------------|\n| `--rpc`             | `https:\u002F\u002Fapi.mainnet-beta.solana.com`  | Read from `SOLANA_RPC_URL` if unset. |\n| `--max-hops`        | `3`                                    | Routing depth ceiling.               |\n| `--probe` (arb)     | `1_000_000`                            | Probe size for marginal-price weights. |\n\n## Status\n\nEarly but useful. The bits I rely on day-to-day (CP math, the graph builder,\nand the CLI quote command) are stable. The Whirlpool quoter is honest about\nits single-tick-range limitation: it refuses to quote rather than lie when\na swap would cross a tick. Phoenix is a typed model — you wire it up.\n\n## License\n\nApache-2.0. See [LICENSE](LICENSE).\n","Lighthouse Router 是一个用于Solana链下DEX路径发现的工具，支持池解码、多跳报价和套利循环检测。项目采用Rust语言编写，提供包括Raydium AMM v4、Orca Whirlpool及Phoenix订单簿在内的多种流动性池解码器，并实现了常量乘积与集中流动性报价算法。此外，它还具备构建基于令牌图的多跳报价路由以及利用Bellman-Ford算法识别负权重循环的能力，适用于需要手动计算跨DEX交易而不依赖第三方路由器的应用场景。尽管该项目规模较小且轻量级，但对于寻求更高级功能如跨程序调用或滑点保护的用户来说，则建议考虑其他解决方案。",2,"2026-05-06 17:18:50","CREATED_QUERY"]