3. Market Mechanics3.3 MEV Front-Running Protection

3.3. MEV Front-Running Protection

Maximal Extractable Value (MEV) bots thrive on the inherent transparency of traditional blockchain mempools. By reading pending transactions in plaintext, validators and searchers can reorder, insert, or censor bids to manipulate auction outcomes, extract price differentials, or front-run legitimate participants.

Fhenix-FairMarket v2.0 mathematically neutralizes this threat by removing all readable financial intent from the transaction lifecycle. Because bid values are encrypted client-side, validated homomorphically, and resolved asynchronously, the mempool becomes a stream of opaque cryptographic hashes. MEV extraction is not just discouraged; it is rendered computationally and economically impossible.

Core Neutralization Principles

PrincipleTechnical Implementation
Opaque Mempool PayloadsplaceBid() transactions transmit only InEuint32 ciphertexts and a bytes32 hash. Validators cannot parse bid magnitude, target asset, or participant strategy.
Ordering IrrelevanceIn a sealed-bid architecture, the winner is determined by value, not timestamp. Being first in the block provides zero competitive advantage, eliminating the economic incentive for reordering.
Homomorphic Solvency GateFHE.lte(encryptedBid, escrowBalances[msg.sender]) executes without decryption. MEV bots cannot infer a user’s available capital or financial ceiling to sandwich their deposit.
Async Resolution DecouplingSettlement occurs off-chain after endTime. Block builders cannot manipulate the outcome by inserting competing bids in the final seconds, as all comparative math happens in encrypted space.
Zero-Plaintext Event LogsBidPlaced events emit only auctionId, bidder address, and cipherHash. Historical state scraping yields no actionable data for MEV strategy training.

️ Technical Implementation

1. Client-Side Encryption & Mempool Obfuscation

The encryption process occurs before the transaction is broadcasted, ensuring the raw financial intent never touches the P2P network.

// packages/frontend/src/lib/cofhe/encryption.ts
import { cofheClient, Encryptable } from '@cofhe/sdk';
 
export async function encryptBid(amount: number): Promise<InEuint32> {
 // Local encryption ensures plaintext never enters RPC/mempool
 const encryptedPayload = await cofheClient.encryptInputs([
 Encryptable.uint32(amount)
]);
 return encryptedPayload[0];
}

2. On-Chain Opaque Submission

The smart contract accepts the ciphertext without ever evaluating or exposing it.

// packages/contracts/core/FhenixFairMarket.sol
function placeBid(uint256 auctionId, InEuint32 calldata encryptedBid) external {
 require(state == AuctionState.ACTIVE, "Auction not active");
 require(block.timestamp < auctions[auctionId].endTime, "Expired");
 
 // Homomorphic solvency check: MEV bots cannot read balance or bid
 FHE.lte(encryptedBid, FHE.asEuint32(escrowBalances[msg.sender]));
 
 // O(1) Hash Storage: Zero value metadata exposed
 bytes32 bidHash = keccak256(abi.encode(encryptedBid));
 auctions[auctionId].ciphertextHashes.push(bidHash);
 
 emit BidPlaced(auctionId, msg.sender, bidHash);
}

3. Async Finalization & Block-Position Irrelevance

At endTime, the protocol emits an event and transitions to RESOLVING. No on-chain sorting occurs.

function triggerFinalize(uint256 auctionId) external {
 require(auctions[auctionId].state == AuctionState.ACTIVE);
 require(block.timestamp >= auctions[auctionId].endTime);
 
 auctions[auctionId].state = AuctionState.RESOLVING;
 emit DecryptionRequested(auctionId, auctions[auctionId].ciphertextHashes);
 // All comparative math is now off-chain. Block order is irrelevant.
}

MEV Neutralization Flow

️ Security Guarantees & Threat Mitigations

MEV Threat VectorTraditional ExploitationFhenix-FairMarket Mitigation
Front-RunningBot reads pending tx, submits higher bid instantlyPayload is opaque ciphertext; value cannot be parsed to construct counter-bid
Sandwich AttacksBot places bid before/after victim to manipulate price or extract liquidityHomomorphic FHE.lte verifies capacity without revealing balance or bid intent
Transaction ReorderingValidator inserts victim’s tx last to maximize extractor profitSealed-bid winner is value-determined, not time-determined. Reordering yields zero gain
Mempool ScrapingBots train ML models on historical bid patterns to predict future pricesEvents and Storage contain only bytes32 hashes; historical data is mathematically useless
Last-Second SnipingBots monitor highestBid and increment by minimal delta at endTime - 1shighestBid is never computed on-chain. All bids remain sealed until async FHEOS resolution

Architectural Impact

MetricTraditional On-Chain AuctionFhenix-FairMarket FHE Model
Mempool VisibilityFull plaintext bid & balance exposureOpaque InEuint32 + bytes32 hash only
Block Position ValueHigh (first/last placement dictates outcome)Zero (winner determined by encrypted value, not timestamp)
MEV Bot ProfitabilityConsistent revenue from reordering/snipingMathematically unprofitable (no readable data to exploit)
Validator IncentiveExtract value via transaction orderingProcess standard gas fees; no FHE advantage to manipulate
User TrustLow (requires monitoring MEV trackers)High (cryptographic blindness guarantees fair execution)

Audit Gate Compliance (P0)

The protocol enforces strict MEV resistance verification gates. Progression to subsequent phases is blocked until all P0 items pass:

  • [] Zero Plaintext in Mempool/Events: CI lint rules fail the build if any uint or bytes plaintext bid values are emitted alongside BidPlaced.
  • [] Homomorphic Solvency Enforcement: FHE.lte executes without decryption or balance leakage; invalid bids revert pre-dispatch.
  • [] State Transition Guard: Bids submitted after endTime or during RESOLVING revert instantly; no late-entry manipulation possible.
  • [] Ordering Independence Validated: Test suite confirms identical auction outcomes regardless of transaction submission order within the same block.
  • [] No On-Chain Sorting Logic: finalizeAuction() emits DecryptionRequested with zero FHE.gt/select execution, ensuring validators cannot influence comparative results.

Next Steps