μMoo
Verifiable data driven programatic orders using Brevis and Cow Protocol
Screenshots



Problem Statement
Problems in DeFi Trading1. Lack of Data-Driven DeFiMost DeFi trading decisions are based on sentiment or basic indicatorsComplex statistical analysis is missing from on-chain tradingHistorical data analysis isn't readily available for smart contractsTraders can't leverage sophisticated metrics like z-scores or standard deviations on-chainLimited ability to validate trading strategies using historical performance2. Oracle can't be trustedTraditional oracles rely on centralized data providersNo mathematical proof of data validityPrice manipulation risks through oracle attacksSingle point of failure in data sourcingLimited transparency in price calculation methodologies3. Manual Trading Limitations and Lack of Verifiable Automated StrategiesDelayed reactions to market movementsInconsistent execution of trading strategiesNo way to prove strategy performance on-chainLimited transparency in automated trading systemsDifficulty in verifying historical performanceIntroducing μMooμMoo harnesses the power of Brevis' ZK coprocessor to analyze historical trading data from the blockchain in a verifiable manner. By utilizing Brevis' capabilities, we fetch and process historical trade events to compute essential statistical metrics like mean prices and z-scores, all backed by zero-knowledge proofs that validate our calculations. These proven statistical insights are then used to create conditional orders through CoW Protocol's advanced order framework. When our smart contract receives the verified statistical data from Brevis, it automatically determines optimal trading conditions based on the z-score and price comparisons. Once these conditions are met, the contract creates and submits orders to CoW Protocol, which handles the actual trade execution using its sophisticated batch auction mechanism and solver network. This creates a seamless, automated trading system where every step - from historical data analysis to trade execution - is both transparent and mathematically verifiable. The integration of Brevis and CoW Protocol enables users to implement sophisticated trading strategies that are driven by provable on-chain data, eliminating the need for trusted oracles or centralized price feeds while maintaining complete transparency in the trading logic.
Solution
Core Components and Integration1. Brevis Circuit for Statistical AnalysisWe implemented a custom circuit in Go using the Brevis SDK that:Fetches historical trade events from the blockchainComputes critical statistical metrics:Mean prices over a specified time windowZ-scores to measure price movement significanceLatest price comparisons for trade directionGenerates zero-knowledge proofs validating these calculationsThe circuit processes token pair events from CoW Protocol's settlement contract, ensuring all statistical computations are verifiable and transparent.2. Smart Contract ArchitectureOur system consists of two main contracts:PriceStatsHandler Contract: Handles the Brevis proof verification and stores statistical dataConditional Order Contract: Integrates with CoW Protocol's ComposableCow framework3. CoW Protocol IntegrationWe leverage CoW Protocol's ComposableCow framework for conditional order creation and execution:Orders are created based on verified statistical dataTrade direction (buy/sell) is determined by price comparison
Hackathon
ETHGlobal Bangkok
2024
Prizes
- 🏆
Build Data - driven dApps with Brevis ZK Coprocessor1st place
Brevis
- 🏆
Programmatic Orders1st place
CoW DAO
Contributors
- Architsharma7
23 contributions