This project demonstrates how to build a lightweight conversational AI agent that can interpret natural language and perform blockchain actions like checking token balances and sending tRBTC—all through a chat interface. It runs on the Rootstock testnet using Groq’s LLM API, Reown AppKit, and Wagmi, all wrapped in a Next.js app styled with Shadcn UI.
🔗 Inspired by BitMate – a hackathon project exploring the fusion of AI and DeFi on Rootstock.
- 🔐 Wallet connection via Reown AppKit (MetaMask, WalletConnect, embedded)
- 🧠 Natural language interface via Groq LLM API
- 💬 Conversational agent with memory and action routing
- ⚡ Send tRBTC and check token balances using plain English
- 🖼️ UI powered by Next.js App Router and Shadcn components
Make sure you have the following installed:
- Node.js (v18+)
- Git
- A browser wallet like MetaMask connected to the Rootstock Testnet
Optional but recommended:
-
Clone the Repository
git clone https://github.com/rsksmart/ai-agent-rsk.git cd ai-agent-rsk
-
Install Dependencies
npm install # or bun install or yarn install
-
Configure Environment Variables
-
Copy
.env.example
to.env.local
-
Fill in the following values:
NEXT_PUBLIC_PROJECT_ID= NEXT_PUBLIC_RPC_MAINNET= NEXT_PUBLIC_RPC_TESTNET= NEXT_PUBLIC_GROQ_API_KEY=
You can get the api keys this way:
- ProjectId at Reown Cloud
- RPCs at Rootstock RPC API
- Groq API Key at Groq Console
-
-
Run the Dev Server
npm run dev # or bun dev or yarn dev
app/page.tsx
— Main chat UI and wallet interfacesrc/lib/utils.ts
— Wallet address validation and token lookupsrc/lib/constants.ts
— Block explorer URLs and other constantscomponents/
— Reusable UI components and chat layoutapp/api/ai
— Endpoint to call Groq LLM API
- flash (@flash)
- Groq API Key Not Working: Make sure it’s correctly set in
.env.local
and not rate-limited. - Wallet Connection Fails: Check MetaMask is on the Rootstock Testnet.
- Token Not Found: Make sure the token is an ERC-20 on Rootstock Testnet.
We welcome community contributions! Feel free to fork the project and submit a pull request. Just make sure your changes are well-documented and scoped to the project's purpose.
If you run into any issues or have questions, please open an issue on GitHub.
The software provided in this GitHub repository is offered “as is,” without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
- Testing: The software has not undergone testing of any kind, and its functionality, accuracy, reliability, and suitability for any purpose are not guaranteed.
- Use at Your Own Risk: The user assumes all risks associated with the use of this software. The author(s) of this software shall not be held liable for any damages, including but not limited to direct, indirect, incidental, special, consequential, or punitive damages arising out of the use of or inability to use this software, even if advised of the possibility of such damages.
- No Liability: The author(s) of this software are not liable for any loss or damage, including without limitation, any loss of profits, business interruption, loss of information or data, or other pecuniary loss arising out of the use of or inability to use this software.
- Sole Responsibility: The user acknowledges that they are solely responsible for the outcome of the use of this software, including any decisions made or actions taken based on the software’s output or functionality.
- No Endorsement: Mention of any specific product, service, or organization does not constitute or imply endorsement by the author(s) of this software.
- Modification and Distribution: This software may be modified and distributed under the terms of the license provided with the software. By modifying or distributing this software, you agree to be bound by the terms of the license.
- Assumption of Risk: By using this software, the user acknowledges and agrees that they have read, understood, and accepted the terms of this disclaimer and assume all risks associated with the use of this software.