Smart contracts are not always easy to understand or verify. They are written in programming languages, such as Solidity, that may not be familiar to many users. Moreover, smart contracts can contain bugs, vulnerabilities, or malicious code that can compromise their functionality or security.
To address this challenge, Etherscan, one of the leading Ethereum blockchain explorers, has launched a new tool called Code Reader, which leverages the power of artificial intelligence (AI) to analyze and explain smart contract source code.
Code Reader is a beta feature that uses OpenAI’s large language model (LLM) to provide users with a deeper understanding of any smart contract source code.
🆕 Code Reader (Beta)
Leverage the power of AI to seamlessly learn about any smart contract source code! ✨ pic.twitter.com/GTbULisudk
— Etherscan (@etherscan) June 19, 2023
The source code files of a contract can be accessed and interacted with by choosing a contract address. They can also ask questions or request explanations about any part of the code using natural language. Code Reader will then respond with an AI-generated answer that aims to clarify the meaning and purpose of the code.
Etherscan Plans to Take Full Advantage of the AI Boom
For example, users can ask Code Reader to explain what a specific function does, how a variable is defined, or what a modifier means. Code Reader will try to provide a concise and accurate answer based on the source code and its context.
Code Reader can also help users learn more about the features and capabilities of smart contracts. For instance, users can ask Code Reader to show them how to read or write data from a smart contract, how to interact with other contracts or tokens, or how to use certain libraries or frameworks.
Code Reader will then provide examples or instructions on how to perform these tasks using the smart contract’s code.
Is not only useful for developers who want to debug or audit smart contracts, but also for researchers, investors, or enthusiasts who want to explore and understand the logic and functionality of various smart contracts on Ethereum.
However, Code Reader is not a substitute for professional code review or verification. Etherscan warns that Code Reader is only intended for educational purposes and that users should not rely solely on its findings for legal or bug bounty purposes.
To use Code Reader, users need to connect to the OpenAI API and have the appropriate consumption limits. An API, or application programming interface, is a way for two computer systems to share and exchange information and messages. Currently, Code Reader does not support discussion threads, so the chatbot can only be accessed through one-time requests.