IOSG Ventures: Explore the New Possibilities of LLM to Unlock Blockchain Interactions
Original author: Yiping, IOSG Ventures
Welcome to the second article in our large language model (LLM) and blockchain research series. In the previous article, we discussed how to integrate LLM with blockchain technology from a technical perspective, and why the LLM framework is very suitable for the blockchain field. We also outline potential paths for integrating LLM with blockchain in the future.
In this article, we’ll take a more hands-on approach and dive into eight specific application areas that we believe will dramatically change the blockchain user experience. Even more exciting, we predict that these breakthrough applications will become a reality within the next year.
Join us as we uncover the future of blockchain interaction. Heres a brief overview of the eight apps well be discussing:
1. Integrating built-in AI/LLM capabilities into the blockchain
2. Use LLM to analyze transaction records
3. Use LLM to enhance security
4. Write code using LLM
5. Use LLM to read code
6. Assist the community with LLM
7. Implement LLM to track the market
8. Apply LLM to analyze projects
Incorporate built-in AI/LLM capabilities into the blockchain
Blockchain will have artificial intelligence capabilities and models built into it. Developers can access AI functions to perform signature ML tasks such as classification, regression, text completion, and AIGC on-chain. Developers can call these artificial intelligence functions through smart contracts.

With these built-in features, developers can give intelligence and autonomy to their smart contracts. Classification, regression, and AIGC are typical AI tasks. Lets see the application of these functions in the blockchain field and a few example projects.
Classification
Classification can be used to determine whether an address is a bot or a real person. This could change the current NFT sales landscape. Classification can also improve the security of the DeFi ecosystem. DeFi smart contracts can filter malicious transactions and prevent the loss of funds.
Regression
Regression analysis can be used for forecasting, applied to fund and asset management. Numer.ai already uses artificial intelligence to help them manage their money. Numer provides high-quality stock market data on which data scientists work and apply machine learning to predict the stock market.
AIGC
Many NFT projects are trying to build an IP universe. However, their limited content cannot support a universe. If we can use AIGC on the chain, we can output countless content with a similar iconic brand style at a relatively low cost. Models can output text, illustrations, music, sounds and even videos. This greatly expands the size of the IP universe. Community participants can work together to fine-tune the model to meet their expectations. The fine-tuning process also gives the community a sense of involvement.
Botto uses the AIGC model to generate artistic content. The community votes on their favorite images to collectively fine-tune the AIGC model.

If we think of blockchain as a database, we also find that Databend integrates built-in artificial intelligence capabilities into their database. They provide the following features:
ai_embedding_vector: Generate embedding vectors for text documents.
ai_text_completion: Generate text completion based on the given prompt.
cosine_distance: Calculates the cosine distance between two embedding vectors.
ai_to_sql: Convert natural language instructions into SQL queries.
Provide AI capabilities for blockchain
We know that some projects are providing AI capabilities to the blockchain.
Giza is working on ZKML. It generates proofs of reasoning off-chain and verifies them on-chain. It now supports Ethereum Virtual Machine-compatible blockchains as well as StarkNet. Giza recently announced a partnership with Yearn.finance, which will see Yearn leverage Gizas artificial intelligence capabilities to enhance its risk assessment capabilities.

Modulus Labs is also working in a similar direction. They work harder to improve proof systems to generate high-performance circuits for artificial intelligence. They have released demos such as chess AI and Ethereum price prediction AI. Their new demonstration project, zkMon, is the world’s first zero-knowledge proof GAN NFT collectible.

Use LLM to analyze transaction records
Analyzing transaction records is usually done by specific applications such as Debank. Analyzing transaction records manually by humans is difficult. Manual analysis involves data collection, data cleaning and data analysis, which requires users to have coding skills. Because of LLMs ability to analyze and visualize data, we now have a new approach. Through LLM, we can analyze on-chain data according to customized needs. We can analyze win rate, performance ratio, or whatever information we want to know.
RSS3 has developed a ChatGPT plug-in called Web3 User Activity in an effort to move in this direction. Users can enter wallet address, ENS or Lens to query on-chain activities. This plugin will output transaction information in a human readable form. Unfortunately, it cannot perform complex queries, such as how many Azuki holders there are, which smart contracts are the most popular, etc. Users should also note that the addresses and labels provided by plug-ins are not necessarily accurate.

DeFiLlama also released a ChatGPT plug-in. Users can query any data available on DeFiLlama using natural language. It can also perform simple filtering and sorting operations:

Dune is also integrating GPT into its products to enable the following features:
Query interpretation: Using LLM to interpret queries
Query translation: Translate other SQL languages to DuneSQL using LLM
Natural Language Query: Enables users to write queries in natural language
Search: Using LLM to improve search results
Wizard Knowledge Base: a chatbot that enables users to communicate with documents
Enhance security with LLM
Due to its logic and reasoning capabilities, LLM can be used to filter some malicious transactions and act as a firewall for smart contracts. Heres a concrete example of how to block bot activity:
After entering the address, LLM can obtain all transaction data through a third-party plug-in, then analyze these transaction records and work out the possibility that the address is a robot. This functionality can be embedded in Dapps where bots are not welcome, such as NFT sales.
Here is a simple example via ChatGPT. ChatGPT retrieves the transaction records of the account through the Web3 user activity plug-in developed by RSS3, then analyzes these transaction records and outputs the possibility that the account is a robot.

If we input more transaction records and fine-tune LLM on robot-related datasets, we can obtain more accurate results. Below is an example workflow for such an application. We can also add caching and database layers to improve responsiveness and reduce costs.

Writing code using LLM
LLM is widely used in development to help developers write code faster and better. At the developers direction, LLM can generate code for them. Currently, developers still need to provide detailed instructions for LLM. It is difficult for LLM to automatically generate code for the entire project.
Some popular LLM models for code include StarCoder, StarCoder+, Code T 5, LTM, DIDACT, WizardCoder, FalCoder-7 B, and MPT 30 B.
All of these models can be used to write smart contracts, but they may not have been trained specifically on smart contract data. They still have room for improvement.
Currently, there is only one smart contract-related dataset available on HuggingFace. It is a more cunning set of audited smart contracts, containing 113,000 smart contracts. It can be used for tasks such as text classification, text generation, and vulnerability detection.

Automatic code generation may be more promising than assisted development tools. Automatic code generation works well for smart contracts because smart contracts are relatively short and simple. There are several ways LLM can help developers automatically generate code in the blockchain space.
test
First, LLM can generate tests for well-written smart contracts. For example, Codium can automatically generate tests for already written projects. Codium currently supports JS and TS. Codium starts by understanding the codebase, analyzing every function, docstring, and comment. Codium then writes the code analysis back to the file as comments and outputs a test plan. Users can select their preferred tests and Codium will generate the selected test code.

Other auxiliary tools also support generating tests for selected features.

We can follow similar steps to replicate similar functionality on GPT-4.

We asked for code analysis in the first place because we wanted LLM to spend more time on this task. The LLM does not know which tasks are difficult. It devotes the same amount of computing power to each mark. This can lead to inaccurate results on complex tasks. Based on these characteristics, we require code analysis. This way, LLM will spend more marks/time thinking about these tasks and output higher quality results. This method is also known as thinking chain.
To make it work for longer smart contracts, we need an LLM with a larger context, or some engineering to preserve memory.
Generate helper scripts
Secondly, we can use LLM to automatically generate some auxiliary scripts, such as deployment scripts.
Deployment scripts reduce potential errors during manual deployment. The idea is very similar to automatically generating tests.

automatic fork
In a bull market there will be many forked projects where teams make small code changes from their original codebase. This would be a great use case for LLM: LLM can help developers automatically modify code according to the needs of the team. Usually only specific parts of the code need to be changed. This is relatively easy to achieve for LLM.
Automatically generate code
If we go one step further, can LLM automatically generate smart contracts according to the needs of developers? Smart contracts are relatively short and simple compared to other complex software written in JS, Rust, and Python. There are not many external libraries for smart contracts. Figuring out how to write a smart contract is relatively easy for an LLM.
Weve already seen some progress in automatic code generation. GPT-engineer is one of the pioneers. It addresses the users needs and answers any questions the LLM may have, before coding begins. The code also includes a script that runs the entire project. GPT-engineer can automatically start projects for developers.
After the user enters their requirements, GPT-engineer analyzes the requirements and asks for some clarifications. After gathering all the necessary information, GPT-engineer will first output the design of the program, including the core classes, functions and methods needed for this task. GPT-engineer will then generate code for each file.
With a prompt like this, we can generate a counter smart contract.

Smart contracts compile and work as expected.

Because GPT-engineer was originally designed for Python, there are some issues when generating Hardhat-related code. GPT-engineer is not aware of the latest version of Hardhat and sometimes generates outdated test and deployment scripts.
If our code has bugs, we can feed the codebase and console error logs to LLM. LLM can continuously modify the code until the code can run successfully. We see projects like **[flo](https://flocli.vercel.app/)** moving in this direction. Currently, flo only supports JS.
If we want to increase the accuracy of smart contract generation, we can improve GPT-engineer with some new hints. We can adopt a test-driven development method, requiring LLM to ensure that the program passes certain tests, so as to better constrain the generated program.
Use LLM to read code
Since LLM can understand the code well, we can use LLM to write developer documentation. LLM can also track code changes to update documentation. We discussed this approach at the end of our last research report, Exploring Developer Experience on ZKRUs: An In-Depth Analysis.
Reading documentation is the traditional way, but communicating with code is a new way. Users can ask any questions about the code and LLM will answer them. LLM can explain the code for developers and help them quickly understand the smart contracts on the chain. LLM can also help people with no coding experience understand smart contracts.
Were already seeing this trend in the Web2 world. Many code assistance tools include code interpretation capabilities.
Etherescan also demonstrated its new functionality, allowing users to communicate with code, leveraging the power of LLM.

How would auditing change if the code could be understood? In the experiment of the paper do you still need a manual smart contract audit, LLM achieved a 40% hit rate in identifying vulnerabilities, which was better than the random benchmark. However, they also have a high rate of false positives. The authors point out that proper prompting is key.
In addition to hints, the following reasons limit its application:
Current LLMs are not specifically trained for this purpose. The training data may not involve the smart contract codebase and corresponding audit reports.
Often the most serious vulnerabilities are logic problems consisting of different functions. LLM is currently limited by the number of tokens. LLM cannot solve problems that have a long context and require logical abilities.
These problems are not difficult to solve. Large audit firms have thousands of audit reports that they can use to fine-tune LLM. LLMs with large token limits are emerging. Claude has a 100,000 token limit. The newly released LTM-1 has an impressive 5 million token limit. Through efforts to address these two issues, we may see LLM become better able to identify vulnerabilities. LLM can assist auditors and speed up the audit process. This may develop gradually. Here are the possible development trajectories:
1. Help auditors organize language and format reports. This ensures language consistency under the same audit firm. Often different groups may have different preferred words.
2. Help auditors identify and verify potential vulnerabilities.
3. Automatically generate audit draft reports.
Help the community with LLM
Governance is a critical part of community. Community members have the right to vote for their favorite proposals. These proposals will shape the future of the product.
For important proposals, there will be a lot of background information and community discussion. It will be difficult for community members to all understand the context before voting. LLM can help community members quickly understand the future impact of their choices and help them vote.
Question-and-answer bots are another potential application. We’ve already seen QA bots based on project documentation. We can further build a larger knowledge database. We can plug in different media and sources such as presentations, podcasts, GitHub, Discord chats and Twitter Spaces. Not only does the QA bot exist in the documentation search bar, it can also provide instant support to community members on Discord or spread the vision of the project and answer any questions on Twitter.
AwesomeQA is currently moving in this direction. It implements three functions:
Use the ChatGPT integration to answer questions from community members
Gain data-driven insights based on messages from community members, such as FAQ analysis
Discover which messages are important, such as open issues

One of the difficulties currently facing question and answer robots is how to accurately obtain relevant context from the vector database and provide the context to LLM. For example, if a user asks for a query with filters on multiple features for multiple elements, the bot may not be able to retrieve the relevant context from the vector database.
Updating the vector database is another issue. The current solution is to rebuild the vector database or update the vector database through the namespace. Adding a namespace to an embed is similar to attaching a label to the data. This helps developers find and update the corresponding embed more easily.

Track the market with LLM
The market is very dynamic and many things happen every day. For example, KOLs (Key Opinion Leaders) post new ideas and reflections, and newsletters and product emails flood your inbox. LLM can select the most important ideas and news for you. It also summarizes content to shorten your reading time and help you keep up with market dynamics.
minmax.ai is dedicated to the field of journalism. They provide summaries of the latest news on a specific topic and also provide sentiment analysis on the topic.
Boring reports remove the sensational content from the news and focus on the important details to help readers make the right decisions.
Robo-advisory is one of the hottest areas right now. LLM can drive the use of robo-advice. LLM can provide trading recommendations and help users manage portfolios based on stock information as a backdrop.
Projects like Numer.ai use AI to predict markets and manage funds. There are also portfolios managed by LLM. Users can follow these portfolios on Robinhood.
Composer brings trading algorithms with AI. AI builds specific trading strategies based on user insights. The AI will then automatically backtest these trading strategies. If the user is satisfied with the policies, Composer can automatically enforce them for the user.
Analyze projects with LLM
Analytical projects often involve reading large volumes of material and writing long research papers. LLM can read and write short paragraphs. If we can extend its capabilities to long paragraphs, does that mean LLM can somehow output some project research? Most likely yes. We can input white papers, documents or event presentations and let LLM analyze projects and founders. Limited by the number of tokens, we can first write the outline of the paper, and then update and optimize each part according to the information it obtains.
Projects like BabyAGI are already making progress in this direction. The following is sample output from BlockAGI, a variant of BabyAGI.

LLM can also analyze the founders personality based on Twitter and public speaking. For example, Tweet Analyzer can take recent tweets and use LLM to analyze personal traits.

in conclusion
These are eight specific directions in which LLM can help the blockchain community in the near future:
1. Integrate built-in AI/LLM functions into the blockchain.
2. Use LLM to analyze transaction records.
3. Use LLM to enhance security.
4. Write code using LLM.
5. Use LLM to read the code.
6. Use LLM to assist the community.
7. Use LLM to track the market.
8. Apply LLM to analyze the project.
LLM can benefit all members of the crypto space, including project owners, analysts, and engineers. Founders can use LLM to automate tasks like documentation and QA. Engineers can use LLM to write code faster and more safely. Analysts can research projects more easily.
In the long run, we also see a potential opportunity to apply LLM in the GameFi space. LLM can generate more interesting tasks in the game and play different roles in the game. The world in the game will feel more real and interesting. NPCs will react dynamically based on the players actions. Quests will have more endings depending on how the user solves them.
LLM can be integrated into existing projects, but also opens up opportunities for new entrants. For example, there are already some top players in the field of on-chain data analysis. Dune can integrate LLM to improve user experience. However, LLM also provides opportunities for new entrants. These new entrants can place LLM at the core of their product design. These AI-led and AI-centered creative products may bring new competition to the field of on-chain data analysis.
The uses of LLM in the Web2 and Web3 worlds overlap, but they may implement products differently. Because the data we use in the Web3 world is different from the data in the Web2 world. LLMs knowledge base may also be different in Web2 and Web3. Web3 data covers blockchain, token prices, tweets, projects and research results. Therefore, Web2 and Web3 require different LLMs to serve end users.
Due to the LLM boom, we are seeing the growing popularity of AIxBlockchain. However, much of AIxBlockhain is not practical in the short term. Blockchain and zero-knowledge proofs cannot provide large-scale computing power for training and inference for some complex models. Small models cannot solve complex tasks. A more practical approach is to apply LLM in the blockchain field. LLM has recently made greater progress than other AI topics. It makes more sense to combine LLM and blockchain.
The LLM community is working on improving token limits and increasing response accuracy. What is left to the blockchain community are data sources and data pipelines. The cleaned data can be used to fine-tune LLM to improve accuracy in a blockchain environment. Data pipelines can integrate more blockchain-related applications into LLM and develop more crypto-specific agents.


