The first fully autonomous 8-gate vulnerability verification pipeline for smart contract auditing.
Nexus Trinity is a production-grade AI security research system built to find, verify, and submit high-value vulnerabilities in DeFi protocols — autonomously, at scale, without human intervention at each step.
It does not scan for known patterns. It reasons about novel vulnerabilities using a chain of AI models, on-chain state reads, and economic validation before a finding ever touches human hands.
DeFi hacks have drained $7.7 billion from protocols since 2020 (DeFiHackLabs). The bottleneck is not detection — it is verification speed. Every hour between discovery and disclosure is an hour an attacker can exploit the same bug.
Traditional audits take 2–6 weeks per protocol. Bug bounty hunters manually verify each hypothesis. False positives waste weeks of research time and damage credibility with programs.
Nexus Trinity compresses that cycle to hours.
| Finding | Verdict | Gate Blocked At | Notes |
|---|---|---|---|
| Share inflation via first depositor | FALSE POSITIVE | Gate 2 | DECIMALS_OFFSET (1e6) correctly mitigates |
| TOCTOU queue asymmetry | FALSE POSITIVE | Gate 3 | totalAssets is order-invariant — confirmed in source |
| setFee() Critical | FALSE POSITIVE | Gate 2 | Fee on interest only (totalInterest), trusted role = out of scope |
| Liquidation callback reentrancy | FALSE POSITIVE | Gate 8 | IMorphoLiquidateCallback is intentional design; profit math wrong |
4 false positives blocked before submission. Each would have damaged standing with Morpho and Cantina.
| Finding | Verdict | Gate | Notes |
|---|---|---|---|
| MulDiv precision loss in fee calculation | REJECTED | Gate 5 (Economics) | Net profit -$2,048 after gas — not economically exploitable |
Gate 5 economics validation saved a rejected submission. Sherlock/Cantina rejections damage your track record; this system blocked it automatically.
- 8 findings entered pipeline
- 5 blocked by gates before submission (no bad submissions)
- 3 survived to human review (2 Low, 1 Info — submitted)
- 0 rejected submissions to date
Every hypothesis runs a gauntlet. All 8 gates must pass before a finding is surfaced.
Gate 0 NOVELTY → Is this already known? (semantic embedding similarity)
Gate 1 HYPOTHESIS → Falsifiable IF/THEN/BECAUSE claim with file:line citation
Gate 2 EVIDENCE → Code citations verified against actual source
Gate 3 SIMULATION → PoC executed on mainnet fork (Foundry)
Gate 4 REPLAY → Deterministic across 2+ independent runs
Gate 5 ECONOMICS → profit > 0 after gas + slippage + MEV costs
Gate 6 ADVERSARIAL → Cannot be refuted by protocol owner's defense
Gate 7 REPRODUCIBLE → Third-party can reproduce from report alone
Gate 8 DOCTOR REVIEW → Pi (adversarial AI) plays protocol owner — blocks false positives
No human approves findings between gates. The system self-governs.
| Model | Role | Where Used |
|---|---|---|
| Claude Fable 5 (Anthropic) | Primary reasoning | Gates 5-8, report writing |
| DeepSeek-R1:70b (local) | Adversarial reasoning | Gates 3-6, fallback |
| Gemma4 (local / Pi) | Fast triage | Gates 1-2 |
| nomic-embed-text (local) | Semantic dedup | Gate 0 novelty detection |
LLMAuditor— reads real Solidity source function-by-function, generates contract-specific hypotheses with mandatory file:line citations. No hallucination: every claim must cite code it actually read.RAOBrain— Reason-Act-Observe loop that generates, ranks, and chains vulnerability hypotheses using a 29-pattern DeFi knowledge graph + LLM analysis + HuggingFace training dataOnChainClient— stdlib-only JSON-RPC client (no web3.py dependency) for live blockchain state reads; includes keccak-256 ABI encodingOnChainVerifier— turns a hypothesis into a Foundry test harness, optionally runs forge on a mainnet fork, returns PoC + on-chain evidenceAsyncManager— semaphore-bounded concurrent analysis with exponential backoff; fully utilizes M5 Max 18-core architectureDataIngestor— unified threat intelligence pipeline pulling from DeFiHackLabs, HuggingFace datasets, and prior audit memory; normalizes to Hypothesis objectsModelRouter— three-tier circuit-breaker routing: Anthropic → DeepSeek-R1 → Gemma4; auto-recovers from rate limits
- 8,942 rows across 5 HuggingFace smart contract security datasets
- DeFiHackLabs incident corpus (2021–2026): flash loan, oracle, reentrancy, access control patterns
- 29 KG patterns in local DeFi knowledge graph, severity-weighted and CFG-signal boosted
- Gate 0 embedding store: prior findings indexed for semantic novelty detection
- Prompt injection defense (15-pattern regex stripping attack phrases from Solidity source before LLM submission)
- Circuit breakers on all three LLM backends (prevents cascading failures)
- Anti-hallucination enforcement: every hypothesis requires
filename.sol:linenumcitation or it is dropped - False positive log: all Gate 8 blocks recorded with reasoning
| Protocol | Platform | Focus Areas | Status |
|---|---|---|---|
| Morpho Blue | Cantina | Vault accounting, share rounding, interest accrual | Audited — 2 Low, 1 Info |
| Uniswap V4 | Sherlock | Hooks, PoolManager, transient storage (EIP-1153) | Active |
| Lido | Immunefi | Withdrawal queue, oracle, stETH shares math | Cloned, ready |
| Seaport | Cantina | Order fulfillment math, zone authorization | Cloned, ready |
Bug bounty programs pay $50,000–$10,000,000 per Critical finding. The top programs:
- Immunefi: up to $10M per Critical
- Cantina: up to $1M per audit competition
- Sherlock: up to $500K per contest
A single Critical finding from a well-known protocol covers months of operating costs. The system runs autonomously, meaning marginal cost per audit is compute time, not human hours.
- False positive suppression — most bug hunters submit bad findings and get rejected; this system does not. Zero rejected submissions to date.
- Speed — full 8-gate pipeline on a new contract in hours, not weeks
- Scale — can run against 10 protocols simultaneously; human auditors cannot
- Self-improving — DataIngestor feeds new incidents into the knowledge graph; every new DeFi hack makes the system smarter
| Category | Purpose |
|---|---|
| Compute | Scale from 1 to 10 parallel audit pipelines |
| Scope expansion | Add Ethereum L2s (Arbitrum, Base, Optimism hooks) |
| Legal | LLC formation, bug bounty engagement contracts |
| Data | Premium RPC endpoints (Alchemy/Infura) for Gate 3 fork testing |
# Run full pipeline on any contract
python3 trinity.py pipeline --hypothesis "IF X THEN Y BECAUSE Z" --contract src/Vault.sol
# LLM reads real source, generates contract-specific hypotheses
python3 trinity.py analyze --contract targets/lido/contracts/0.8.9/WithdrawalQueue.sol
# Ingest threat intelligence from all sources
python3 trinity.py ingest --max 500 --seed-rao
# Check for duplicate findings (Gate 0)
python3 trinity.py gate0 --finding "IF totalAssets can be inflated..."
# Read live on-chain state for hypothesis
python3 trinity.py rpc-read --address 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFc --hypothesis "IF..."
# Check LLM routing status (Anthropic / DeepSeek / Gemma4)
python3 trinity.py router-statustrinity.py (CLI)
│
├── core/gates/verification_loop.py ← 8-gate orchestrator
│ ├── gate0_novelty.py ← semantic + regex novelty check
│ ├── verification_loop.py ← Gates 1-7
│ └── [Gate 8: ModelRouter→adversarial review]
│
├── core/rao_brain.py ← hypothesis generation + chain scoring
│ ├── core/llm_auditor.py ← reads real Solidity source
│ ├── core/analysis/defi_kg.py ← 29-pattern knowledge graph
│ └── core/analysis/cfg_builder.py ← control flow signals
│
├── core/model_router.py ← Anthropic→DeepSeek→Gemma4 routing
├── core/onchain_client.py ← stdlib JSON-RPC, keccak-256 ABI
├── core/on_chain_verifier.py ← Foundry harness generator
├── core/async_manager.py ← concurrent audit with backoff
└── core/data_ingestor.py ← threat intel normalization pipeline
2consultingfreelancers@gmail.com
Available for: bug bounty partnerships, protocol security retainers, white-label audit tooling licensing
Built on Apple M5 Max. All findings verified on mainnet forks. No findings submitted without surviving all 8 gates.