Last updated a week ago
Cardano is designed to make contract interactions composable in many situations, but there is significant effort required to research and build the proper datums, redeemers, and validation checks.
I propose using AI to generate text and code to facilitate contract interactions. This can be used in combination with all on chain interactions with a contract to validate generated code.
Please provide your proposal title
SteelSwap - AI Cardano Chain Decompiler Prototype
Enter the amount of funding you are requesting in ADA
100000
Please specify how many months you expect your project to last
6
Please indicate if your proposal has been auto-translated
No
Original Language
en
What is the problem you want to solve?
Cardano is designed to make contract interactions composable in many situations, but there is significant effort required to research and build the proper datums, redeemers, and validation checks.
Does your project have any dependencies on other organizations, technical or otherwise?
No
Describe any dependencies or write 'No dependencies'
This project will rely on Python based tooling like pycardano for testing generated code solutions. It will also rely on projects currently in development developed by myself such as dbsync-py to empower the AI to explore the chain and interactions.
Will your project's outputs be fully open source?
No
License and Additional Information
This project will have some work to finalize an already open sourced project from myself called dbsync-py. In addition, it will open source a tool called cardano-mcp that will expose dbsync to AI agents. The specific components that will not be open sourced are the full code generation and testing pipelines.
Please choose the most relevant theme and tag related to the outcomes of your proposal.
AI
Describe what makes your idea innovative compared to what has been previously funded (whether by you or others).
A common complaint about Cardano is that development is challenging due to incomplete or inadequate tooling. This is in spite of having a variety of tools specifically designed for doing transaction building for scipt interactions.
We propose tackling this issue by taking it a step further: Use AI to learn the datum and redeemer structures for a contract use the full on chain history of interactions with a contract, and then generate code that can build a transaction using existing tooling.
Describe what your prototype or MVP will demonstrate, and where it can be accessed.
The MVP will be composed of two open source projects (dbsync-py and cardano-mcp) that will allow other developers to build similar types of AI integrations, and a final tool that will allow someone to enter a contract and optionally some context from a user and will generate an explanation of what the contract does along with code to help build transactions that integrate with contracts.
Describe realistic measures of success, ideally with on-chain metrics.
Measures of success will include:
Number of projects that use cardano-mcp to develop AI integrations for Cardano
Number of projects that use the code generation tool to build new types of transactions that compose different contracts
Please describe your proposed solution and how it addresses the problem
I propose building an AI agent that is given access to all on chain data through dbsync to analyze all contract interactions and generate code that can build transactions that can interact with the contract. The idea came from a Twitter discussion on whether an AI could be built to fully decompile a smart contract from unsigned plutus core (UPLC). This solution proposes an MVP that begins to implement this idea in an obtainable and useful way: generating code that gives developers a head start in building transactions that interact with smart contracts.
Note: In many cases, contracts are permissioned. For example, a particular signing key or token/NFT is required by a signing address as a part of the validation process. In these cases, the code could be generated to build the transaction but the transaction may not be successfully submitted on chain. However, even in these cases understanding the mechanism is often helpful for developers.
Datums on chain are raw data with no explanation for what each of the fields are. Developers can see all transaction information, but have to spend significant time an effort understanding each field. If they are lucky, they can have assistance from the contract developers or an SDK exists to help with integrations. However, in most cases it is often faster to figure it out themselves. Even then, most contracts have different types of interactions, so even if one datum structure is figured out, the process will need to be repeated for each different contract interaction. Part of the process of figuring out the different fields often involves reviewing input and output UTxOs of a transaction, and sometimes may require reviewing multiple transactions. For example, when submitting a DEX order the address of the owner and receiver of swap funds is embedded into the datum, but what the address field might mean isn't clear until a subsequent batched transaction is created.
AI is excellent at analyzing structured information and establishing relationships between data, especially when provided a lot of examples. AI agents in particular are excellent both at analysis and research to help not only draw relationships, but perform followup research and analysis to further refine an initial solution. The introduction of model context protocols (MCPs) have further super charged the ability of AI to easily integrate with tools. Of not for this proposal are the AI tools designed to take requests for information from an AI to generate a SQL query that can retrieve specific pieces of information in a database. This is significant here since Cardano has dbsync, which is effectively a postgres database that indexes all on chain data. This means there are established ways of helping AI to query and use Cardano's on chain data in a way that can be used to look for information and refine it's understanding of the chain.
Here, I propose the development of two open source tools and an MVP to begin building AI agents that can understand on chain information.
The dbsync-py package will contribute a few components to this project. First and foremost, it provides a mechanism for building Python native queries to dbsync with data structure validation. In addition, it has full documentation drawn from the dbsync schema docs that can be used for context for the AI agent in browsing and understanding the dbsync structure. This project has already started and is open sourced under the MIT license, and funding for the project will finance the completion of the package and testing to ensure it's production ready.
We will create an MCP that will allow AI to easily interact with dbsync, using similar mechanisms to existing MCPs that interact with postgres. We will use that as a starting point, but also add in integrations with dbsync-py, charli3-dendrite, and pycardano to give the AI more context for querying the chain. This will be made open source under an MIT license so that developers of AI agents on Cardano will be able to easily integrate on chain data into their AI agents. We will package this to be served both locally and remotely, and will provide this as a subscription service since the cost and complexity to setting up dbsync can be burdensome. However, we will also include an example on how to use this with Demeter so that they are not tied to our subscription service.
The final output will be an MVP that can generate an analysis of a contract and it's interactions, with human readable code with comments for building transactions in Python and Typescript. This product will rely on an agent with access to cardano-mcp to query the chain for a particular smart contract and evaluate transactions to understand the datums and redeemers used for contract operations. The AI agent will be given specific instructions on basic strategies to understand contract interactions, including the use of common data strucures defined in Charli3-Dendrite, an open source tool developed by myself and Charli3 to interact with DEXs. Charli3-Dendrite has a number of common data structures, and can be provided to the AI as examples for it to cross-reference with new contracts to help understand the datums. Instructions on understanding contracts will include standard UTxO flows, including the use of beacon tokens/NFTs, UTxO indexes in redeemers to understand key UTxOs in contract operations, use of metadata to understand what the operation might be doing and what project it is associated with, and the need to look at upstream and downstream transactions of similar transactions to better understand all types of interactions with the contract. This is not an exhaustive list, but includes most of the considerations needed to understand how a contract operates.
Once the datums are understood, it will generate a concise human readable document to explain what the contract does, the possible operations, and datums associated with each operation. Code will be generated in either Python or Typescript according to user preference to make it easy to generate the datums and build a transation in the language of choice.
Please define the positive impact your project will have on the wider Cardano community
We find that this MVP will have broad impact on Cardano.
First, it will help new developers better understand contract interactions.
Second, it will help existing projects develop SDKs for their contracts, helping with adoption and integration into an existing protocol.
Finally, it helps to build the first block of a larger vision of an AI that can fully understand the Cardano blockchain, both as an aid to developers and for end users to better understand on chain data.
What is your capability to deliver your project with high levels of trust and accountability? How do you intend to validate if your approach is feasible?
I have developed a variety of open source Cardano projects for Python, and am a professional AI engineer. I am the primary contributor to Charli3-Dendrite, which builds transactions for DEXs, and I use this in the DEX aggregator I have built called SteelSwap. I have strong understanding of the difficulties in integrating new contracts into a product since it is what I have to do every time a new DEX comes online with SteelSwap.
As an AI engineer, I have patents for AI in computer vision for stem cell technologies and tissue engineering products. I am the director of a national AI research resource (NAIRR) pilot project that uses large language models (LLMs) to explore over 250 million scientific and medical texts.
I believe my current and previous accomplishments make me uniquely qualified to deliver this project, having both a strong understanding of Cardano datums and transactions as well as advanced usage of AI, both on a fundamental/architectural level as well as a broader context level.
Milestone Title
dbsync-py
Milestone Outputs
The first milestone will be for dbsync-py, which is an open source project with the highly permissive MIT license.
The outputs for this will be public documentation and fully implemented tests that cover 90% of the codebase.
Acceptance Criteria
I will deliver everything described in the milestone output section, ensuring that all documentation mirrors the dbsync-schema docs from the official dbsync repository. In addition, tests written in pytest will be created and have a requirement for 90% code coverage.
Evidence of Completion
Evidence for completion includes a link to public documentation and a readout from pytest showing at least 90% code coverage. Public documentation will be deployed on Github pages and will use the easy to read mkdocs-material package. Code coverage will have a screenshot of pytest showing 90% coverage.
Delivery Month
1
Cost
10000
Progress
10 %
Milestone Title
cardano-mcp
Milestone Outputs
cardano-mcp is a model context protocol (MCP) that exposed dbsync, with additional tools to help provide Cardano specific chain context. Specifically, the MCP will be designed for both local and remote execution. A CLI will be provided to run the MCP from the command line, but a Docker container will also be created for ease of setup. An example and documentation will be created to help with setup and integration.
Acceptance Criteria
This milestone is complete when there is a Docker container and public documentation that describes the tools included in the MCP as well as how to set the MCP up. A specific example of how to use the MCP in a common chat interface (e.g. Claude Desktop) will be included.
Evidence of Completion
Evidence for completion includes a link to the MCP documentation on how to set it up and a video showing how to use the MCP with an LLM (e.g. Claude Desktop).
Delivery Month
3
Cost
40000
Progress
50 %
Milestone Title
Cardano
Milestone Outputs
This milestone will create an AI agent that is capable of generating code in a select language (Python or Typescript) that can build datums and redeemers for different contract interactions. The AI agent will receive a set of instructions on general strategies used for understanding contract mechanisms. A UI will be created with three inputs: a contract address, a free text input that a person can use to describe what they think the contract is or does, and the programming language to generate code for. Generated code will include unit tests will on chain datums.
Acceptance Criteria
A UI that can receive an on chain address, human textual input for additional context for what the contract is, and the programming language to generate code for. The outputs will be one or more files in the language of choice that have code to build datums with complete test cases.
Evidence of Completion
A video showing a functional UI, where we input a contract address and show how it successfully generates Python code.
Delivery Month
6
Cost
50000
Progress
100 %
Please provide a cost breakdown of the proposed work and resources
For all ADA costs, we estimate ADA costs using an ADA value of $0.7
Total server costs (including labor) - 8,000 ADA
AI costs - 6,000 ADA
Elder Millenial (labor) - 86,000 ADA
Elder Millenials labor includes broad skills in AI, containerization, any upgrades to underlying packages, and delivery of final UI.
How does the cost of the project represent value for the Cardano ecosystem?
The value for this project is the creation of a tool that will benefit both developers and projects to better understand contracts and develop new types of applications that integrate protocols. Further, this tool can be used by projects to generate SDKs quickly and with little effort to facilitate bots and other projects being able to interact and better utilize a contract.
Terms and Conditions:
Yes
I (Elder Millenial) am the sole developer on this. I will be responsible for all code development and AI development.