Introduction
MNMX is a cross-chain routing engine that uses worst-case optimization to find the optimal path for moving assets between blockchains. It evaluates every possible route and selects the one with the best guaranteed minimum outcome.
Overview
Cross-chain transfers operate in an adversarial environment — slippage, MEV, bridge delays, and liquidity fluctuations all work against you. Choosing the right route is a search problem: enumerate all possible paths, evaluate each under worst-case conditions, and pick the one that maximizes your guaranteed minimum outcome.
MNMX treats cross-chain routing as a constrained search problem. The engine searches across all candidate paths — direct bridges, multi-hop routes through intermediate chains — applies worst-case multipliers to each hop, and selects the route with the highest guaranteed floor. No probability assumptions needed.
How It Works
| Step | Component | Description |
|---|---|---|
| 1 | PathDiscovery | Enumerates all possible routes — direct bridges, multi-hop paths, up to 3 hops across 4 bridges |
| 2 | StateCollector | Fetches real-time conditions — gas prices, bridge liquidity, success rates, congestion levels |
| 3 | SearchEngine | Searches the route tree with alpha-beta pruning, evaluating worst-case outcomes for each path |
| 4 | RouteScorer | Scores each path across 5 dimensions: fees, slippage, speed, reliability, MEV exposure |
| 5 | RouteExecutor | Executes the optimal route hop-by-hop with monitoring and fallback on failure |
Quick Start
1git clone https://github.com/MEMX-labs/mnmx.git2cd mnmx3npm install4npm run build1import { MnmxRouter } from '@mnmx/core';2
3const router = new MnmxRouter({4 strategy: 'minimax',5 slippageTolerance: 0.5,6});7
8const route = await router.findRoute({9 from: { chain: 'ethereum', token: 'USDC', amount: '100000' },10 to: { chain: 'solana', token: 'USDC' },11});12
13console.log(route.path); // Route hops14console.log(route.expectedOutput); // Best-case output15console.log(route.guaranteedMinimum); // Worst-case guaranteed output16console.log(route.estimatedTime); // Expected transfer time17console.log(route.totalFees); // Total fees across all hops18
19const result = await router.execute(route, { signer });Architecture
| Layer | Component | Role |
|---|---|---|
| Engine | engine/ | Core search engine — path enumeration, alpha-beta pruning, route scoring (Rust) |
| SDK | src/ | TypeScript SDK — MnmxRouter, bridge adapters, chain configs, route execution |
| Python | sdk/python/ | Research toolkit — Monte Carlo simulation, batch analysis, CLI |
Why Worst-Case Optimization?
Expected value optimization assumes you know the probability distribution of outcomes. In cross-chain, you don't — bridge delays are bimodal, slippage correlates with volume, MEV is adversarial.
Worst-case optimization makes no probability assumptions. It applies stress multipliers to each hop and selects the path with the highest floor. For a $100K transfer, the difference between the expected-value route and the worst-case-optimal route can be $2,000+.