The Convergence of Ai, DeFi and Intents with Aperture Finance
Exploring how Aperture Finance converges AI, DeFi and intents to optimize on the shortcomings of crypto UX today.
Introduction
The growth in the digital asset space is on an exponential curve, propelled by a confluence of factors, including worsening traditional financial situations around the world and remarkable innovations such as artificial intelligence (AI) and new decentralized coordination methods. As users increasingly seek more financial flexibility, these trends present unique opportunities to leverage emerging technology to fulfill these needs.
Over the last year, "intents" — user expressions for a desired goal — have sparked a wave of innovations across networks and applications, simplifying complex tasks such as trades and other on-chain actions. Intents abstract away the intricacies involved in on-chain operations, making decentralized finance (DeFi) more accessible to a wider audience.
The meteoric rise in adoption of technologies like ChatGPT, a powerful large language model, adds a new tool for user complexity abstraction. These advancements offer revitalizing opportunities for protocols to couple user intents with LLMs like GPT, enhancing the user experience through natural language processing and contextual understanding. At the intersection of these technologies lies a unique opportunity to transform DeFi user experience (UX) as we know it today.
State of DeFi UX Today
User Experience: Web3’s Achilles Heel
The rapid development of technology over the past several decades has brought about unprecedented shifts in efficiency and performance in people’s everyday lives. In today’s increasingly consumer-centric world, user experience can make or break a business. Prioritizing user experience is therefore crucial for the long-term success of businesses across virtually all domains today. A seamless and pleasant user experience not only attracts users but retains them over time. These are the kind of products and services people enjoy using because of their design and interaction elements, regardless of their essential function. On the other hand, a poor user experience will inevitably steer users away to a similar product or service which functions more efficiently.
Decentralized finance (DeFi) applications have failed to gain traction outside of a relatively concentrated portion of crypto-native users, primarily due to a long history of poor user experience. DeFi imposes a myriad of security and financial risks, with unsuspecting retail users often bearing the brunt of these consequences. Today, a single misstep when conducting transactions on-chain can lead to unexpected financial losses. One of the common security issues arises from users inadvertently clicking on fraudulent links or falling victim to phishing scams. These malicious attacks trick individuals into connecting their wallets to harmful programs while performing routine tasks like claiming an eligible airdrop.
Conversely, many of the financial risks in DeFi are often obfuscated by technical complexities which are poorly communicated to users, emerging during activities such as rebalancing weighted portfolios or a position in a liquidity pool. Sophisticated entities engage in value extraction tactics like frontrunning or sandwich attacks to exploit trades, resulting in poor execution outcomes for end-users. Additionally, transacting across various blockchains using third-party bridges introduces another layer of risk; with reported hacks causing over $2.8 billion worth of stolen assets highlighting this vulnerability issue within DeFi systems.
The rise of LLMs like Chat-GPT have introduced new consumer-facing solutions to help automate many tedious and complex tasks, from making grocery lists to lecture plans for teachers. This technology ultimately stands to improve many quality-of-life aspects of people’s everyday lives. Therefore, considering the poor state of DeFi UX today, we ask - why should navigating DeFi be any different from typing a prompt into chatGPT?
It’s The Intent That Counts
To formally define an intent;
“Signed messages which allow for a set of state transitions from a given starting state, a special case of which is a transaction which allows for a unique transition.” - Paradigm
An intent is an abstract operation description of a user’s desired outcome from an on-chain interaction, i.e., the execution of a transaction which purchases asset X at price Y, which delegates the execution to smart contracts or third parties for enhanced user experience.
An intent goes beyond a mere transaction request, however; it's a holistic representation of the user's desired outcome on the blockchain. It comprises 4 key facets:
Domain: Where the intent executes.
Objective: The user's articulated goal.
Constraints: Conditions for successful execution.
Preferences: User-specified priorities or processing options.
Are all intents equal?
The short answer is no.
For starters, protocols may choose to implement different types of intents using different methods. Our previous article, MEV Protection: DEX & Aggregator Anti-MEV Mechanisms outlines how DEX aggregators like CoW Swap and 1inch might lead users to the same outcome, that is to swap token A -> token B, though they use different algorithms and intent-based models to perform the desired action.
Intents can be very app-specific, i.e. an application which restricts intents to perform a specific function, such as performing a DEX swap, or they can be more generalized in which they serve as a framework for building applications on top of. They can be constrained to a specific domain which they are specialized in, or they can function across multiple domains to capture a larger base of users.
The Intents Infrastructure Landscape Today
Anoma
Anoma Network is building the “universal intent machine on Ethereum”, to proliferate the development of intent-centric applications. Key to Anoma’s composability is that intents and applications written with Anoma can be ordered, solved, and settled anywhere - on Ethereum, on EVM and non-EVM rollups, on Eigenlayer AVSs, on Cosmos chains, Solana, and any sufficiently programmable state machine.
Users express intents, which must be created by the user interfaces, understood by intent gossip nodes, matched by Solvers, and validated by the application’s validity predicates.
Solver algorithms instruct a solver how to match an application’s intents and form valid transactions. Anoma user interfaces present a graphical or textual view of and controller for the application in question.
Suave (Single Unifying Auction for Value Expression)
Flashbots is building SUAVE, a modular blockchain network which offers an easily-adaptable mempool and decentralized block builder for any blockchain. Its key value proposition lies in the separation of the mempool and block builder roles from existing chains to offer a highly specialized plug-and-play alternative.
At the core of SUAVE are intents, or ‘preferences’, which are the native transaction type on SUAVE. They can either contain a payload instructing a specific blockchain to be executed on, or instead leave the optimal routing to the Solvers, referred to as ‘executors’. Once a user has submitted their intent, it is passed to the Execution Market, in which executors compete in an auction to provide users with the best execution possible. Finally, a decentralized block building network gathers the collected preferences and turns them into blocks across all supported blockchains. The decentralized block-building market maximizes MEV for builders and validators while allowing the builder itself to become decentralized.
Essential
Essential is building the first declarative blockchain, that is, a blockchain which leverages constraints to achieve state updates without the need for execution. At a high level, Essential is an intent-centric layer-2 blockchain, deployed as an optimistic rollup on Ethereum. Optimizing for state updates without execution means that no state transition may be included if it does not satisfy the user’s intent. In other words, users get what they want or they get nothing at all. This approach aims to bypass a common bottleneck in today’s blockchains which leads to various performance issues and irregular spikes in transaction costs.
User intents submitted to the Essential network declaratively outline a set of variables, as well as constraints on those variables, narrowing down the set of feasible execution routes. Users can also specify an objective utility function to represent their preferences and preference ordering. Solvers then attempt to maximize the user’s request with respect to their objective function.
Tradeoffs with Intents Today
Trust Assumptions for Solvers
Users cannot choose where the intents settle themselves. This means intents may be settled on any blockchain or even a centralized server. Solvers are in charge of executing the intents of the user, a key design in abstracting away friction in the user experience. However, this delegation of execution rights adds a new layer of trust assumptions in the overall process, wherein the user must now trust that the Solvers is acting in their best interest, though Solvers may choose to utilize off-chain resources (i.e personal inventory held on a CEX) which reduce the overall transparency of the protocol. More broadly, this has raised questions about the necessity of these new layers, a common criticism being that introducing new middlemen only hurts the user over time, whether due to additional incurred service fees, malintent on Solvers’ behalf (i.e. colluding with block builders for MEV operations), and the centralization forces which may arise due to restrictive barriers to entry for running Solvers.
Does DeFi really need more middlemen? (c/o Orderflow.art)
That said, though Solvers are often centralized entities today, i.e. market maker firms, the emergence of decentralized models such as PropellerSolver presents a compelling opportunity moving forward. PropellerSolver itself is an advanced network of swap Solvers – across EVM and non-EVM chains - which accesses a wide network of liquidity sources, including market makers and protocol-native paths, to secure competitive prices for trades across EVM and non-EVM chains. It uses a custom routing algorithm and gas-optimized contracts to find the most optimal liquidity routes on users’ behalf, and uses private transaction routing to offer MEV-protection for users.
Single-Use Functionality
Another key limitation which arises is that intents are still constrained in their functions, as they are designed to be executed at a single point in time. This poses a challenge to the efficient fulfillment of various on-chain operations, such as managing an LP position over a specific period of time, or executing a trade without losing money due to being front run or sandwiched.
Merging AI and Intents
AI presents a unique application for streamlining end users' intents. By leveraging intents, protocols can handle multistep intent criteria and fill input requirements using a chatbox interface. This means that users can explain their desires in plain language, and the flexible interface can capture multistep intents and process them to Solvers. The more complex an intent-based application or protocol is, the more time it may take to fulfill the minimum requirements to execute the intent. In theory, the process of intent declaration can be fluid, while the nuances and specifications are worked out using machine learning data, which are then passed on to the Solver. Intents in other spoken languages are trivial, as machine learning can properly translate the desired outcome to Solvers.
Intent Data Collection and Refining Intents
Possible intent outcomes are generally constrained by UX limitations created by the protocol, where the user can perform only designated operations. If a specified intent outcome does not exist, protocols may leverage LLM input data to refine the intent path at a later date, essentially creating a product feedback loop. Similar to how LLM models train and improve based on inputs, intent data can be used to refine users' intents.
For example, let's say a DEX uses intent-based swaps leveraging a chatbot. The LLM operator notices an increased number of exotic requests to open a long position on a perps DEX after a swap. This request data can be used to iterate on the intent paths and prompting to improve the UX.
Case Study: Aperture Finance
Aperture Finance is a DeFi protocol offering liquidity management services, which aims to transform the state of DeFi UX by building an intent based protocol with a GPT-like chatbox UX, enabling users to state their goals in natural language. A network of third-party participants, called Solvers, will then execute requests on behalf of users. Solvers are in charge of optimizing the process, allowing the intent/request to be processed efficiently and at a low cost. Aperture acts as a general-purpose DeFi protocol with a range of practical applications.
Aperture’s Architecture
From a technical perspective, Aperture is building a novel Layer 2 that accommodates intents on both Ethereum Virtual Machine (EVM) and non-EVM chains by taking advantage of the latest advances in LLMs.
There are four key actors in Aperture’s architecture:
Orchestrator: The orchestrator efficiently disseminates and processes user intents. This includes the intent mempool, the blockchain storage layer, and the execution environment where the smart contracts derived from user intents are executed.
Solver: The Solver provides solutions in exchange for economic incentives from the intent poster. Solvers handle the system's complexity. They can be public and transparent Solvers, processing standard intents in a transparent manner suitable for general transactions. Alternatively, they could be privileged Solvers, handling privacy-sensitive intents with special trust credentials.
Sequencer: Sequencers are tasked with ordering and processing intents on Aperture’s L2 chain. Then compressing the processed intents and transactions and pushing them to the designated Layer 1.
Fulfiller: The fulfiller is responsible for pushing the solutions devised by Solvers to the target chain and monitoring their execution status. Their role is to ensure that the Solver properly solves intents.
Intent Lifecycle on Aperture
The flow of an intent on Aperture, from the end-user to the designated blockchain starts with users defining their intents and submitting them for processing by solvers. The intents are then processed with privacy mechanisms like zero-knowledge proofs, verified with trust scoring and ZKPs, and finally fulfilled with oversight from the Fulfiller to ensure secure and reliable transaction execution.
Intent Definition - The user defines their intent, including the domain, objective, constraints, and preferences for the desired outcome within the blockchain environment, i.e. ‘Buy 10 ETH at a price of $3000 per token on Arbitrum’.
Intent Submission - The intents are submitted to a network of Solvers, responsible for processing and fulfillment of the intents. The Solver then submits the intent, solution, and corresponding proof to the Intent Mempool for storage.
Intent Processing - Intents in the Intent Mempool are then processed via ZK-Processor to ensure privacy and security are maintained, and that user intents are executed faithfully and in alignment with predefined end-state criteria.
Solution Verification - The ZK Processor then generates Zero-Knowledge Proofs (ZKPs) for historical on-chain data to validate Solvers' outputs without revealing confidential data. This is later used as input for Aperture’s Dynamic Trust Scoring methodology, which assigns trust scores to Solvers based on historical performance and adherence to network protocols.
Solution Fulfillment - The Fulfiller is then responsible for pushing the solutions devised by intent Solvers to the target chain and monitoring their execution status, enforcing accountability and penalizing any malicious behavior.
The Aperture Intents DSL
Key to Aperture’s value proposition is the ability for users to articulate their transactional goals and preferences with greater ease. Modern LLMs utilize natural language processing to interpret user prompts and emit an appropriate output based on its training data. Given that imperative blockchain architectures do not natively support the processing of intents, the need for interpretive solutions arises.
Aperture utilizes a proprietary intents-centric programming language, the Intents DSL, to enhance the expressibility of user Intents. A Domain Specific Language, or DSL, refers to a programming language specialized to a particular application domain, tailored to fulfill specific tasks. Common examples include SQL, HTML, CSS, to name a few. The purpose of these specialized languages is to enable the expression of logic within a specific domain in a more efficient manner than existing solutions, thereby enhancing the overall developer experience, and consequently the user experience of the applications built on top of said DSL.
Aperture’s Intents DSL enables users to express their intent using natural language, which gets then interpreted and processed into logic which expresses the fulfillment of that intent as an event on the blockchain. The Intent Interface, the chatbot-like frontend through which the user interacts, facilitates the entire process to 1) translate and mirror the intent back to user to be verified, and 2) interpret and deliver the intent as a valid expression of onchain logic to the Intent Clearing House, the following layer involved in the fulfillment of an intent.
To further illustrate this concept, consider an example of what a user ‘conversation’ may look like;
User Input - “Rebalance my ETH-USDC positions on Arbitrum and Base so that ¾ of my funds are in the top-performing pools and the remaining ¼ are distributed evenly across any other pools.”
UI - “Sure, here are the details of your request:
Eligible Assets: ETH-GMX pairs on Mainnet, Arbitrum, and Avalanche
Permitted Actions: Bridge, Remove liquidity, Swap ETH or GMX, Add Liquidity
Primary Objective: Reallocate 80% of eligible asset capital to the pool with the highest spot APR according to data from APY Vision.
Secondary Objective: Distribute the remaining 20% of eligible asset capital evenly across the other pools not included in the primary objective.
Confirmation: Sign Intent declaration if correct.”
At this point, the user confirms the DSL interpretation is valid by signing the intent to be submitted to the clearing house.
Intents Clearing House
Functioning similarly to the public mempool on Ethereum, the Intents Clearing House serves as a waiting room for intents. This stage is responsible for organizing these intents to be processed and fulfilled on the designated blockchain, ranking intents and their corresponding solutions by quality of execution on user’s behalf, as well as accounting for any additional conditional requirements, i.e. time-sensitive orders. The fulfillment of user intents is enforced onchain through the use of Verification Smart Contracts, wherein each type of intent use case will require a smart contract to simulate, verify, and police the proposed solution.
The Use of ZKPs in The Aperture Protocol
Through a partnership with Brevis, a novel ZK coprocessor, Aperture introduces an autonomous, intent-centric framework that allows users to specify intentions over an extended period, reacting to specific conditions, addressing a common limitation discussed earlier, wherein user intents can only be expressed at a single point in time. For instance, with Brevis, users can set an instruction to rebalance an ETH-USDC Uniswap V3 position when there is 15% price movement, continuing until they decide to stop.
Maintaining Solver Integrity
In addition to extending the functionality of intents, Zero-Knowledge Proofs (ZKPs) are also employed to enforce protocol standards. Aperture maintains the integrity of its Solvers by employing a dynamic trust scoring system to evaluate Solvers based on their historical performance and accuracy. This is enabled through the use of the Brevis ZK coprocessor, which enables smart contracts to access and use full historical on-chain data from any blockchain to validate the accuracy of solutions without exposing private data.
Use Cases & Applications
Data from Aperture’s Intents dashboard indicate that the protocol has handled over $2.3b in Intents volume, spanning across over 2.7m intents in total. Looking closer by intent type, the most common intents today revolve around rebalancing, that is, redistributing assets in a liquidity pool to optimize performance which can be based on predefined criteria, and reinvesting, or reallocating any earned fees or rewards back into the liquidity pool to maximize returns.
Automated Liquidity Management
First, consider Liquidity Managers or Automated Liquidity Managers (ALM). That is, protocols that actively manage liquidity pool positions on users’ behalf. Concentrated liquidity market makers (CLMMs) like Uniswap V3 offer extensive flexibility in liquidity provision but are more complex for users, increasing Impermanent Loss (IL) risk when providing liquidity within narrow price ranges. Aperture has already built out a suite of liquidity management tools, offering automated position rebalancing, automated position closure based on pricing, pool ratio, and time and auto-compounding of fees. For instance, in an ETH/USDC pool, the LP position could be rebalanced with every 5% price movement to minimize IL. After 3 months, the strategy can be exited by swapping all capital to USDC.
With the advent of Aperture’s AI-powered intents, users can express how they would like to customize and set up their LP position strategy using natural language, mitigating risks around performance after implementation. Today, the Total Value Locked (TVL) on ALMs on all different chains is $584m, presenting a compelling opportunity to enhance the performance of a service which has been proven its product-market fit in the broader DeFi landscape, using AI-powered intents.
Claiming an Eligible Airdrop
Airdrops enable blockchain protocols to distribute their native tokens to addresses which have met required criteria, typically aligning with the interests of community members and early adopters. However, a common issue which arises during these events is an abundance of malicious links which get sent around by actors impersonating team or team member accounts, targeting unsuspecting users to connect their wallets to then be drained.
Aperture’s intent-centric architecture enables users to avoid these risks while easily expressing their request through natural language. To further illustrate, let’s consider a user who wishes to claim all of their eligible airdrops across several different chains they have been proactively using. To start, they would type “Claim all eligible airdrops on my behalf across Arbitrum, Base, and Optimism” into the Aperture chatbot-UX, which processes and submits the request to be fulfilled by the Solver network. Any Solver which comes across the request can now view the user’s provided wallet address and cross-reference it with any claimable airdrops or rewards that are eligible for said address, ensuring that only the appropriate links and contract addresses are accessed. The proposed solutions would then be simulated by Aperture’s smart contract to verify the proposed outcome, and subsequently all verified solutions would be ranked and executed on the user’s behalf. Users receive the tokens they are eligible for in their designated wallet, without needing to stress about the verification of links and social media profiles.
MEV-Protection
Maximal Extracted Value (MEV) is captured by validators within a network through reorganizing transactions in a new block, including or excluding them during block production. MEV capture comes in the form of CDP-position liquidations or arbitrage, though the former occurs much more frequently.
A particularly common malicious arbitrage strategy is sandwiching. In this scenario, a sophisticated entity may observe a significant token purchase waiting to be executed as a pending transaction in the public mempool. Using specialized software known as a MEV-bot, they can then place a buy order to be executed before that large order and a sell order immediately after, ensuring priority block inclusion by paying a higher validator tip. By doing so, the MEV-bot is effectively engaging in both frontrunning and backrunning, respectively, of the transaction.
Roughly 5% to 10% of all DEX volumes are sandwiched on the Ethereum mainnet, according to Hildobby from DragonFly Ventures.
Just in the past 7 days, $41 billion was traded on DeFi (DeFiLlama).
Since solvers are sophisticated actors, we expect them to implement MEV protection tools such as private transaction routing, order batching, and the utilization of off-chain capital to ensure users receive the lowest competitive price on their desired trade.
Future Outlook - AI Enhances DeFi UX
As digital asset adoption continues to soar, driven by global economic shifts, AI holds the promise to refine user intents continuously while also guiding users in formulating better, more precise intents. The integration of AI with user intents allows for significant UX improvements and valuable data collection, further optimizing DeFi protocols. In the future, crypto could be abstracted down to a seamless, user-friendly interface where the desired fulfillment of outcomes is expressed in natural language, simplifying complex transaction operations which are delegated to be executed by a competitive network of Solvers whose integrity is maintained through cryptographic measures.
Aperture’s Role
While there are a number of exciting projects focused on blockchain networks and AI, few protocols lie at the intersection of AI, user-centric intents, and core DeFi primitives. Aperture aims to play a critical role in reshaping the future of user experiences onchain, by leveraging a myriad of evolving technical developments centered around efficiency and security. By utilizing a proprietary DSL, Aperture enables users to write intents using natural language, greatly simplifying the expression of these requests. By delegating the complexity of execution to Solvers, Aperture ensures that users can interact with DeFi protocols safely and effectively, fulfilling their requests exactly as they envision. By leveraging ZKPs, Aperture ensures that the Solvers responsible for executing user intents are acting in good faith and being appropriately rewarded for their services.
Wrapping up
As nascent as DeFi is, it's very clear it is here to stay as new technology is injected into the ecosystem. Not only does it improve operations for sophisticated actors but we can see the potential for these technologies to create a more accessible, user-friendly, and secure DeFi environment for even beginner and retail users.
References
DeFiLlama. (n.d.). DEXs. Retrieved from https://defillama.com/dexs
DeFiLlama. (n.d.). Liquidity Manager Protocols. Retrieved from https://defillama.com/protocols/Liquidity%20manager
Propellerheads. (n.d.). PropellerSolver: Introduction. Retrieved from https://docs.propellerheads.xyz/propellerheads-docs/introduction/propellersolver
Hildobby. (n.d.). Sandwiches. Retrieved from https://dune.com/hildobby/sandwiches
Aperture Finance. (2023, February 7). The Intentional Campaign #7. Medium. Retrieved from https://medium.com/@aperturefinance/the-intentional-campaign-7-3307e91af884
Delphi Digital. (2023). WTF is Anoma Part 1: WTF are Intents. Retrieved from https://members.delphidigital.io/reports/wtf-is-anoma-part-1-wtf-are-intents
Delphi Digital. (2023). WTF is Anoma Part 2: WTF are Intent-Based Apps. Retrieved from https://members.delphidigital.io/reports/wtf-is-anoma-part-2-wtf-are-intent-based-apps#centralized--fragmented-counterparty-discovery-d2ff
Orderflow. (n.d.). Orderflow. Retrieved from
https://orderflow.art/?isOrderflow=true
Perridon Ventures. (n.d.). Redefining Blockchain Interactions: The Crucial Role of Solvers in an Intent-Focused Future. Retrieved from https://perridonventures.xyz/publications/redefining-blockchain-interactions-the-crucial-role-of-solvers-in-an-Intent-focussed-future
PossiblyResult. (2023, October 7). Tweet. Twitter. Retrieved from
https://twitter.com/PossibltyResult/status/1709742006388306115
Not financial or tax advice. The purpose of this newsletter is purely educational and should not be considered as investment advice, legal advice, a request to buy or sell any assets, or a suggestion to make any financial decisions. It is not a substitute for tax advice. Please consult with your accountant and conduct your own research.
Disclosures. All posts are the author's own, not the views of their employer. This post has been sponsored by Aperture Finance. While Shoal Research has received funding for this initiative, sponsors do not influence the analytical content. At Shoal Research, we aim to ensure all content is objective and independent. Our internal review processes uphold the highest standards of integrity, and all potential conflicts of interest are disclosed and rigorously managed to maintain the credibility and impartiality of our research.
I think this is reflective of a general idea that declarative domain specific languages are incredibly powerful but their UX had up to this point been restrictive. With AI you can largely train it to understand and translate from natural language to any DSL.
Intents are a great example and echoes changes in other domains, e.g., writing statically typed languages (like Rust) is easier now because of Copilot, writing JQL in JIRA is easier because of ChatGPT (I just used that today), writing Dune queries in SQL is easier too.