Understanding Orchestration
In the previous doc, we explored MEE - Biconomy’s infrastructure for one-click blockchain experiences. Now let’s dive into its core feature: Composable Asynchronous Orchestration. Consider a simple DeFi operation: swap tokens, then supply to Aave. Today, you have three bad options:- Two separate transactions → Poor UX, no atomicity
- Guess swap outputs → Failed transactions or lost funds
- Custom smart contracts → Needs Solidity devs, audits, deployments. Can’t be modified once deployed.
What is Orchestration?
Orchestration is a developer primitive that solves fundamental problems in blockchain development. To understand why it matters, let’s first understand what makes blockchain development so painful.The Current Reality
When you build blockchain applications today, you face several harsh realities:- Transactions are isolated - Each transaction knows nothing about the others. You can’t use the output of transaction A as the input for transaction B without writing complex smart contracts.
- Everything is synchronous - Function calls execute immediately or fail. They can’t wait for external events like tokens arriving from a bridge. This makes cross-chain operations nearly impossible without complex infrastructure.
- Amounts must be exact - If you want to swap tokens and then deposit them, you need to know exactly how many tokens you’ll receive from the swap. Guess wrong? Your transaction fails.
- Failures are catastrophic - When step 3 of a 5-step process fails, steps 1 and 2 have already completed. Your users’ funds are now stuck in an intermediate state.
- Every solution requires smart contracts - Want to handle these issues? Write Solidity. Deploy contracts. Pay for audits. Repeat for every chain. Months of work for basic functionality.
Enter Orchestration
Orchestration is an execution layer that makes these problems disappear. Instead of deploying smart contracts to handle complex flows, you write simple scripts that the orchestration layer executes intelligently.Trustless ExecutionOrchestration flows are fully encoded in the
callData
of a batch function call and all execution is enforced onchain.
This makes these scripts fully verifiable.Connect operations like Lego blocks. Each operation can use the exact output from the previous one:
The orchestration layer can wait for things to happen:
- Tokens to arrive from a bridge
- Prices to reach certain levels
- Balances to meet requirements
Instead of guessing values when users sign, operations use real values at execution time:
Operations on the same chain execute atomically (all or nothing). Cross-chain operations handle partial failures gracefully, with automatic cleanup ensuring funds return to users. 5. Universal Accessibility
Write in TypeScript/JavaScript instead of Solidity. Any web developer can now build sophisticated DeFi applications without learning blockchain-specific languages.
What This Means Practically
Orchestration transforms impossible or extremely difficult tasks into simple ones:- “Swap and deposit exactly what I receive” - Trivial with orchestration, nightmare without it
- “Wait for my bridge to complete then continue” - Built-in functionality vs months of infrastructure work
- “If anything fails, return funds to user” - Automatic vs complex recovery contracts
- “Let users pay gas with any token” - Native support for 1000+ tokens including LP tokens
The Problem
ResultEither have failures, two user signatures or overestimate and leave dust
The Smart Contract “Solution”
Before orchestration, you’d write something like this:ResultRequires Solidity developer, audits and deployments on every chain. Can’t be easily updated.
The Orchestration Solution
Result10 minutes of development + $0 audits + instant updates
- No smart contracts needed
- No guessing swap outputs
- No dust left behind
- Any JavaScript developer can build this
Cross-Chain Orchestration: Where It Gets Interesting
Now let’s tackle something that makes developers cry: cross-chain operations.The Async Bridge Challenge
Traditional onchain execution is fully syncronous. Users signs a transcation, it gets posted onchain and executed immediately. Real world development is asynchronous. Often times, you need to wait for funds to arrive from a bridge, for an oracle to update or for some other onchain state to change. Until now, building these flows was either impossible or extremely time consuming and requiring deep Solidity knowledge. Orchestration makes it quick, easy and accessible to TypeScript developers.How Async Execution Actually Works
Here’s the clever bit - MEE doesn’t use event listeners or callbacks. Instead, it uses simulation-based waiting:- MEE simulates the swap transaction
- Simulation fails (no USDC on Base yet)
- MEE waits and retries periodically
- Bridge completes, funds arrive
- Simulation succeeds, transaction executes
The Critical Role of Constraints
Thoseconstraints
parameters aren’t just safety checks - they’re what makes async execution possible.
Constraints create the “wait until ready” behavior that enables true asynchronous orchestration.
Intelligent Failure Handling
Not all failures are created equal. Orchestration understands the difference between atomic operations and cross-chain flows.Single-Chain: All or Nothing
Operations on the same chain execute atomically:Cross-Chain: Graceful Recovery
When operations span chains, orchestration handles partial completion:Automatic Cleanup: Your Safety Net
Every orchestration can include cleanup instructions that act as a safety net:- Uses nonce-based dependencies to execute after main operations
- Detects remaining balances automatically
- Only executes if balance ≥ 1 wei (prevents empty transactions)
- Supports multiple tokens with separate cleanup operations