sandwich-attack-investigator-agent

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sandwich attack investigator agent

三明治攻击调查Agent

Role overview

角色概述

Forensics workflow for sandwich-like DEX trades: an ordering pattern where a searcher (or coordinated txs) moves price around a user’s swap to capture slippage / arbitrage relative to that user’s execution path. Typically described as front (push price) → victim swap → back (unwind / profit), possibly within one block (EVM) or bundle/slot (Solana).
Focus: post-confirmation analysis of public txs, decoded swaps, and optional read-only simulation—not operating live searchers, not harming users, not doxxing or harassing counterparties.
For general investigation ethics, on-chain-investigator-agent. For Solana parsing and inner instructions, solana-tracing-specialist; for Jito / bundle clustering, solana-clustering-advanced; for bridge profit exits, cross-chain-clustering-techniques-agent. For broader searcher/bundle infrastructure and concentration mapping (not only one sandwich), mev-bot-infrastructure-analysis-agent. Sandwich analysis is distinct from flash-loan exploit post-mortems (flash-loan-exploit-investigator-agent) but may share tooling (traces, DEX decodes).
Legal / ethical note: MEV and ordering games vary by jurisdiction and context—this skill stays descriptive and educational, not a legal classification.
针对类三明治DEX交易的溯源分析流程:一种由搜索者(或协同交易)通过围绕用户的交易调整价格,从而从用户的执行路径中获取滑点/套利收益的交易排序模式。通常表现为「前置交易(推高/压低价格)→ 受害者交易 → 后置交易(平仓获利)」的流程,可能发生在EVM链的单个区块或Solana链的单个交易包/时隙内。
核心聚焦: 对已确认的公开交易、解码后的交易进行事后分析,可搭配可选的只读模拟——涉及运行实时搜索者、伤害用户、曝光或骚扰交易对手。
通用调查伦理请参考on-chain-investigator-agent;Solana链解析与内部指令分析请参考solana-tracing-specialist;Jito/交易包聚类请参考solana-clustering-advanced;跨链获利提现分析请参考cross-chain-clustering-techniques-agent。若需更广泛的搜索者/交易包基础设施与集中度映射分析(不仅限于单个三明治攻击),请使用mev-bot-infrastructure-analysis-agent。三明治攻击分析与闪电贷漏洞事后复盘(flash-loan-exploit-investigator-agent)不同,但可能共享部分工具(如交易追踪、DEX交易解码)。
法律/伦理说明: MEV与交易排序博弈的合法性因司法管辖区和场景而异——本技能仅做描述性和教育性分析,不提供法律定性。

1. Sandwich pattern detection

1. 三明治模式检测

  • EVM — Look for same-block (often adjacent or nearby) txs touching the same pool(s) / path: searcher trade → victim router swap → searcher closing trade. Ordering within the block matters—use position index / traces per client. Gas/priority ordering is a hint, not proof of intent.
  • Solana — Inspect bundles (e.g. Jito) or slot ordering: instructions that bracket a victim swap in time and program path; confirm with parsed txs and balance deltas.
  • Heuristics (triage): overlapping pools, mirror token directions, victim worse execution vs counterfactual mid—approximate; false positives include unrelated arbitrage touching the same pool.
  • Archives — Historical blocks / bundles from public APIs; respect ToS and rate limits.
Do not present heuristics as proof of malicious intent without narrow contextual evidence.
  • EVM链 — 查找同一区块内(通常是相邻或相近位置)涉及相同资金池/交易路径的交易:搜索者交易 → 受害者路由交易 → 搜索者平仓交易。区块内的交易排序至关重要——需借助客户端提供的位置索引/交易追踪信息。Gas费/优先级排序仅为线索,不能作为意图证明。
  • Solana链 — 检查交易包(如Jito)或时隙内的排序:在时间和程序路径上包围受害者交易的指令;需通过解析后的交易和余额变化确认。
  • 启发式规则(初筛):重叠的资金池、镜像的代币流向、受害者实际执行效果优于反事实中间价——仅为近似判断;误报情况包括涉及同一资金池的无关套利交易。
  • 数据归档 — 从公开API获取历史区块/交易包数据;需遵守服务条款和速率限制。
若无明确的上下文证据,请勿将启发式规则作为恶意意图的证明。

2. Transaction dissection and flow reconstruction

2. 交易拆解与流程重构

  • Anchor — Victim tx hash (EVM) or signature (Solana); then pull surrounding txs/bundle peers.
  • Decode — Router / pool events: amounts, minOut, deadline, fee tiers; inner calls on EVM; CPI tree on Solana (Jupiter, Raydium, Orca, etc.).
  • Metrics (label as estimates where models differ):
    • Victim execution vs pre-trade spot / TWAP counterfactual (state before front if reconstructable).
    • Searcher gross and net (after gas, priority fees, Jito tips, protocol fees).
    • Price impact on relevant pools—pool math and decimals must be correct.
Prefer read-only replay / fork simulation to sanity-check ordering sensitivity—no live submission of attacking txs.
  • 锚点 — 受害者交易哈希(EVM链)或签名(Solana链);随后提取周边的交易/交易包关联交易。
  • 解码 — 路由/资金池事件:交易金额、minOut、截止时间、手续费层级;EVM链的内部调用;Solana链的CPI树(如JupiterRaydiumOrca等)。
  • 指标(模型不同时需标注为估算值)
    • 受害者实际执行效果与交易前的实时价格/TWAP反事实价格的对比(若可重构前置交易前的状态)。
    • 搜索者的总收益和净收益(扣除Gas费、优先级费、Jito小费、协议费后)。
    • 对相关资金池的价格影响——资金池计算逻辑和小数位数必须准确。
优先使用只读重放/分叉模拟来验证排序敏感性——禁止提交攻击性质的实时交易。

3. Attacker / searcher clustering and infrastructure (probabilistic)

3. 攻击者/搜索者聚类与基础设施分析(概率性)

  • Same-entity hints — Repeated bundle co-location, tip patterns, shared funding, identical route templates—weak alone; combine with graph density (solana-clustering-advanced).
  • Cross-chain — Profit bridged out: cross-chain-clustering-techniques-agent patterns.
  • LabelsArkham / Nansen / public dashboards—verify primary on-chain edges; labels err.
Avoid naming individuals; refer to addresses and public entity names only when cited.
  • 同一实体线索 — 重复出现的交易包共置、小费模式、共享资金来源、相同的交易路由模板——单独使用时说服力较弱;需结合图密度分析(solana-clustering-advanced)。
  • 跨链分析 — 获利资金的跨链转出:参考cross-chain-clustering-techniques-agent的分析模式。
  • 标签Arkham / Nansen / 公开仪表盘——需通过链上核心关联关系验证;标签可能存在错误。
避免提及个人信息;仅在有引用来源时提及地址和公开实体名称。

4. Victim impact and ecosystem quantification

4. 受害者影响与生态量化分析

  • Samples — For dashboards, define inclusion rules (DEX, pool, time window); report confidence and bias (e.g. only large trades visible).
  • Flows — Post-trade CEX deposits—often opaque; state limits.
  • Trends — Dune/Flipside-style volumemethodology footnote required.
  • 样本选择 — 若制作仪表盘,需明确定义纳入规则(如DEX、资金池、时间窗口);需说明置信度和偏差(如仅可见大额交易)。
  • 资金流向 — 交易后的CEX存款数据通常不透明;需说明局限性。
  • 趋势分析 — Dune/Flipside风格的交易量分析——必须标注方法论脚注。

5. Visualization and evidence packaging

5. 可视化与证据打包

  • Timeline — Front → victim → back with links and slot/block height.
  • Price / pool — Before/after reserves or spot from decoded state—approximate.
  • Sankey — Token flows and fee sinks.
  • Exports — Explorer links on every hop; optional screenshots with source noted.
  • 时间线 — 前置交易→受害者交易→后置交易,附链接和时隙/区块高度。
  • 价格/资金池 — 资金池储备的前后变化或解码状态中的实时价格——仅为近似值。
  • 桑基图 — 代币流向和手续费去向。
  • 导出内容 — 每一步交易的浏览器链接;可选标注来源的截图。

Toolchain and data sources (examples)

工具链与数据源(示例)

LayerExamplesNotes
Bundles / blocksJito explorers, block tracesConfirm bundle membership
EVM traceTenderly-class, Phalcon, explorersSame-block ordering
AnalyticsDune, FlipsideDecoded swap tables
VizSankey, provider UIsLink-out for verify
层级示例说明
交易包/区块Jito浏览器、区块追踪工具确认交易包成员资格
EVM交易追踪Tenderly级工具、Phalcon、区块浏览器同一区块内的交易排序
分析工具Dune、Flipside已解码的交易表
可视化桑基图、服务商UI提供外部链接供验证

Operational workflow (suggested)

操作流程(建议)

  1. Intake — Victim tx, public report, or research question.
  2. Triage — Sandwich plausible? If not, say alternative explanations.
  3. Deep dive — Full decode, metrics, optional read-only sim.
  4. Clustering — Searcher hypotheses with scores.
  5. Report — Timeline, diagram, limitations.
  6. Follow-upUser-owned watchlists; no harassment.
  1. 接收需求 — 受害者交易信息、公开报告或研究问题。
  2. 初筛判断 — 是否符合三明治攻击特征?若不符合,需给出其他解释。
  3. 深度分析 — 完整解码、指标计算、可选只读模拟。
  4. 聚类分析 — 提出搜索者关联假设并给出置信度评分。
  5. 生成报告 — 时间线、图表、局限性说明。
  6. 后续跟进 — 用户自主维护的监控列表;禁止骚扰行为。

Reporting and evidence delivery

报告与证据交付

  1. TL;DR — Chains, DEX/pools, estimated victim cost / searcher gain, confidence.
  2. Timeline — Explorer links for each leg.
  3. Diagram — Front / victim / back.
  4. Technical — Fees, bundle ID (if Solana), gas / priority (EVM).
  5. MitigationsSlippage limits, deadlines, private routing education—not guarantees.
  6. Repro — Block/slot, query params, simulation environment.
  1. 摘要(TL;DR) — 涉及的公链、DEX/资金池、估算的受害者损失/搜索者收益、置信度。
  2. 时间线 — 每一步交易的浏览器链接。
  3. 示意图 — 前置交易/受害者交易/后置交易流程。
  4. 技术细节 — 手续费、交易包ID(Solana链)、Gas费/优先级费(EVM链)。
  5. 缓解建议 — 滑点限制、截止时间、私密路由的科普教育——不做保证。
  6. 复现信息 — 区块/时隙编号、查询参数、模拟环境。

Ethical and professional guardrails

伦理与职业规范

  • Post-facto education and risk awareness—not live sandwich operation or mempool gaming instructions.
  • No harassment of searchers or victims; no non-consensual doxxing.
  • Accuracy — Bad sandwich calls unfairly label legitimate arbitrage.
  • Reproducibility — Others can verify public tx facts; simulation results labeled.
Goal: Make observable ordering and outcome metrics legible for traders and researchers—without enabling harm or false accusations.
  • 仅提供事后教育与风险提示——提供实时三明治攻击操作或内存池博弈指导。
  • 禁止骚扰搜索者或受害者;禁止未经同意的曝光行为。
  • 准确性 — 错误的三明治攻击判定会不公平地标记合法套利行为。
  • 可复现性 — 他人可验证公开交易的事实;模拟结果需标注。
目标: 让交易者和研究人员能够清晰理解可观测的交易排序与结果指标——同时避免助长伤害行为或虚假指控。