Inspiration
Users frequently encounter failed transactions when attempting to pay via UPI or cards—not due to payment gateway issues, but because their bank's server is temporarily down. In such scenarios, there is no fallback mechanism to complete the transaction, leading to:
- User frustration and poor payment experience
- Lost sales for merchants
- Reduced trust in digital payment systems
- Economic losses due to incomplete transactions
There's a clear need for an AI-driven, intelligent fallback system that ensures payment completion by handling such downtime scenarios, making payments more reliable and resilient.
What it does
This project implements three AI agents for an AI-orchestrated, blockchain-backed payment continuity system. The system ensures successful transactions even during bank server downtimes by leveraging blockchain liquidity pools as a fallback mechanism.
Key Features:
- Real-time bank server monitoring
- Intelligent transaction routing
- Blockchain-based fallback payments
- Automated recovery processes
- Liquidity pool optimization
How we built it
The core architecture uses AI agents to monitor bank services, route transactions appropriately (to bank or blockchain), manage recovery processes, and optimize liquidity pool usage. These agents interact with each other and external systems via Kafka and Redis, and call blockchain functions exposed by a React frontend.
System Architecture
Agent 1: Bank Server Monitor (agent1_bank_monitor)
Function: Simulates and monitors bank server availability.
Responsibilities:
- Continuously checks/simulates bank server status (randomly toggles between "up" and "down")
- Publishes bank availability to the
bank_serverKafka topic - Message format:
{"bank_id": "bank_001", "status": "up/down", "timestamp": "..."}
Agent 2: Transaction Router & Recovery Manager (agent2_transaction_router)
Function: Routes transactions based on bank status and manages recovery payments. Exposes an API for frontend interaction.
Core Responsibilities:
Transaction Routing:
- Monitors the
transaction_requestsRedis queue - Checks bank server status from the
bank_serverKafka topic (published by Agent 1) - If bank is UP: Publishes transaction to
bank_tx_processingKafka topic - If bank is DOWN: Calls
fallbackPayWithCrossPools()blockchain function via the frontend API
Recovery Processing:
- Monitors the
Recovery_paymentsRedis queue - When bank is UP:
- Credit card recovery: Publishes to
credit_card_recoveryKafka topic - Bank account recovery: Publishes to
bank_recoveryKafka topic - Blockchain collateral recovery: Calls
unstakeFromPool()via the frontend API
- Credit card recovery: Publishes to
- Monitors
recovery_status_updateKafka topic for completion signals
Liquidity Pool & Debt Management (via API):
Exposes FastAPI endpoints for the frontend:
POST /stakeInPool(params: poolId, amount)POST /createPoolOnChain(params: regionName)POST /repayDebt(params: poolId, amount)
These API calls trigger corresponding blockchain functions via the frontend API.
API Port: Runs on port 8000
Agent 3: Liquidity Pool Optimizer & Payment Monitor (agent3_liquidity_optimizer)
Function: Fetches blockchain data for pool optimization and monitors payment confirmations.
Responsibilities:
- Periodically calls
fetchBlockchainPools()andfetchUserData()via the frontend API to get real-time data - Includes liquidity pool optimization logic
- Monitors payment confirmations from bank/blockchain and updates Redis
- Provides analytics and insights for system performance
Challenges we ran into
- Integration Complexity: Seamlessly integrating AI agents with blockchain architecture required careful coordination of multiple technologies
- Real-time Data Synchronization: Ensuring consistent state across Kafka, Redis, and blockchain components
- Fault Tolerance: Building resilient agents that can handle their own failures while managing payment system failures
- Error Handling: Implementing comprehensive error recovery mechanisms for partial failures
- Testing Complexity: Simulating various failure scenarios and edge cases in a distributed system
Accomplishments that we're proud of
- First-of-its-kind: Created a novel AI-driven payment continuity system that addresses a real-world problem
- Multi-Agent and Blockchain Integration: Successfully implemented three AI agents working seamlessly with blockchain tech for fallback mechanisms
- Real-time Processing: Achieved real-time transaction routing and recovery with minimal latency
- User Experience: Eliminated frustrating payment failures for end users
- Merchant Benefits: Reduced lost sales due to payment system failures
What we learned
- Distributed Systems: Gained deep insights into building resilient distributed systems with multiple points of failure
- Blockchain Integration: Learned to effectively bridge traditional fintech with blockchain technology
- AI Agent Design: Developed expertise in creating specialized AI agents for specific business functions
- Payment Systems: Developed comprehensive understanding of payment processing, failure modes, and recovery mechanisms
- Liquidity Management: Learned about liquidity pool optimization and cross-chain payment mechanisms
- Agile Development: Effectively managed a complex, multi-component project with tight timelines
- Integration Testing: Developed strategies for testing complex, interconnected systems
What's next for Project Aegis
Our roadmap includes implementing advanced neural networks for predictive bank downtime analysis and dynamic liquidity optimization. We're developing cross-chain interoperability to support multiple blockchain networks and real-time fraud detection using anomaly detection algorithms. Plans include building a comprehensive analytics dashboard with predictive insights, implementing smart contract automation for seamless recovery processes, and adding multi-currency support. We'll also integrate with additional payment gateways, develop mobile SDKs for broader adoption, and create an open-source framework enabling developers worldwide to enhance payment system resilience and reliability.
Log in or sign up for Devpost to join the conversation.