← Back to home

Prism Wallet

Autonomous AI agent managing cross-chain portfolios via Avail Nexus, Lit Protocol PKP & Envio data

Problem Statement

The Cross-Chain AI Wallet Agent is an autonomous portfolio management system that intelligently optimizes crypto assets across 11+ blockchain networks by combining Envio HyperIndex for real-time multi-chain monitoring (processing 5,000+ events/second), Lit Protocol PKP for secure programmable signing with policy enforcement, and Avail Nexus SDK for seamless cross-chain bridging and operations. It solves the complexity of managing fragmented liquidity, high gas costs, and missed yield opportunities by continuously monitoring portfolios 24/7, making intelligent decisions through an AI engine that identifies rebalancing opportunities, high-yield farming opportunities above 5% APY, and optimal gas price windows, then executing securely through Lit Protocol PKP which enforces programmable signing policies including spending limits, time restrictions, chain restrictions, and action whitelisting without exposing private keys. The agent offers three automation modes (manual for full user control, semi-auto for threshold-based approval, and full-auto for complete autonomy within policy limits), features real-time intelligence with portfolio analytics showing USD valuations and cross-chain transaction history, prioritizes safety with emergency stop buttons and multi-layer validation through AI analysis, policy checking, risk assessment, and execution verification, and provides a mobile-first responsive design that works seamlessly across all devices from 320px to 1920px+ screens, supporting 11 mainnet chains (Ethereum, Optimism, Polygon, Arbitrum, Avalanche, Base, Scroll, Sophon, Kaia, BNB Chain, HyperEVM) and 6 testnet chains for comprehensive cross-chain portfolio management.

Solution

The project is built as a full-stack TypeScript application using Next.js 14 with App Router, Tailwind CSS for mobile-first styling, and React Hooks for state management, architected in three layers: the frontend handling dashboard and agent controls, the AI agent core containing the decision engine and action pipeline, and the integration layer connecting the three sponsor technologies. For Avail Nexus SDK, we implemented intent-based bridging with transaction simulation that reduced costs by 30%, created a custom EVM provider wrapper to inject Lit Protocol PKP signatures, and built a balance caching layer to minimize API calls, providing a unified interface for 11+ chains with automatic route optimization. Lit Protocol PKP integration uses @lit-protocol/lit-node-client for MPC-based wallet operations without private key exposure, implementing a custom policy engine that compiles TypeScript policies to Lit Actions for programmable signing enforcement, session signature caching to avoid re-authentication, and a fallback mechanism that tries 3 different Lit nodes for reliability, enabling conditional signing based on spending limits, time restrictions, and chain whitelisting. Envio HyperIndex integration leverages HyperSync for data retrieval 100x faster than traditional RPC calls, implements GraphQL queries with real-time subscriptions for sub-second portfolio updates, includes a custom aggregation layer combining multiple Envio endpoints with client-side caching that reduced API calls by 80%, and features a webhook system triggering agent actions on high-value transfers. The AI decision engine calculates chain distribution percentages, identifies imbalances, computes risk-adjusted returns factoring in gas costs, and implements a 4-step validation pipeline (Envio data gathering → AI analysis with confidence scores → Lit Protocol policy validation → Avail Nexus execution) with comprehensive error handling at each stage, while notable hacks include a hybrid caching strategy using localStorage, sessionStorage, and in-memory cache, optimistic UI updates with automatic rollback, a custom event bus for instant emergency stop broadcasts across components, and mobile-responsive design using CSS Grid with touch-optimized 44x44px tap targets.

Hackathon

ETHOnline 2025

2025

Contributors