3.1. Sealed-Bid Auctions
Traditional blockchain auctions operate in a state of forced transparency. Every transaction, including bid values and participant addresses, is broadcast in plaintext to the mempool before confirmation. This architectural flaw enables MEV front-running, bid sniping, and seller shill bidding, fundamentally corrupting market fairness.
Fhenix-FairMarket v2.0 replaces “trust in transparency” with “trust in cryptographic proof”. By implementing a Sealed-Bid architecture powered by Fully Homomorphic Encryption (FHE), the protocol ensures that bid values remain mathematically concealed from validators, node operators, and even the protocol developers until the exact moment of asynchronous settlement. All on-chain interactions are reduced to opaque ciphertext hashes, achieving O(1) gas complexity while preserving absolute economic privacy.
Core Cryptographic Principles
| Principle | Technical Implementation |
|---|---|
| Client-Side Encryption | Bids are encrypted locally via @cofhe/sdk ^1.2.0 before transmission. The plaintext value never enters the mempool, RPC layer, or node infrastructure. |
| O(1) On-Chain Storage | The contract accepts the ciphertext but persists only its bytes32 cryptographic hash in the ciphertextHashes mapping. Full FHE objects are never stored on-chain. |
| Encrypted Solvency Gate | FHE.lte(encryptedBid, escrowBalances[msg.sender]) validates financial capacity homomorphically. No balance or bid amount is exposed during verification. |
| Async Resolution Trigger | finalizeAuction() emits a DecryptionRequested event at endTime, delegating all comparative FHE math to off-chain FHEOS coprocessors. Zero on-chain computation occurs. |
| Event Log Neutrality | Zero plaintext bid values, intermediate states, or comparative results are emitted in Events. Only auctionId, bidder address, and cipherHash are logged. |
️ Technical Implementation
1. Client-Side Encryption Flow
The encryption process occurs entirely within the user’s secure execution environment (browser/extension) before any network call.
// packages/frontend/src/lib/cofhe/encryption.ts
import { cofheClient, Encryptable } from '@cofhe/sdk';
export async function encryptBid(amount: number): Promise<InEuint32> {
// 1. Range validation (euint32 max: 2^32 - 1)
if (amount < 0 || amount > 2 ** 32 - 1) {
throw new Error('Bid amount exceeds euint32 range');
}
// 2. Local encryption via CoFHE SDK
const encryptedPayload = await cofheClient.encryptInputs([
Encryptable.uint32(amount)
]);
return encryptedPayload[0]; // Returns InEuint32 Ciphertext
}2. On-Chain Submission & O(1) Hash Storage
The smart contract acts as a stateless cryptographic registry. It validates solvency, records the hash, and emits a neutral event.
// 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");
// Encrypted Solvency Check: Executes without decryption
FHE.lte(encryptedBid, FHE.asEuint32(escrowBalances[msg.sender]));
// O(1) Storage: Only cryptographic hash is persisted
bytes32 bidHash = keccak256(abi.encode(encryptedBid));
auctions[auctionId].ciphertextHashes.push(bidHash);
emit BidPlaced(auctionId, msg.sender, bidHash);
}Sealed-Bid Data Flow
️ Security & Privacy Guarantees
| Threat Vector | Traditional Auction | Fhenix Sealed-Bid Mechanism |
|---|---|---|
| MEV Front-Running | Bots read pending txs, outbid instantly | Payload is opaque ciphertext; value cannot be parsed by validators |
| Bid Sniping | Snipers wait to see current highest bid & increment | ”Current highest bid” is never computed or visible until endTime |
| Plaintext Leakage | Events/Storage expose bid history | Only bytes32 hashes stored; zero plaintext in logs or state |
| Gas-Based DoS | High FHE computation per bid blocks network | placeBid costs flat ~15k–25k gas; heavy math offloaded |
| Solvency Oracle Dependency | Requires external price feeds or plaintext checks | FHE.lte verifies capacity homomorphically without revealing balances |
Architectural Impact
- Market Fairness Restoration: Participants can bid their true maximum valuation without fear of strategic manipulation or information leakage.
- Linear Scalability: The
O(1)storage model decouples participant count from on-chain state bloat. Auctions can scale to thousands of bidders without triggering block gas limits. - Deterministic Finality Costs: By eliminating synchronous FHE comparisons, gas consumption becomes predictable and independent of bid volume or network congestion.
- Trustless Verification: The cryptographic hash registry provides an immutable audit trail. Post-audit verification is possible by cross-referencing off-chain FHEOS outputs against on-chain stored hashes.
Audit Gate Compliance (P0)
The protocol enforces strict sealed-bid verification gates. Progression to subsequent phases is blocked until all P0 items pass:
- [] Zero Plaintext in Events/Storage: CI lint rules fail the build if any
uintorbytesplaintext bid values are emitted alongsideBidPlaced. - []
FHE.lteSolvency Check: Encrypted bids strictly cannot exceedescrowBalances[msg.sender]; invalid bids revert pre-dispatch. - [] Adapter Isolation: Zero direct
import @fhenixprotocol/cofhe-contractsin core logic; all FHE calls route throughICofheAdapter. - [] O(1) Gas Enforcement:
hardhat-gas-reporterconfirmsplaceBid()consumes< 25kgas across varying participant counts (1 → 1,000). - [] State Transition Guard: Bids submitted after
endTimeor duringRESOLVING/FINALIZEDstates revert instantly with"Expired"or"Invalid state".
Next Steps
- Proceed to 3.2. Vickrey Price Sharing to understand how off-chain FHE comparison enables encrypted second-price settlement.
- Review 3.3. MEV Front-Running Protection for mempool opacity and transaction ordering neutralization.
- Explore Technical Components → CofheAdapter.sol for SDK abstraction layers and homomorphic function wrappers.