Why This Model?
Trust must be proven, not promised. ZK Proofs allow anyone to verify the correctness of a computation without revealing sensitive strategy details, preventing front-running. ERC-8004 provides the standard ledger to record these proofs, building a public, auditable reputation for each Agent that enables future Agent-to-Agent communication.How It Works
- Deterministic Execution: A Zyfai Agent’s logic is a deterministic set of rules, guaranteeing the same input always produces the same, verifiable output.
- Proof Generation: For each rebalance, the system generates a ZK proof. This proof cryptographically attests that the Agent’s action was the exclusive correct output of its rules.
- Simple, Standalone Verification: A dedicated verifier contract checks this proof, returning a definitive “yes” or “no” on the transaction’s integrity.
- Onchain Anchoring via ERC-8004: The ZK proof is permanently linked to the Agent’s unique onchain identity in the ERC-8004 Validation Registry. This creates a tamper-proof history of verified actions, building a reputation over time.
For Institutions
This elevates audit and compliance. Institutions can cryptographically verify that an Agent has complied with its mandate. It shifts the basis of delegation to mathematically verified onchain evidence, significantly reducing counterparty risk and enabling trust at scale.Technical Implementation
ERC-8004 ZK Validation Quick Reference
ERC-8004 ZK Validation Quick Reference
Zero-Knowledge Circuit Deep Dive
Zero-Knowledge Circuit Deep Dive
Circuit Overview
The Zyfai Rebalancer Validation Circuit (rebalancer-validation.circom) is a Circom 2.x circuit that validates DeFi rebalancing opportunities against backend constraints using zero-knowledge proofs. The circuit implements the core validation logic from Zyfai’s backend, ensuring opportunities meet all safety and performance criteria.Circuit Properties
- Language: Circom 2.0.0+
- Proof System: Groth16 (efficient on-chain verification)
- Curve: bn128 (bn254)
- Constraints: ~100-200 (includes comparison circuits from circomlib)
- Public Signals: 15 (all inputs are public)
- Private Signals: None (transparency-focused implementation)
Public Inputs
The circuit has 15 public input signals organized into three categories:New Opportunity Data (7 signals)
These signals describe the rebalancing opportunity being evaluated:Old Opportunity Data (7 signals)
These signals describe the previous opportunity (if any) for comparison and edge case handling:User Preferences (1 signal)
Validation Constraints
The circuit enforces 5 core validation rules that all must pass for a valid proof:1. Available Liquidity Check
Rule:liquidity * 0.85 > zyfiTvlPurpose: Ensures sufficient liquidity to cover the rebalancing amount.Implementation:2. TVL Constraint
Rule:poolTvl * 1e6 > amount * 400Purpose: Prevents excessive allocation. Ensures rebalancer is at most 25% of pool TVL.Math: amount * (100 / 25) = amount * 4, scaled by 100: poolTvl * 1e6 > amount * 400Implementation:3. APY Performance Check (with Edge Cases)
Rule:newApy > oldApy + 10 OR edge casesPurpose: Requires meaningful yield improvement (0.1%+) unless bypassed by edge cases.Edge Cases (APY check bypassed if ANY are true):- No Old Opportunity:
oldApy == 0(first deposit or no previous opportunity) - Rebalancing from Problematic Pool:
shouldRebalanceFromOld == 1(computed internally) - Pool No Longer Supported:
supportsCurrentPool == 0(user preferences changed)
4. APY Stability Check
Rule:apyStable7Days == 1Purpose: Ensures APY has been stable over the past 7 days (prevents volatile pools).Implementation:5. TVL Stability Check
Rule:tvlStable == 1Purpose: Verifies pool TVL is stable (prevents pools with unstable liquidity).Implementation:Constraint Composition
All 5 checks are combined using AND logic (all must pass):Example Input
Example Output
Off-chain Checks
More checks are in done off-chain which are not a part of the zk circuit but the above covers all the basic checks that’re being proven on-chain.Security Considerations
Current Implementation
- ✅ All inputs are public signals (transparency-focused)
- ✅ Boolean validation prevents malformed inputs
- ✅ Circom 2.x syntax with explicit public input declaration
- ✅ Comparison circuits from audited circomlib
- ✅ Edge case handling for APY checks