Skip to content
Fhe-Pred

Fhe-Pred

Encrypted Prediction Market

Created on 4th December 2025

Fhe-Pred

Fhe-Pred

Encrypted Prediction Market

The problem Fhe-Pred solves

Private Prediction Markets Using Fhenix FHE

Problem

Traditional prediction markets expose all user activity publicly:

  • who placed a bet
  • which side they chose (YES/NO)
  • how much money they staked

This leads to:

  • zero privacy,
  • easy manipulation,
  • unsuitable markets for sensitive questions.

A private prediction market must hide individual bets without breaking fair settlement or payouts.


Solution

We designed a privacy-preserving prediction market using Fhenix's Fully Homomorphic Encryption (FHE) through

cofhejs

.

Our system keeps the market itself public, but all user bets remain encrypted.

What stays public

  • Market question & close time
  • Fees and creator info
  • User deposit balances
  • Total escrow available

What stays private

  • Individual stake amounts
  • Whether a user bet YES or NO
  • Each user’s payout amount

How it works

  1. Users deposit funds publicly into the contract.
  2. When placing a bet, users submit:
    • encrypted stake
    • encrypted outcome (YES/NO)
    • a binding signature to link encrypted data to escrowed funds
  3. The contract updates encrypted totals using on-chain FHE operations.
  4. After the market closes, an authorized FHE worker:
    • processes all encrypted bets,
    • computes payouts homomorphically,
    • submits encrypted payout results to the contract.
  5. Users decrypt their own payout privately and withdraw from escrow.

This ensures fair settlement without revealing who bet what.


How We Use Fhenix

We leverage Fhenix FHE in three key stages:

1. Encrypting User Inputs

  • the amount they are betting
  • their YES/NO choice

The contract receives only ciphertexts.

2. Homomorphic On-Chain Computation

The contract uses:

  • euint64

    encrypted types
  • FHE operations to update encrypted totals like:
  • total pool
  • total YES stake

All without ever seeing the underlying numbers.

3. Encrypted Outputs + Private User Decryption

The FHE worker submits encrypted payouts.
Users retrieve their own encrypted payout and call:

Challenges I ran into

🔧 Challenges We Faced

1. Keeping real-money bets private

Blockchain transactions are public, so hiding how much a user actually bet is difficult.
Solution: Users deposit funds publicly, but the actual bet amounts they place are encrypted using Fhenix FHE.
This keeps economic value real while preserving stake privacy.


2. Ensuring encrypted stakes correspond to actual escrow

A malicious user could encrypt a fake value while only escrowing a small amount.
Solution: Each bettor signs a binding signature that links:

  • the encrypted stake ciphertext
  • the public escrowed amount

This prevents mismatches without revealing the encrypted value.


3. Computing payouts under encryption

Payout formulas involve division and selecting winners, which are expensive or impractical to run purely under FHE.
Solution: A hybrid settlement model:

  • encrypted totals are computed homomorphically,
  • only the aggregate totals are selectively decrypted by the FHE worker,
  • per-user payouts are then computed homomorphically using these values.

This approach keeps individual bets private while making settlement practical.


4. Identifying winning bets without revealing bet choices

We must decide who won, but decrypting outcome bits would reveal each user’s side.
Solution: Use an encrypted winning bit, and compute

encryptedOutcome * encryptedWinningBit

homomorphically
so the FHE can determine winners without ever seeing choices.


5. Enforcing secure and private withdrawals

Users must claim rewards without revealing their identity or bet details.
Solution: Each bet has a hidden payoutCommit and the user generates an ephemeral payout key.
Withdrawals are authorized by signatures from this private key, ensuring unlinkability.


Tracks Applied (1)

Creative Privacy Applications

I have created the prediction market with full encryption

Fhenix

Cheer Project

Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.

Discussion

Builders also viewed

See more projects on Devfolio