Researcher: Bruno Mazorra

# Summary

This research introduces a method optimally solving cross-blockchain intents. In other words, we provide an algorithm for determining the optimal pathway for executing partially-defined cryptocurrency transactions across multiple blockchains.

This will be used for solvers on MANTIS (Multichain Agnostic Normalized Trust-minimized Intent Settlement). MANTIS is an ecosystem-agnostic intent settlement framework that facilitates settlement of cross-chain user intents.

As a solution, we present a novel algorithm for determining the optimal pathway across multiple blockchains. Our approach introduces intents over asset spaces through utility functions and frames the multi-domain optimal routing as a mixed integer convex optimization problem. The methodology is underscored by modeling relay transaction fees and incorporating the Arrow-Debreu model for frequent batch auctions in multiple domains.

This research makes the following contributions:

- Introducing intents over the space of assets by using utility functions.
- Reducing the multi-domain optimal routing to a mixed integer convex optimization problem. To do so, we modelled relay transaction fees as constant sum market makers (also known as stable pools) using the framework of Angeris et al., 2021.
- Introducing the Arrow-Debreu model to define frequent batch auctions for multiple domains.

As a result of this work, solvers in MANTIS will be able to implement this algorithm to deliver solutions to user intentions that maximize user welfare (which we define as the greatest volume of the intent being cleared).

# Background & Problem Statement

## Background

Core background concepts/definitions are as follows:

**Intents:**

Intents have become a hot topic in DeFi in recent months, though there is no one set definition for this concept. In general, intents are understood to be users’ desires for a given transaction or other outcome. Intents include desired parameters (such as to swap X amount of A token for B token), but leave some room for flexibility (such as where this swap occurs) in the solution that solvers provide.

**MANTIS:**

Through MANTIS, an ecosystem-agnostic intent settlement platform is introduced. A summary of the flow of the MANTIS protocol is below:

- Intent Submission:

- User-Driven Transactions: Users specify their transaction requirements, typically involving an exchange of a certain amount of one cryptocurrency (Token A) for another (Token B).
- Assisted Order Formulation: MANTIS assists in setting up order limits; in the example of exchanging A for B, MANTIS provides suggestions for the exchange amount of Token B. The exchange rate will not be less than the user-defined A/B ratio.
- Confirmation and Blockchain Registration: Users review, confirm, and sign their transaction details for blockchain recording.
- Timeout vs. Price Limits: A balance between price limits and matching times is maintained, with tighter limits possibly leading to longer wait times for order matching.

- Order Execution Observation:

- Status Monitoring: Users can track the status of their orders post-placement.
- Possible Outcomes: Orders may be fully executed, partially filled, canceled, or timed out.
- Handling Partial Fills: Partially filled orders result in users receiving a portion of the requested amount, with the remainder being canceled or expiring based on the order settings.

3a. Single-Chain Execution Scenario:

- Efficient Execution: The platform swiftly matches orders in a single transaction block for prompt fulfillment.
- Batch Auctions: Batch Auctions process multiple orders simultaneously, maximizing the product of exchanged amounts (A * B) for efficient matching.

Order Pricing:

- Dynamic Price Matching: The platform matches orders to achieve optimal trading volume without violating user-set limits.
- Execution at Optimal Prices: Execution occurs at a price that maximizes volume, ensuring efficiency.

3b. Cross-Chain Execution Scenario:

- Multi-Chain Execution: Certain orders are executed using liquidity pools across multiple blockchain networks, involving several blocks and chains.
- Cross-Chain Virtual Machine (CVM) Program: The CVM facilitates these transactions, ensuring efficient multi-chain swaps.
- Monitoring Interface: A detailed interface provides real-time updates for multi-chain transactions.
- Cross-Chain Transfers: This includes straightforward cross-chain transfers.

This flow through MANTIS is demonstrated in the architectural diagram below:

## Problem Statement

The problem at hand is ensuring that solvers within this system calculate optimal solution routes, then execute upon these routes for users.

Thus, the research questions are:

- What defines an optimal solution, and how can solutions be scored to determine which is most optimized according to this definition?
- What algorithm can be created to provide such an optimal solution?
- How do we ensure solvers best perform their roles (e.g. slashing, collateral, incentives)?

Additional research should also be done on other components of MANTIS in order to optimize the system overall.

# Plan & Deliverables

Expected outputs/deliverables are as follows:

- An algorithm for optimizing settlement pathways for cross-domain intents

The plan for achieving this output is outlined below:

The first two research questions above are addressed in the present research work. Additional work needs to be done on the third question.

**Present Experiment:**

This experiment defined an initial algorithm for optimizing intent settlement pathways for cross-domain intents.

Specific steps in this experiment were:

- Reducing the multi-domain optimal routing to a mixed integer convex optimization problem. To do so, we modeled relay transaction fees as constant sum market makers (also known as stable pools) using the framework of Angeris et al., 2021.
- Applying the frequent batch auction (FBA) method and Arrow-Debreu Market Model to cross-domain intents and transactions to determine an algorithm for optimal routing
- Applying a utility function, maximality condition, and equilibrium price to finalize a matching algorithm
- Calculating solver collateral requirements
- Creating a mechanism for minimizing IBC transfer costs

We have deployed the resulting algorithm initially for use by solvers in the cross-domain intent settlement framework MANTIS (Multichain Agnostic Normalized Trust-minimized Intent Settlement), demonstrating its utility in practice. Three solvers were successfully able to use this algorithm to match orders along the principle of Coincidence of Wants on the Picasso Cosmos blockchain. Additional expansion and testing of this algorithm is necessary, but this shows practical use of the algorithm.

**Future Experiments:**

There are also a number of other areas for expansion upon this work:

This study, while contributing to the field of cross-domain frequent batch auctions and optimal routing in blockchain networks, acknowledges several areas that require further exploration and improvement:

- Generalization of Frequent Batch Auctions to Multiple Assets: The current approach focuses on two-asset FBAs. Extending this to include multiple assets is essential for having a more efficient exchange and increase the overall welfare.
- Simulations for Optimal Routing: Further research through extensive simulations is necessary to evaluate the efficiency and scalability of the proposed routing algorithm. Such simulations could provide invaluable insights for future enhancements.
- Cross-Domain Atomicity: Achieving atomicity in cross-domain transactions is challenging yet vital for ensuring the reliability of cross-domain optimal routing solutions. Future research should investigate mechanisms to attain this atomicity alongside cross-domain auctions.

These directions for future research are critical for advancing our understanding and capabilities in facilitating efficient, scalable, and secure cross-domain transactions in blockchain networks.

# References

- MANTIS documentation
- MANTIS github repo
- Solver algorithm research paper
- Optimal Routing for Constant Function Market Makers. Angeris et al., 2021

# How to Participate

If you’re a researcher who believes that you would be a good fit to contribute to any of the Composable RFPs, please reach out to Composable’s Lead Research Associate, Sydney Sweck, at sydney@composable.finance. In the email, be sure to include:

- The RFP number(s) you’d like to contribute to
- Your relevant background experience
- How you think you could contribute to the research