Docs

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

StepComponentDescription
1PathDiscoveryEnumerates all possible routes — direct bridges, multi-hop paths, up to 3 hops across 4 bridges
2StateCollectorFetches real-time conditions — gas prices, bridge liquidity, success rates, congestion levels
3SearchEngineSearches the route tree with alpha-beta pruning, evaluating worst-case outcomes for each path
4RouteScorerScores each path across 5 dimensions: fees, slippage, speed, reliability, MEV exposure
5RouteExecutorExecutes the optimal route hop-by-hop with monitoring and fallback on failure

Quick Start

bash
1git clone https://github.com/MEMX-labs/mnmx.git
2cd mnmx
3npm install
4npm run build
typescript
1import { 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 hops
14console.log(route.expectedOutput); // Best-case output
15console.log(route.guaranteedMinimum); // Worst-case guaranteed output
16console.log(route.estimatedTime); // Expected transfer time
17console.log(route.totalFees); // Total fees across all hops
18
19const result = await router.execute(route, { signer });

Architecture

PathDiscovery
StateCollector
SearchEngine
RouteExecutor
LayerComponentRole
Engineengine/Core search engine — path enumeration, alpha-beta pruning, route scoring (Rust)
SDKsrc/TypeScript SDK — MnmxRouter, bridge adapters, chain configs, route execution
Pythonsdk/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+.

Learn More