Video thumbnail

ETH_Tanda

AI Agent that leverages smart contracts to create Tandas (a rotating credit association) on behalf of users, and deploying the contract.

ETH_Tanda

Created At

Agentic Ethereum

Winner of

Coinbase Developer Platform - AgentKit Pool Prize

Prize Pool

Project Description

This project leverages generative AI Agent technology and Coin Base's developer resources to allow users to seamless deploy a specific smart contract agreement to form a rotating savings and credit association known as a "Tanda". Tandas are small groups usually comprised of family and friends who agree to pay into a pot at set intervals and award the pot to one member at a time on a rotating basis at another agreed upon interval. This concept has been brought to the blockchain to provide a communal approach to a "rainy day" fund in the decentralized ecosystem.

How it's Made

This project was put together using a number of technologies and frameworks. On the backend the AI Agent was put together using langchain, openAI, and coinbase's Agentkit toolset. I also made a custom tool to make it easier for the AI to finalize the smart contact with the required constructors from the user. To allow access to the generated responses from my frontend, I used fastapi to establish an endpoint that will trigger the AI to perform actions or simply respond to user queries. For the frontend I decided to use Next js due to its simplicity and resources available. A fork I came to in the project early on was how to handle conversation flow given the separation of my frontend and backend; I had the choice of storing conversations in a database or in state and pass the current chat history to the AI Agent along with the user's query to provide a conversational flow. I opted for the latter and created an input parameter in my agent's prompt to ensure it interprets queries correctly. This was a rather hacky solution given that React has a useChat hook that has great out-of-the-box functionality, however, due to my desire to avoid creating and maintaining a database for this project, I ran into issues utilizing the hook and needed a workaround.

However, to my surprise, the most "hacky" I felt during the project was when working with the smart contract template, and sandboxing with CoinBase's agent toolkit. While the toolkit offers a robust set of tools, under the hood they can be tricky to work with. Specifically, using the smart contract deployment tool to deploy arbitrary contracts. I tested out the API by invoking manual tool calls passing in the required parameters in an iterative process that was not for the faint at heart to understand how to best carry out the contract creation step. After learning solidity, and creating several contract examples, I understood how specific and intentional one needs to be when drafting contracts, so I didn't want to risk unintended terms being added to a contract so I opted to create a template creation tool to ensure the consistency of these agreements allowing for constructors to act as parameters for the AI to finalize the contract code in the required input JSON format. However, this was still not enough as the AI was slightly reformatting template text when submitting to the contract deployment tool resulting in inconsistent performance. To avoid this, I had to create a custom tool that nested both the template creation function, and the contract deployment tool from CDP's tool set to ensure that when our agent input the parameters from the user, the contract would be finalized in the template, and deployed in one step to any possible adjustments that would result in a failure for the contract to deploy.

One item that I felt required a considerable amount of Additionally, I also used remix to develop the contract template structure. While the development was surprisingly easier to pick up on than I imagine.

background image mobile

Join the mailing list

Get the latest news and updates