ExpenseAI
A Next.js application that combines AI-powered expense categorization with blockchain-based micro-savings on U2U.
视频
描述
💸 ExpenseAI - AI Expense & Micro-Savings Manager
A Next.js application that combines AI-powered expense categorization with blockchain-based micro-savings on U2U.
🚀 Live Demo: expense-ai-u2-u.vercel.app
✨ Features
AI Expense Categorization: Uses Google Gemini AI to automatically categorize transactions
Frontend Wallet Integration: Connect MetaMask or other Web3 wallets directly in the browser
Micro-Savings: Automatically calculate and save round-ups to a U2U smart contract
Real-time Balance Tracking: Monitor your vault balance in real-time
🔧 Configuration
Environment Variables
GEMINI_API_KEY
: Your Google Gemini AI API keyVAULT_ADDRESS
: The deployed Vault smart contract address (0x96569fFcb348670f39568AAda596e8f2775310Fd on mainnet)NEXT_PUBLIC_U2U_RPC
: U2U RPC endpoint (defaults to mainnet: https://rpc-mainnet.u2u.xyz)
Smart Contract
The application uses a simple Vault contract with the following functions:
deposit()
: Accept U2U tokenswithdraw(amount)
: Withdraw specified amountgetBalance(user)
: Get user's balance
📱 Usage
Connect Wallet: Click "Connect Wallet" to connect your MetaMask or Web3 wallet
Enter Transactions: Paste JSON transaction data in the textarea
Categorize: Click "Categorize Expenses" to get AI-powered categorization
Save Round-ups: Click "Save Round-Ups" to automatically save spare change to your vault
Transaction Format
[ {"desc": "Uber Ride", "amount": 347, "date": "2024-01-15"}, {"desc": "Electricity Bill", "amount": 1547, "date": "2024-01-20"}, {"desc": "Grocery Shopping", "amount": 823, "date": "2024-01-18"}, {"desc": "Netflix Subscription", "amount": 499, "date": "2024-01-01"}, {"desc": "Restaurant Dinner", "amount": 1247, "date": "2024-01-16"}]
💡 Pro Tip: Use amounts that don't end in "00" to create round-ups for testing:
₹347 → saves ₹53 (rounds up to ₹400)
₹1547 → saves ₹53 (rounds up to ₹1600)
₹823 → saves ₹77 (rounds up to ₹900)
🏗️ Architecture
Frontend: Next.js 15 with React 19 and TypeScript
AI: Google Gemini 2.0 Flash for expense categorization
Blockchain: U2U integration with ethers.js
Styling: Tailwind CSS 4
🔒 Security
No private keys stored on the server
All blockchain transactions signed by user's wallet
Environment variables properly configured for public/private access
Input validation and error handling throughout
🌐 Network Configuration
The application is deployed on U2U Solaris Mainnet:
Chain ID: 39 (0x27)
Currency: U2U
RPC URL: https://rpc-mainnet.u2u.xyz
Contract Address: 0x96569fFcb348670f39568AAda596e8f2775310Fd
Block Explorer: https://u2uscan.xyz
📝 License
This project is licensed under the MIT License.