hikaraagent/hikara

GitHub: hikaraagent/hikara

一款面向 Solana 主网的只读 MEV 取证代理,实时解码链上交换并分类检测 sandwich、JIT、backrun 等 MEV 行为,帮助用户量化暗中被掠夺的损失。

Stars: 0 | Forks: 0

hikara ### Solana MEV 取证代理 设计为只读模式。揭示你在暗处被掠夺了什么。 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml) [![Rust](https://img.shields.io/badge/rust-stable-orange.svg)](ingest-rs/Cargo.toml) [![CI](https://img.shields.io/badge/ci-pytest%20%2B%20cargo-success.svg)](.github/workflows/ci.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) [![X / Twitter](https://img.shields.io/badge/x-@__H__i__k__a__r__a__-000000.svg)](https://x.com/_H_i_k_a_r_a_) [![Website](https://img.shields.io/badge/site-hikara.xyz-white.svg)](https://hikara.xyz/) [![Solana](https://img.shields.io/badge/chain-solana-9945FF.svg)]() [![Raydium](https://img.shields.io/badge/decode-raydium%20%2B%20orca-14F195.svg)]() [![Jito](https://img.shields.io/badge/attribution-jito%20bundles-000000.svg)]() [**功能**](#what-it-does) · [**工作原理**](#how-it-works) · [**启发式**](#detection-heuristics) · [**快速开始**](#quickstart) · [**命令行**](#cli-reference) · [**架构**](#architecture) · [**路线图**](#roadmap)
## 功能 - 监控 Solana 主网上的每一个 slot,解码 Raydium 和 Orca 的交换,重构 Jito bundles - 对事件进行分类:sandwich、jit、backrun、liquidation、atomic arb - 归属领导者(验证者)、已知搜索者和 Jito 小费转账 - 为每个事件在 [0.0, 0.95] 的置信度内给出裁定。这是检测器,而不是预言机 没有钱包。没有签名者。没有执行器。没有交易。任何人为构建抢跑工具而进行分叉,都应在他们自己的仓库中进行。 ## 工作原理 ``` geyser / shredstream finalized slots │ │ ▼ ▼ ┌──────────────┐ ┌──────────────┐ │ ingest-rs │ │ getBlock │ │ grpc stream │ │ getTransaction│ └──────┬───────┘ └──────┬───────┘ │ │ └──────────────┬──────────────────┘ ▼ ┌───────────────┐ │ decode │ raydium amm v4, orca whirlpool, jupiter routes └──────┬────────┘ ▼ ┌──────────────┐ │ classify │ SAND-01, BACK-01, JIT-01, ARB-01 └──────┬───────┘ ▼ ┌──────────────┐ │ score │ rule-based, capped at 0.95 └──────┬───────┘ ▼ ┌──────────────┐ │ ai filter │ optional. only reviews edge cases └──────┬───────┘ ▼ ┌──────────────┐ │ output sinks │ stdout · jsonl · webhook └──────────────┘ ``` 每个步骤都是独立的。你可以插入自己的 ingest、分类器和 sink。层与层之间的契约是 `src/hikara/core/types.py` 中的 `Event` 数据类。 ## 支持 | 目标 | 状态 | |-----------------------|:------:| | Solana 主网 | 🟢 | | Raydium AMM v4 | 🟢 | | Orca Whirlpool | 🟢 | | Jito bundle 归属 | 🟢 | | 验证者 (leader) 标签 | 🟢 | | Meteora DLMM | 🟡 | | Meteora AMM | 🟡 | | Lifinity v2 | 🟡 | | Jupiter v6 路由 | 🟡 | | pump.fun 绑定的交换 | ⚪ | | Raydium CLMM | ⚪ | | Phoenix CLOB | ⚪ | 🟢 主要 · 🟡 就绪,覆盖率较低 · ⚪ 占位或计划中 ## 检测启发式 每条规则都有一个用于 `event.notes` 的 ID,以便你追踪触发了什么。 | id | 捕获内容 | 包含于 | |-----------|----------------------------------------------------------------|:----------:| | SAND-01 | 经典的 sandwich:front + victim + back 在同一个池中,方向相反 | v0.2 | | BACK-01 | 针对用户 swap 的一步 backrun 套利 | v0.2 | | JIT-01 | 围绕受害者的 swap 进行的即时流动性添加+移除 | v0.3 | | ARB-01 | 单笔交易中跨 3 个以上池的原子多跳套利 | v0.3 | | LEAD-01 | 领导者串通:同一个领导者在连续 N 个 slot 中捕获多个 bundles | v0.4 | | LIQ-01 | 带有优先级操纵的 kamino/marginfi 清算 | v0.4 | 新规则随版本发布,而不是通过特性标志。此仓库是真相的来源。 ## 快速开始 需要 Python 3.9+ 和 Rust 稳定版。 ``` git clone https://github.com/hikaraagent/hikara.git cd hikara # 安装 python package + dev deps make install # 构建 rust ingest crate cd ingest-rs && cargo build --release && cd .. # 运行离线 demo (零网络) hikara demo investigate # 针对你的 rpc 运行 live scanner cp .env.example .env $EDITOR .env # set HIKARA_RPC_HTTP_URL and / or HIKARA_GEYSER_GRPC_URL hikara scan ``` 没有 RPC?`hikara demo scan` 会针对合成夹具展示完整的流程。 ## 命令行参考 ``` hikara --version # quick version check hikara version # version + active config hikara scan # live slot + bundle scan hikara scan --once # one slot then exit (smoke test) hikara investigate # walk the pipeline on a specific target hikara demo scan # canned scan against a synthetic slot hikara demo investigate # full pipeline trace, prints every step hikara demo replay # replay a recorded fixture ``` `hikara demo investigate` 的示例输出: ``` ─────────────────── step 1. decoded swaps ──────────────────── slot 287000000 idx 0 sender JTOArByrMv... pool 58oQChx4yW... in 8_000_000_000 out 24_000_000_000 slot 287000000 idx 1 sender VicT1mw411... pool 58oQChx4yW... in 2_000_000_000 out 5_950_000_000 slot 287000000 idx 2 sender JTOArByrMv... pool 58oQChx4yW... in 24_500_000_000 out 8_300_000_000 ─────────────────── step 2. classifier rules ───────────────── rules fired: ['SAND-01'] slot verdict: likely events found: 1 ─────────────────── step 3. score per event ───────────────── sandwich slot 287000000 base[sandwich]=0.70 jito_tip>0:+0.10 bundle.txs>=2:+0.05 victims_present:+0.05 -> verdict=confirmed conf=0.900 ─────────────────────── done ──────────────────────────────── ``` ## 架构 ``` hikara/ ├── src/hikara/ python package │ ├── core/ types · classify · score │ ├── decode/ raydium · orca · program ids │ ├── enrich/ leader · jito tip · searcher │ ├── ingest/ geyser + jito relay stubs (rust later) │ ├── output/ stdout · jsonl · webhook │ ├── ai/ optional rule reviewer │ ├── demo/ offline scripted demos │ └── cli.py typer entrypoint ├── ingest-rs/ low-level ingest crate (rust) │ └── src/ {mempool,bundle,trace}.rs ├── tests/ pytest suite └── docs/ architecture · heuristics · glossary ``` | 区域 | 语言 | 维护者 | |-------------------------|----------|---------------| | 核心、评分、CI | Python | @hikaraagent | | ingest-rs、geyser | Rust | @0xnova | | 分类、启发式 | Python | @mikrohash | | 解码、输出、CLI | Python | @luka | ## 路线图 | 版本 | 范围 | 状态 | |---------|------------------------------------------------------------------------------|:-------:| | v0.1 |(以太坊时代)Uniswap v2/v3 上的 sandwich + backrun。已归档,请参阅 CHANGELOG。 | 已归档 | | v0.2 | 链方向转向 Solana。Raydium + Orca 解码。Sol 上的 SAND-01 + BACK-01。演示 + CLI。 | 已发布 | | v0.3 | 通过 pyo3 连接的 Rust geyser ingest。JIT-01 + ARB-01 规则。夹具重放。 | 当前 | | v0.4 | Meteora + Lifinity 解码器。LEAD-01 领导者串通。LIQ-01 清算。 | 计划中 | | v0.5 | 每个搜索者的 PnL 排行榜。每个领导者的 bundle 份额。每周摘要。 | 计划中 | | v0.6 | Shredstream 低延迟模式。pump.fun + Phoenix 解码器。 | 计划中 | ## 许可证 [MIT](LICENSE)。使用它,分叉它,做得更好。
标签:DeFi, Jito Bundles, MEV, Orca, Python, Raydium, Rust, Sniffer, Solana, 三明治攻击, 交易审计, 交易监控, 区块链取证, 区块链安全, 可视化界面, 套利, 无后门, 暗池监控, 法证分析, 清算, 网络安全, 网络流量审计, 逆向工具, 链上分析, 隐私保护