Orkid Labs
← Back to blog

Published on Sat Oct 18 2025 00:00:00 GMT+0000 (Coordinated Universal Time) by Orkid Labs

TL;DR

Two months ago, we started building ORKID—a physics-based MEV detection and execution engine. Today, we’re celebrating:

  • 12.5x performance improvement (Rust migration)
  • 3 chains supported (Ethereum, Base, Unichain)
  • Production execution (live fills on mainnet)
  • 30,800 words of research content published (6 blog posts)
  • Physics engine (TPS, TSS, CPMD) operational
  • PWA-ready frontend with real-time streaming

This is our story. The wins, the bugs, the late nights, and the breakthroughs.


The Vision: Why Physics?

Most MEV bots use naive heuristics: “If price A > price B, arbitrage exists.”

Problem: This ignores gas costs, slippage, execution probability, and market microstructure.

Our approach: Treat DeFi markets as physical systems governed by thermodynamic principles.

Financial Molecular Dynamics (FiMD)

We built an FiMD engine inspired by computational chemistry:

  • Transition Path Sampling (TPS): Predicts rare events (profitable arbitrage opportunities)
  • Transition State Sampling (TSS): Identifies regime boundaries (market phase transitions)
  • Carr-Parrinello MD (CPMD): Simulates market state evolution with realistic dynamics
  • Nose-Hoover Thermostat: Models market “temperature” (volatility)

Result: We don’t just detect arbitrage—we predict when markets will transition into profitable states.


What We Built (August 14 - October 17, 2024)

Month 1: Foundation (August 14 - September 14)

Week 1-2: Core Infrastructure

  • ✅ FMD detector (TypeScript prototype)
  • ✅ Arbitrage detection on Polygon
  • ✅ Mempool observer (real-time monitoring)
  • ✅ Next.js 14 dashboard with WebSocket streaming
  • ✅ RESTful API with live telemetry

Week 3-4: Rust Migration Begins

  • orkid-native Neon module (Uniswap V2 AMM math)
  • ✅ 5x speedup on constant product calculations
  • ✅ TypeScript wrapper for seamless integration
  • ✅ Vitest benchmarks (performance validation)

Key Milestone: First Rust module integrated! 🦀

Month 2: Production & Multi-Chain (September 14 - October 14)

Week 5-6: Complete FMD Engine

  • ✅ Full Rust FMD implementation (TPS, TSS, CPMD)
  • 12.5x speedup on TPS engine (16-core CPU)
  • ✅ Parallel ensemble sampling (rare event detection)
  • ✅ ARIMAX time series prediction
  • ✅ XGBoost gradient boosting optimization

Week 7-8: Multi-Chain Expansion

  • ✅ Tycho Protocol integration (Base, Unichain, Ethereum)
  • ✅ Chain-abstracted execution (no infrastructure changes)
  • ✅ Uniswap V2/V3/V4 support across all chains
  • ✅ Balancer V2/V3, Curve, Maverick, Sushiswap

Week 9: Production Execution & Thought Leadership (October 14-17)

Production Execution:

  • ✅ Live fills on Ethereum mainnet
  • ✅ Balancer flash loan integration
  • ✅ Tycho Router execution
  • ✅ Real-time opportunity detection

Research & Content:

  • ✅ 6 blog posts published (30,800 words)
  • ✅ Blockchain thermodynamics framework
  • ✅ Negative EV rate model
  • ✅ Complex microstructure scoring
  • ✅ arXiv-ready research paper
  • ✅ “Two Months Building ORKID” retrospective

Technical Highlights

1. Rust Performance Core

Challenge: TypeScript FMD detector was too slow (50-168ms per opportunity).

Solution: Migrate to Rust with Neon FFI.

Results:

  • TPS Engine: 50-168ms → <10ms (12.5x faster)
  • AMM Math: 5ms → <1ms (5x faster)
  • Multi-hop Pathfinding: 20-50ms → <5ms (4-10x faster)
  • Total Pipeline: 85-243ms → <18ms (5-13x faster)

Architecture:

TypeScript (Orchestration)
    ↓ Neon FFI
Rust (Performance-Critical)
    ├── FMD Engine (TPS, TSS, CPMD)
    ├── AMM Math (Uniswap V2/V3/V4)
    └── Tycho Integration (Native Rust SDK)

2. Standalone FMD Physics Crate

We extracted the FMD engine into a standalone Rust crate: fmd-physics.

Modules:

  • market_state.rs - Market state representation
  • profit_potential.rs - Profit potential analysis
  • fmd_engine.rs - CPMD time-stepping
  • tps.rs - Transition Path Sampling (parallel ensembles)
  • transition_state.rs - Transition State Sampling (shooting algorithm)
  • time_series.rs - ARIMAX price prediction

Why standalone?

  • Reusable across projects
  • Easier testing and benchmarking
  • Clear separation of concerns
  • Open-source potential (future)

3. Multi-Chain Execution via Tycho

Tycho Protocol = Chain-abstracted DeFi indexer + execution engine.

What we integrated:

  • Streaming API: Real-time pool state updates
  • ProtocolSim: Accurate swap simulation (REVM-based)
  • TychoRouter: On-chain execution across all chains
  • Native Rust SDK: Zero FFI overhead

Supported Chains:

  • Ethereum (Uniswap V2/V3, Balancer, Curve, Sushiswap)
  • Base (Uniswap V2/V3/V4, Balancer, Aerodrome)
  • Unichain (Uniswap V2/V3/V4)

Key Insight: One codebase, three chains. No infrastructure changes.

4. Progressive Web App (PWA)

Features:

  • Installable on mobile/desktop
  • Offline-capable service worker
  • Real-time WebSocket streaming
  • Dark/light theme support
  • Responsive design

Tech Stack:

  • Next.js 14 (App Router)
  • Tailwind CSS
  • WebSocket (live telemetry)
  • Chart.js (visualizations)

Challenges & Learnings

Challenge 1: Tycho Router Error (0xdeba0f4d)

Problem: Manual TypeScript encoding was buggy. Tycho Router rejected our swaps.

Root Cause: Wrong transfer type (TransferFrom vs TransferFromPermit2).

Solution: Build HTTP service wrapping official Rust encoder (tycho-execution).

Lesson: Use official libraries. Don’t reinvent encoding.

Time to Fix: 45 minutes (after 2 weeks of debugging).

Challenge 2: Performance Bottleneck

Problem: TypeScript FMD detector was too slow for real-time MEV.

Root Cause: Physics calculations (TPS, TSS) are computationally intensive.

Solution: Migrate to Rust with parallel ensemble sampling (Rayon).

Lesson: Choose the right tool for the job. Rust for performance-critical paths.

Result: 12.5x speedup unlocked real-time detection.

Challenge 3: Multi-Chain State Synchronization

Problem: Tracking pool states across 3 chains is complex.

Root Cause: Different block times, reorgs, and state update patterns.

Solution: Tycho streaming API + Redis caching with TTLs.

Lesson: Don’t build your own indexer. Use battle-tested infrastructure.

Result: Real-time state across Ethereum, Base, and Unichain.

Challenge 4: Gas Cost Estimation

Problem: Naive gas estimates led to unprofitable fills.

Root Cause: Didn’t account for all contract interactions in route.

Solution: Fork-based simulation with real gas measurements.

Lesson: Simulate everything. No shortcuts.

Result: Accurate gas costs → profitable fills.


Research & Thought Leadership

We published 22,500 words of research content:

1. Blockchain Thermodynamics (4,700 words)

  • Blockchains as thermodynamic systems
  • Entropy, information, and computation
  • MEV as entropy extraction
  • FMD physics engine deep dive

2. Formal Negentropy Model (3,500 words)

  • Graph diffusion model
  • MEV closure equation
  • Optimal control theory
  • Connection to FMD engine

3. Negative EV Rate (4,500 words)

  • Inefficiency as negative EV per unit time
  • Generation-exploitation dynamics
  • Entropy coupling
  • Real-world validation (350 probes per $0.12 arb)

4. Complex Microstructure (3,800 words)

  • Complex microstructure factor: $Q_C = A_C e^{i\phi_C}$
  • Time-normalized scoring: $S_C = \frac{I_C \cdot \Re{Q_C^*}}{\Delta t}$
  • Phase conjugation
  • Risk-adjusted scoring

5. Research Paper (6,000 words)

  • arXiv-ready academic paper
  • 7 theorems with proofs
  • Numerical validation
  • 19 citations

Impact: Establishing ORKID as a physics-based MEV thought leader.


What’s Next

Short-Term (Next 2 Weeks)

  • 🎯 Scale to production volume
  • 🎯 Optimize gas efficiency
  • 🎯 Expand venue coverage (Bebop, Hashflow, CoW Protocol)
  • 🎯 Improve execution success rate

Medium-Term (Next Month)

  • 🎯 Cross-chain arbitrage (Ethereum ↔ Base ↔ Unichain)
  • 🎯 Intent-based execution (UniswapX, CoW Protocol)
  • 🎯 Advanced routing (multi-hop, cross-protocol)
  • 🎯 Machine learning integration (XGBoost, ARIMAX)

Long-Term (Next Quarter)

  • 🎯 Open-source FMD physics crate
  • 🎯 Academic collaborations (arXiv, conferences)
  • 🎯 Enterprise partnerships (design partners)
  • 🎯 Community-driven development

By the Numbers

MetricValue
Days Building64 days (~9 weeks)
Performance Improvement12.5x (Rust TPS engine)
Chains Supported3 (Ethereum, Base, Unichain)
DEX Protocols8+ (Uniswap, Balancer, Curve, etc.)
Research Content30,800 words
Blog Posts6 published
Code Commits300+
Lines of Rust5,000+
Lines of TypeScript15,000+

Lessons Learned

1. Physics > Heuristics

Treating markets as physical systems yields better predictions than naive price comparisons.

2. Rust for Performance

When milliseconds matter, Rust delivers. 12.5x speedup unlocked real-time MEV detection.

3. Use Official Libraries

Don’t reinvent encoding, indexing, or simulation. Use battle-tested infrastructure (Tycho, Balancer, etc.).

4. Simulate Everything

Fork-based simulation with real gas costs is the only way to ensure profitability.

5. Build in Public

Sharing research and progress attracts talent, partners, and community support.

6. Iterate Fast

From bug discovery to fix deployment in 45 minutes. Speed matters in MEV.


Thank You

To the community: Thank you for following our journey. Your feedback and support keep us building.

To our partners: Tycho, Balancer, Flashbots—your infrastructure makes this possible.

To the team: Late nights, tough bugs, and breakthrough moments. We’re just getting started.


Follow Our Journey

Next post: “Cross-Chain Arbitrage: Ethereum ↔ Base ↔ Unichain”


Open Questions for the Community

We’re building in public and would love your input:

  1. What MEV strategies interest you most? (Arbitrage, liquidations, sandwich, JIT liquidity)
  2. Which chains should we prioritize? (Arbitrum, Optimism, Polygon zkEVM)
  3. What research topics would you like to see? (MEV economics, protocol design, optimal control)
  4. Would you use an open-source FMD physics library?

Drop a comment or reach out! We’re here to learn and build together.


Built by Cadence System · “Physics-based MEV detection and execution.”


Appendix: Technical Architecture

For the curious, here’s our current stack:

Backend

  • Language: TypeScript (Node.js 22) + Rust (performance core)
  • Framework: Express.js (REST API)
  • Database: MongoDB (opportunities, fills, telemetry)
  • Cache: Redis (pool states, routes, pricing)
  • WebSocket: Socket.io (real-time streaming)

Frontend

  • Framework: Next.js 14 (App Router)
  • Styling: Tailwind CSS
  • Charts: Chart.js
  • PWA: Service worker + manifest

Blockchain

  • Execution: Tycho Router (Ethereum, Base, Unichain)
  • Simulation: Tycho ProtocolSim (REVM-based)
  • Flash Loans: Balancer V2/V3
  • RPC: Alchemy (Ethereum, Base)

Performance

  • Rust Crates: fmd-physics, orkid-native
  • FFI: Neon (Rust ↔ TypeScript)
  • Parallelism: Rayon (data-parallel TPS)
  • Optimization: Cargo --release + LTO

DevOps

  • CI/CD: GitHub Actions
  • Deployment: VPS (Ubuntu 22.04)
  • Monitoring: Custom telemetry + logs
  • Testing: Vitest (unit), Hardhat (integration)

That’s 2 months of ORKID. Here’s to the next 2! 🚀

Written by Orkid Labs

← Back to blog

Technical bridge

Move from analysis into a forwardable technical asset

This post is closest to technical review, routing logic, or infrastructure design. The strongest next move is to connect it to the protocol packet, then decide whether the team needs a launch brief or a commercial lane.

Technical packet

Review the Protocol Packet

Use the packet when the team needs a shared view of settlement mechanics, remediation framing, and audit posture before the next internal review.

Open packet →

Operator context

Get the field guide

Move into the field guide if the team needs practical operator framing before deciding on a deeper technical or commercial step.

Get field guide →

Shortlist and fit

Use comparisons or alternatives

When the question is no longer category education but shortlist fit, use the comparison surfaces to support an honest vendor evaluation.

See comparisons →
  • Use Your Mathematics, Son: A Dedication to Jesus Y Cavazos

    Use Your Mathematics, Son: A Dedication to Jesus Y Cavazos

    A personal dedication to my father, Jesus Y Cavazos (1944-2017), and how his wisdom—'use your mathematics, son'—became the foundation of ORKID's philosophy: the choice to serve the ecosystem rather than extract from it.

  • Two Months Building ORKID: A Physics-Based MEV Engine

    Two Months Building ORKID: A Physics-Based MEV Engine

    Celebrating 2 months of building ORKID—a production-ready MEV physics engine. From TypeScript to Rust, from single-chain to multi-chain, from theory to execution. Here's what we built, what we learned, and what's next.

  • Three Weeks In: Shipping Real‑Time MEV Signals With Production Discipline

    Three Weeks In: Shipping Real‑Time MEV Signals With Production Discipline

    A build‑in‑public week focused on signal quality and operational discipline: /pulse live telemetry, version visibility across domains, and mempool physics that mirror on‑chain reality. Tip P90 and sandwich intensity now move with activity.

  • The Thermodynamic Balance of Global Networks: How Information Creation is Paid for by Energy Dissipation

    The Thermodynamic Balance of Global Networks: How Information Creation is Paid for by Energy Dissipation

    A comprehensive exploration of how global networks balance information creation with energy dissipation as nodes proliferate and bandwidth increases. We derive the fundamental relationship between negentropy and information from first principles, examine the thermodynamic constraints that govern network growth, and explore the implications for blockchain systems and distributed computing.

  • The Rust Rail for Settling GovCon Contracts to Cash in Stablecoin

    The Rust Rail for Settling GovCon Contracts to Cash in Stablecoin

    Designing a Rust-based settlement rail to convert Government Contract payouts into stablecoins—architecture, compliance, and security.

  • The Nobel Lineage: How Physics Became ORKID

    The Nobel Lineage: How Physics Became ORKID

    The intellectual lineage from Lord Rayleigh through Ernest Rutherford, Erwin Schrödinger, Linus Pauling, and Martin Karplus to ORKID. How 150 years of physics research became the foundation of modern routing infrastructure.