cryptexpenso

AI-powered crypto expense management with blockchain integration, approvals and PYUSD reimbursements

cryptexpenso

Created At

ETHOnline 2025

Project Description

Expenso is a comprehensive AI-powered crypto expense management platform designed specifically for crypto-native businesses and Web3 organizations. The platform seamlessly bridges traditional expense management with blockchain technology, solving the critical problem that existing systems face in the crypto economy - they lack support for cryptocurrency transactions, real-time blockchain monitoring, Web3 wallet integration, and automated approval workflows for crypto-native organizations.

The platform features comprehensive blockchain integration with real-time transaction monitoring that automatically detects SOL and PYUSD transfers using Helius WebSocket integration, multi-currency support handling SOL, PYUSD, and USD with automatic price conversion via Pyth Network, wallet integration connecting to Solana wallets for balance checking and transaction verification, and instant reimbursements through automated PYUSD transfers upon expense approval using the Solana blockchain.

Expenso incorporates advanced AI-powered receipt processing using AWS Textract for accurate text extraction, intelligent categorization that automatically categorizes expenses and suggests appropriate policies, comprehensive data extraction pulling amount, date, vendor, and invoice number from receipts, and manual override capabilities allowing users to edit AI-extracted data for accuracy. The platform includes a dynamic workflow system with configurable approval chains featuring flexible multi-step approval workflows, role-based access with different approval levels for managers, finance heads, and admins, real-time status tracking with live updates on approval progress, and escalation handling for automatic escalation of overdue approvals.

The technical architecture combines a robust Python/FastAPI backend with RESTful API and JWT authentication, PostgreSQL database with SQLAlchemy ORM, real-time WebSocket connections for blockchain monitoring, AWS S3 integration for file storage, and Pyth Network integration for price feeds, alongside a modern React/TypeScript frontend with responsive Tailwind CSS design, real-time state management, and intuitive navigation. The blockchain integration leverages Solana Web3.py for blockchain interactions, Helius API for transaction monitoring, Token-2022 program for PYUSD transfers, and Associated Token Account management.

Targeting crypto companies, Web3 organizations, DAOs, DeFi protocols, blockchain startups, remote teams, and finance teams, Expenso offers competitive advantages including crypto-native design built specifically for cryptocurrency transactions, real-time processing with instant detection and processing of blockchain transactions, AI integration reducing manual data entry through smart receipt processing, automated workflows with configurable approval chains reducing administrative overhead, instant reimbursements through automated PYUSD transfers upon approval, and a modern UX with clean, intuitive interface designed for crypto users. The platform serves diverse use cases from employee reimbursements and business travel to office expenses, DeFi operations, and cross-border payments, positioning itself as the future of expense management for the crypto economy by combining traditional business processes with cutting-edge blockchain technology to create a seamless, automated, and efficient expense management solution.

How it's Made

Expenso was architected as a full-stack application combining modern web technologies with cutting-edge blockchain integration. The backend leverages Python's FastAPI framework for its high-performance async capabilities and automatic API documentation, while the frontend uses React with TypeScript for type-safe development and modern user experience. The entire system is designed around real-time data flow and blockchain event processing.

Backend Architecture & Core Technologies

The backend is built on FastAPI with SQLAlchemy ORM managing a PostgreSQL database, providing robust data persistence and relationship management. The authentication system uses JWT tokens with bcrypt password hashing for secure user sessions. The API follows RESTful principles with comprehensive error handling and validation using Pydantic models. Database migrations are handled through SQLAlchemy's Alembic, ensuring schema consistency across deployments.

Real-Time Blockchain Integration with Helius

The most technically challenging aspect was implementing real-time blockchain monitoring using Helius WebSocket API. We integrated Helius's logsSubscribe method to monitor Solana transaction logs in real-time, eliminating the need to run our own Solana RPC nodes. The system maintains persistent WebSocket connections with automatic reconnection logic and heartbeat mechanisms to ensure continuous monitoring. When transactions are detected, the system extracts relevant data including token amounts, sender/receiver addresses, and transaction signatures, then automatically creates expense records in draft status.

AI-Powered Receipt Processing with AWS Textract

Receipt processing leverages AWS Textract for intelligent data extraction and categorization. Files are uploaded to AWS S3 using presigned URLs for secure, direct client-to-S3 uploads, reducing server load. AWS Textract performs OCR extraction, converting receipt images into structured text data. The extracted text is then processed by a custom categorization service that analyzes the content and automatically categorizes expenses based on available categories and policies. The system uses intelligent pattern matching and keyword analysis to suggest appropriate expense categories and policies without requiring external AI services.

PYUSD Integration & Token-2022 Program

PayPal USD (PYUSD) integration was particularly challenging due to its implementation on the Token-2022 program. We implemented custom ATA (Associated Token Account) derivation using the Token-2022 program ID TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb instead of the standard SPL token program. The system handles PYUSD transfers with proper token account management, including finding derived token accounts for both organization and user wallets. This enables instant reimbursements in PYUSD upon expense approval, providing a stablecoin solution for crypto-native businesses.

Pyth Network Price Feeds Integration

Price conversion leverages Pyth Network's Hermes API for real-time cryptocurrency price feeds. We integrated specific price feed IDs including SOL (0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d) and PYUSD for accurate USD conversions. The system automatically converts SOL and PYUSD amounts to USD equivalents using Pyth's decentralized price feeds, ensuring accurate expense reporting without relying on centralized exchanges.

Dynamic Workflow Engine

The workflow system is built on a flexible, database-driven architecture. Workflow configurations are stored as JSON in the database, allowing for dynamic approval chain creation without code changes. The system pre-resolves approvers and creates workflow step instances when expenses are submitted, enabling parallel processing and efficient status tracking. The workflow engine handles complex scenarios including escalation, delegation, and multi-step approvals with real-time status updates.

Solana Blockchain Integration

Solana integration uses the solana and spl-token Python libraries for blockchain interactions. The system implements proper wallet management with organization wallet JBLAJjevyuZCDpBcvUTXvg13WmaHfwk9C2goWe7xYyGL for reimbursements. We handle both standard SPL tokens and Token-2022 program tokens, with custom implementation for PYUSD transfers including proper ATA derivation and transfer logic.

Frontend Architecture & State Management

The React frontend uses modern hooks for state management, with custom contexts for authentication and user data. The UI is built with Tailwind CSS for responsive design, featuring custom CSS animations and glass effects for a modern aesthetic. Real-time updates are handled through polling mechanisms that check for workflow status changes and expense updates. The frontend implements proper error boundaries and loading states for optimal user experience.

Deployment & Infrastructure

The application is deployed on Render with PostgreSQL database hosting. The backend uses Gunicorn with Uvicorn workers for production deployment, while the frontend is served as a static React build. Environment variables manage configuration across different deployment stages, with proper secret management for API keys and database credentials.

Notable Technical Challenges & Solutions

One particularly challenging aspect was handling the Token-2022 program integration for PYUSD transfers. The standard SPL token libraries don't fully support Token-2022, requiring custom implementation of ATA derivation and transfer logic. We implemented a robust error handling system that gracefully falls back to simulation mode when actual transfers fail, ensuring the application remains functional even during blockchain network issues.

Partner Technology Benefits

Helius provided reliable WebSocket infrastructure for real-time blockchain monitoring, eliminating the need to run our own Solana RPC nodes and providing stable connection management. AWS Textract's OCR capabilities significantly improved receipt processing accuracy compared to open-source alternatives. Pyth Network's decentralized price feeds ensured accurate cryptocurrency-to-USD conversions without relying on centralized exchanges. AWS S3 provided scalable file storage with secure presigned URL generation for direct client uploads.

Performance Optimizations

The system implements several performance optimizations including database connection pooling, async/await patterns throughout the backend, and efficient frontend state management to minimize unnecessary re-renders. The WebSocket implementation includes connection pooling and automatic reconnection to handle network instability. Database queries are optimized with proper indexing and relationship loading strategies.

Security Considerations

Security is implemented at multiple layers including JWT token validation, CORS configuration, input sanitization, and SQL injection prevention through SQLAlchemy's parameterized queries. File uploads are validated for type and size, with S3 bucket policies restricting access. The blockchain integration includes proper wallet validation and transaction verification before processing reimbursements.

This technical architecture enables Expenso to handle the complex requirements of crypto-native expense management while maintaining high performance, security, and user experience standards.

background image mobile

Join the mailing list

Get the latest news and updates