A Next.js application that combines AI-powered expense categorization with blockchain-based micro-savings on U2U.
A Next.js application that combines AI-powered expense categorization with blockchain-based micro-savings on U2U.
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
GEMINI_API_KEY: Your Google Gemini AI API key
VAULT_ADDRESS: The deployed Vault smart contract address
NEXT_PUBLIC_U2U_RPC: U2U RPC endpoint (defaults to testnet)
The application uses a simple Vault contract with the following functions:
deposit(): Accept U2U tokens
withdraw(amount): Withdraw specified amount
getBalance(user): Get user's balance
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
[ {"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)
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
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
The application is configured for U2U Nebulas testnet by default. To use mainnet:
Update NEXT_PUBLIC_U2U_RPC to mainnet endpoint
Update the chain ID in lib/wallet.ts
Ensure you have mainnet U2U tokens