Overview

Fhenix-FairMarket is a decentralized, privacy-preserving sealed-bid auction protocol engineered to resolve the fundamental tension between absolute bid confidentiality and economic scalability in on-chain markets. By transitioning from synchronous, gas-intensive on-chain Fully Homomorphic Encryption (FHE) to an Asynchronous FHE Coprocessing (CoFHE) model backed by EigenLayer AVS for economic verification, the protocol reduces computational overhead by ~99.9% while guaranteeing mathematical integrity, eliminating trusted intermediaries, and ensuring automatic fund recovery under network stress.

Protocol Vision

Traditional blockchain auctions suffer from excessive transparency, enabling MEV front-running, bid sniping, and shill bidding. Fhenix-FairMarket replaces “trust in code” with “trust in cryptographic proof”, allowing participants to submit fully encrypted bids (Ciphertext) that remain mathematically sealed until settlement. The system operates on a strict Funds Over Privacy principle: in extreme failure scenarios, capital recovery is prioritized before cryptographic privacy.

Core Problems & Architectural Fixes

Traditional FlawFhenix-FairMarket v2.0 Solution
Gas Explosion (10x–100x from on-chain FHE comparisons)O(1) on-chain storage + Off-chain CoFHE dispatch. Only bytes32 ciphertext hashes are stored on-chain.
Deposit Lockup on Sequencer/AVS failureDynamic Dead Man’s Switch using Moving Time Average of block.timestamp. Auto-transitions to VOIDED for 100% recovery.
Push-based Refund vulnerabilities (OOG, Reentrancy)Pull-over-Push settlement via claimRefund() with hasWithdrawn mapping. State updates precede fund transfers.
Session Key Theft via localStorageERC-4337 Ephemeral Session Keys with 24h TTL, stored in secure memory only. No persistent browser storage.
Expensive ZK-Proof verificationEigenLayer AVS + Fraud Proofs. Cryptoeconomic security replaces heavy circuits, enabling fast finality and automatic slashing.

️ System Architecture

The protocol is structured into four decoupled layers, ensuring upgradeability, security isolation, and linear scalability:

  1. UX & Abstraction Layer: Next.js frontend + ERC-4337 Account Abstraction. Enables 1-Click Trade interfaces with optimistic UI updates and progressive disclosure of technical complexity.
  2. Smart Contract Layer: UUPS/EIP-1967 proxy pattern separates logic from storage. Core logic interacts with FHE exclusively through CofheAdapter.sol, preventing SDK upgrade breaks.
  3. Off-Chain Coprocessing Layer: Keepers (auctionMonitorcofheDispatcheravsSubmitter) watch for endTime, batch ciphertexts to FHEOS servers, and return encrypted results.
  4. Verification & Settlement Layer: EigenLayer AVS operators cryptographically sign results. Fraud Proofs validate correctness before submitResolution() transitions state to FINALIZED or VOIDED.

️ Technical Stack

LayerTechnologyVersion / Spec
Smart ContractsSolidity, Hardhat, OpenZeppelin Upgradeables^0.8.25 / ^2.19 / UUPS Proxy
FHE & Coprocessing@cofhe/sdk, @fhenixprotocol/cofhe-contracts^1.2.0 / ^0.2.0
VerificationEigenLayer AVS + Fraud ProofsCryptoeconomic Threshold Signatures
Frontend & UXNext.js, Wagmi, Viem, ERC-433714 / v2 / v1 / Smart Accounts
InfrastructureKeepers, Docker, Redis, Gelato/ChainlinkSelf-paying automation + Distributed locking
CI/CD & SecuritySlither, Mythril, Playwright, TenderlyStatic analysis, E2E, Load testing (50 concurrent auctions)

️ Security & Economic Principles

Threat Matrix & Mitigations

  • Bid Value Leakage: Zero plaintext values in Events or Storage. Enforced via CI linting.
  • Reentrancy in Refunds: Pull over Push pattern. hasWithdrawn set to true before call{value: amount}.
  • Race Conditions: nonce + blockhash gating + Redis distributed locks for Keepers.
  • Upgrade Manipulation: UUPSUpgradeable restricts upgradeToAndCall to multisig only. 48h Timelock enforced.
  • Sequencer/AVS Failure: DynamicTimeout auto-triggers triggerFallbackVoid(), returning NFTs and releasing escrow.

Economic Model

StreamAllocationPurpose
Auction Success Fee0.5% of winning bidProtocol sustainability
Keeper Bounty0.2% of winning bidIncentivizes liveness & auto-execution
Protocol Treasury60% of net feesDevelopment, maintenance, infra
Insurance Fund20% of net feesNexus Mutual / capital protection
Developer Grants15% of net feesCommunity incentives & research
Bug Bounty5% of net feesImmunefi rewards for ethical hackers

️ Execution Roadmap

Development follows a strict 6-Phase Execution Roadmap with hard Audit Gates. Any P0 security failure halts progression to the next phase. No exceptions.

PhaseFocusDurationKey Deliverable
Phase 1Architectural Foundation10–14 daysUUPS Proxy, CofheAdapter, State Machine, ≥70% test coverage
Phase 2Encrypted Security & Settlement12–16 daysFHE solvency check, Pull refunds, Dynamic Dead Man’s Switch, SlashedPot
Phase 3CoFHE & AVS Integration14–18 daysAsync event flow, Keeper services, EigenLayer AVS verification, Mock fraud proofs
Phase 4Keepers & Infrastructure10–12 daysBatch processing, Race condition prevention, Docker stack, CI/CD pipelines
Phase 5Frontend & UX 2.012–15 daysERC-4337 session keys, Optimistic UI, Confidence Dashboard, E2E tests
Phase 6Testnet Deployment & Audit10–14 daysFhenix Testnet launch, KPI monitoring, Chaos engineering, External audit package

Critical Note: Parallel development is permitted only for Phase 5 (using mock ABIs), but integration is blocked until Phase 3 passes. All P0 items from the Audit Readiness Matrix must be verified before any deployment.


Next Steps