Rob Behnke
October 7th, 2024
Artificial intelligence (AI) has grown in leaps and bounds in the last few years. Before the public release of ChatGPT, AI usage was limited. Today, AI is a household name, most companies are exploring how it can be integrated into their businesses, and it has become the new buzzword for investors.
This surge in AI growth comes at the same time that decentralized finance (DeFi) has matured and gained more widespread interest and adoption. While this is a coincidence, AI also offers numerous potential benefits and use cases to support DeFi.
AI is still in its early days, and many companies are still figuring out good use cases for it to be applied to familiar problems and technologies. The relative novelty of DeFi means that exploration of its applications in the space has been limited. However, this doesn’t mean that there are no ways that AI can enhance and complement DeFi systems.
While getting a smart contract audit before code release is best practice, not every project does so. As a result, many DeFi projects have suffered high-profile and damaging hacks due to avoidable and preventable vulnerabilities.
While generative AI (GenAI) systems aren’t as effective as a trained security analyst, they do have the ability to identify some smart contract vulnerabilities. Here at Halborn, we explored these use cases in a July 2023 report applying ChatGPT to the detection of various smart contract vulnerabilities. As GenAI tools become more advanced and specialized in coding, they have the potential to offer DeFi projects a means of identifying and fixing vulnerabilities before they are launched.
Beyond the security side of things, DeFi can also enhance smart contract development. On Ethereum and many other smart contract platforms, every instruction included in a smart contract increases the cost of running it. AI can help to optimize smart contract code, reducing its footprint on-chain and the cost to users.
Some of the main challenges that DeFi protocols face are managing liquidity and protecting against price slippage. If a protocol lacks sufficient liquidity or experiences significant slippage, it might be vulnerable to exploitation by an attacker.
While many protocols have algorithms in place to address these issues, AI has the potential to improve and further optimize these operations. Taking advantage of these can help to ensure that assets are appropriately allocated and that slippage in liquidity pools is minimized.
One of the core features of many blockchains is that it provides a level of pseudonymity to its users. Blockchain accounts aren’t directly linked to real-world identities. However, while this is good for privacy, it also makes blockchain solutions prone to abuse for criminal activities and lowers the perceived risk of attacking DeFi protocols.
However, the blockchain doesn’t provide total anonymity, and analysis of transaction patterns on the blockchain can provide clues to users’ identity and help to detect fraudulent transactions. AI systems have the potential to analyze blockchain data and identify potential attacks and fraudulent activities in real time, enabling DeFi projects to respond more quickly and effectively to protect themselves and their users against potential losses.
In the DeFi space, many people make their money by identifying and taking advantage of favorable opportunities in the market. This could be identifying good yield farming opportunities, taking advantage of slippage in an arbitrage transaction, or making favorable investments in tokens that see an increase in value.
All of these various actions require an understanding of market conditions and the ability to act quickly before an opportunity closes or someone else beats you to it. AI tools have the potential to enhance and optimize these operations as AI-powered bots automatically identify opportunities and make transactions to take advantage of them.
For example, AI tools may be used to predict market trends and invest in a particular token that is likely to rise in value or monitor a project’s liquidity and pricing to search for arbitrage opportunities.
DeFi is a relatively young and evolving space, and many potential users and customers have limited knowledge, experience, and comfort with blockchain technology. This is one of the reasons why spot ETFs were so popular and successful. While anyone can buy and hold their own Bitcoin or Ether with no fees attached, accessing crypto through an ETF provided a level of familiarity and convenience that users were willing to pay money for.
In addition to the novelty of the technology, the DeFi space is rapidly shifting as new projects are created. In many cases, a potential customer may not know what they are looking for or which of several similar projects is the right fit for them.
AI offers the ability to help users select the right project for them and for projects to offer customized user experiences. Based on an understanding of the user and their needs, the system can provide tailored recommendations and potentially even personalize user interfaces to meet the user’s preferences.
Many companies are still in the early stages of identifying real-world use cases for AI. The technology is still very new, and companies are still working through the logistical and regulatory challenges of collecting and using the right data in the right way to solve a particular problem.
However, while AI usage today is limited, it will likely only grow as we figure out what tasks AI is well-suited for and how best to apply it. Additionally, improvements in the underlying technology will mean that AI will become more reliable and capable over time.
In the DeFi space, this has the potential to dramatically change how on-chain systems work, offering potential optimizations and feature enhancements for protocols and users alike. At the same time, it’s also important to consider the security implications of using AI for DeFi. AI is a complex technology, the security implications of which are not fully understood. While AI may enhance security in some ways, it also expands the digital attack surface and may introduce new vulnerabilities for attackers to exploit.