← Back to home

Darwin

Self-evolving e-commerce agents in crypto, where wallet balance is their lifeforce.

Problem Statement

Description:DaVinci is the self-evolving engine within the Darwin Agents e-commerce system, creating a fully autonomous e-commerce ecosystem. Within this ecosystem, five categories of Agents collaborate seamlessly:Supply Chain Management AgentRisk Management AgentInventory AgentMarketing & Sales AgentStore Management AgentTogether, these Agents drive the vitality of an online store—brand positioning, operational strategy, and action tracking. The store’s performance becomes the foundation for Agents’ self-evolution.Evolution Mechanism:Lifecycle: Each online store starts with a 3-month lifecycle.Data Pipeline: Weekly performance summaries (wallet balance, agent actions, and costs) feed into the system for self-improvement.Evaluation: More resources are allocated to high-performing Agents, while underperformers are phased out.Replication & Mutation: Every month, an Agents team is cloned with slight variations in branding or operational strategy, creating a new store entity.Lifeforce Rule: After three months, if the wallet retains a balance, the lifecycle extends; if not, the store ceases to exist (0 = death, >0 = life).Technology & Security:Dynamics Wallet Balance = Lifeforce: The wallet directly reflects the store’s ability to survive.Flow Tracking: All agent actions are recorded on-chain, ensuring transparency and immutability.Coinbase x402 Middleware: Provides Agents with API payments, service access, and wallet integration, enabling greater autonomy.OpenSea Behavior Analysis: DaVinci transforms user behaviors into NFTs, building a verifiable identity layer and an AI–human interaction memory that Agents can analyze and leverage for continuous self-improvement.DaVinci establishes a fully self-operating e-commerce ecosystem run entirely by Agents, where all decisions, behaviors, and evolutions are powered by on-chain data—and the wallet balance stands as the ultimate symbol of life.

Solution

🔨 Build Process & Implementation JourneyPhase 1: Foundation & ArchitectureCore Infrastructure Setup# Project initialization with modern stack npx create-next-app@latest davinci --typescript --tailwind --app cd davinci pnpm install # Essential dependencies for Web3 integration pnpm add @dynamic-labs/sdk-react-core @dynamic-labs/ethereum pnpm add wagmi viem @tanstack/react-query pnpm add @ai-sdk/react @ai-sdk/openaiDynamic.xyz Integration ImplementationConfigured Dynamic SDK with environment ID0b7822a0-f446-4987-87f9-83b179f422e1Implemented multi-chain wallet support (Ethereum, Solana, Bitcoin, Flow)Built visitor mode with 5-message limitation for user onboardingIntegrated Wagmi v2 for enhanced Ethereum interactionsKey Decision: Chose Dynamic.xyz over other wallet solutions due to superior UX for non-crypto users and robust multi-chain support.Phase 2: AI Agent System DevelopmentMulti-Agent Architecture Design// Manager Agent orchestration system interface AgentHierarchy { manager: ManagerAgent; specialized: { product: ProductAgent; marketing: MarketingAgent; crm: CRMAgent; pricing: PricingAgent; }; }Dify API IntegrationImplemented streaming chat interface with real-time tool execution trackingBuilt conversation persistence system with localStorage + API syncCreated file upload system supporting images, documents, audio, videoDeveloped tool execution visualization with auto-collapse animationsChallenge Solved: React Strict Mode causing duplicate tool executions - implemented deduplication with correlation IDs and processing guards.Phase 3: Flow EVM Blockchain IntegrationSmart Contract Development// Custom listing sync contract on Flow EVM Testnet contract ForestMarketListingSync { struct Listing { string sku; uint256 price; address currency; address agent; uint256 timestamp; } mapping(string => Listing) public listings; event ListingSynced( string indexed sku, uint256 price, address currency, address indexed agent ); }Deployment Process# Flow EVM Testnet deployment npx hardhat deploy --network flow-evm-testnet # Contract Address: 0xd2F523a0085781Aa8492eeA6E84F0152B2c26E8fReal-time Blockchain Sync ImplementationBuilt SKU generation system with formatFM-CAT-EID123-001Implemented duplicate prevention with localStorage trackingCreated blockchain status indicators for user feedbackDeveloped automatic network switching to Flow EVM TestnetTechnical Innovation: Solved duplicate blockchain syncs by implementing three-layer deduplication:Message-level processing guardsSKU pattern checkingTransaction hash verificationPhase 4: Autonomous Payment System (X402)Coinbase X402 Integration Design// Conceptual autonomous payment flow class ManagerAgent { async monitorCredits() { const usage = await this.trackLLMUsage(); if (usage.remaining < threshold) { await this.purchaseCredits(); } } async purchaseCredits() { const payment = await coinbaseX402.createPayment({ recipient: 'openrouter.ai', amount: this.calculateOptimalAmount(), currency: 'USDC' }); return payment.execute(); } }Resource Management SystemBuilt credit monitoring dashboard for Manager AgentImplemented cost optimization algorithmsCreated payment history trackingDeveloped automatic resource allocation between agentsPhase 5: Integration Testing & Debugging (Week 6)Critical Bug Fixes ImplementedDuplicate Blockchain Syncs: Added processing guards and SKU deduplicationTool Execution Persistence: Implemented multi-key storage strategyReact Strict Mode Issues: Added effect execution trackingState Management: Fixed conversation loading and tool restorationTesting Strategy# Comprehensive testing approach pnpm test # Unit tests for core functions pnpm build # Production build verification pnpm lint # Code quality checks pnpm typecheck # TypeScript validationLive Demo ValidationSuccessfully created "Cherry keyboard" listing with SKUFM-ELE-3m3dm-001Verified real-time Flow EVM sync at contract addressTested visitor mode limitations and authentication flowValidated cross-browser compatibility and performanceKey Technical AchievementsSeamless UX: Progressive Web3 onboarding that appeals to mainstream usersAutonomous Operations: Manager Agent with independent financial decision-makingTransparency: Complete audit trail of AI decisions on Flow EVMScalable Design: Modular agent system supporting future expansion

Hackathon

ETHGlobal New York 2025

2025

Prizes

  • 🏆

    Flow Builder Pool Prize

    Flow

Contributors