Understanding MultichainSmartAccount
The MultichainSmartAccount
is a foundational abstraction in the MEE SDK that unifies multiple smart contract accounts across different chains into a single interface. While currently implemented with Biconomy's Nexus account system, it's designed to be compatible with any ERC4337/ERC7579-compliant smart contract account.
Core Concept
Think of MultichainSmartAccount
as a master key that manages a collection of smart contract accounts, one for each chain you operate on. When you create a MultichainSmartAccount:
const mcNexus = await toMultichainNexusAccount({
chains: [polygon, optimism, base],
signer: signer,
});
Behind the scenes, this creates or connects to separate smart contract account instances on each chain, all controlled by the same signer. Each of these accounts follows the ERC4337/ERC7579 standards, which means they can:
- Execute batched transactions
- Pay for gas in any token
- Use advanced validation logic
- Handle complex account recovery scenarios
Chain-Specific Access
You can access chain-specific account instances using the deployment method:
// Get the account instance for Optimism
const optimismAccount = mcNexus.deploymentOn(optimism.id);
// Get the actual account address on Base
const baseAddress = mcNexus.deploymentOn(base.id).address;
This is particularly useful when you need to:
- Get account addresses for specific chains
- Access chain-specific account features
- Verify account deployment status
- Check balances or permissions
Account Abstraction Compatibility
While the current implementation uses Biconomy's Nexus accounts, the MultichainSmartAccount
interface is designed to work with any compliant smart account implementation:
- Biconomy accounts
- Safe accounts
- ZeroDev accounts
- Any ERC4337/ERC7579-compliant implementation
This is achieved through a standardized interface that captures the essential functionality any smart contract account must provide, regardless of its specific implementation.
Future Extensibility
The design anticipates future developments in the account abstraction ecosystem:
- New account implementations can be added without changing the core interface
- Advanced features can be accessed through provider-specific extensions
- Cross-chain operations work consistently regardless of the underlying account type
Common Use Cases
The MultichainSmartAccount
is essential for operations like:
- Managing assets across multiple chains
- Executing coordinated cross-chain transactions
- Maintaining consistent permissions and recovery settings
- Paying gas fees in different tokens on different chains
Integration Example
Here's how it all comes together in a typical cross-chain operation:
// Create account instance
const mcNexus = await toMultichainNexusAccount({
chains: [optimism, base],
signer: signer,
});
// Create a supertransaction using the account
const quote = await supertransaction()
.injectAccount(mcNexus)
.payGasWith("USDC", { on: optimism.id })
.addInstructions(
// The account automatically handles all chain-specific details
await requireErc20Balance({
amount: supplyAmount,
chain: base,
token: xUSDC,
}),
// Operations on any chain using the same account interface
xAAVE.on(base.id).supply({/*...*/})
)
.getQuote(meeService);
The beauty of this abstraction is that it handles all the complexity of managing multiple accounts while presenting a clean, unified interface for cross-chain operations. Whether you're using Biconomy accounts today or plan to switch to a different implementation in the future, your code remains consistent and portable.
MEE Orchestration & Security Model
The Modular Execution Environment (MEE) uses MultichainSmartAccounts to execute developer-defined routes across multiple chains. A key distinction is that all route calculations and optimizations happen locally in the SDK - developers have complete control over how operations are structured and sequenced. The MEE's role is to reliably execute these pre-calculated routes, ensuring proper orchestration of the defined transactions across chains.
When you initiate a supertransaction, you're essentially defining an execution plan:
const quote = await supertransaction()
.injectAccount(mcNexus) // MEE now has access to all your chain accounts
.payGasWith("USDC", { on: optimism.id })
.addInstructions(
// Your custom cross-chain operations defined here
)
.getQuote(meeService);
The critical security aspect is that all of these cross-chain operations are executed with a single signature and validated through an ERC7579 validator module on each chain. This means:
- Each operation inherits the full security guarantees of the underlying blockchain
- Transactions must pass validation rules defined in your smart account
- The execution flow cannot be tampered with or reordered
- The system's security is anchored in the smart contract accounts themselves
For instance, when orchestrating a complex operation:
await requireErc20Balance({
amount: parseUnits("1000", 6),
chain: base,
token: xUSDC,
})
The process works like this:
- The SDK calculates optimal routes and creates an execution plan
- You sign this plan once
- The MEE executes the plan across chains
- Each operation is validated by your account's ERC7579 validator module
- The orchestration ensures operations happen in the correct sequence
The MEE's role is purely operational - it ensures your signed instructions are executed correctly and in sequence. The security comes from:
- On-chain validation through ERC7579 modules
- Smart account signature verification
- Blockchain-level transaction integrity
- Deterministic execution of your pre-defined routes
Developers can implement custom routing logic, optimization strategies, and validation rules. The MEE will faithfully execute these custom implementations while maintaining the security guarantees of the underlying smart accounts and blockchains.
All of this is possible because the MEE can interact with your MultichainSmartAccount on any chain, coordinating actions between different account instances while maintaining security and atomicity guarantees. The single-signature model, combined with ERC7579 validation, ensures that complex cross-chain operations remain as secure as single-chain transactions.