A Uniswap V4 hook that encrypts your swap parameters using Fhenix FHE so MEV bots can't front-run you.
Every time you make a trade on a DEX, bots can see it before it executes. They jump ahead of you, move the price, and you end up paying more. This is called front-running, and it costs traders hundreds of millions of dollars every year. In 2025 alone, sandwich attacks hit $289 million across Ethereum.
The root cause is simple: your trade is visible in the mempool before it goes through.
FhenRoute sits between you and Uniswap. When you submit a swap, FhenRoute encrypts your trade details using Fully Homomorphic Encryption (FHE) before they ever touch the mempool. Bots see encrypted gibberish instead of your actual trade. The swap still executes normally through Uniswap V4, but nobody can extract value from you because they can't read what you're doing.
Think of it like whispering your order to the cashier instead of shouting it in a crowded room.
- You connect your wallet and pick a token pair
- You enter how much you want to swap
- FhenRoute encrypts your trade amount client-side using Fhenix cofhejs
- The encrypted intent gets submitted to the FhenRoute hook contract on Uniswap V4
- Fhenix CoFHE coprocessor processes the encrypted data off-chain
- The swap executes through Uniswap with your parameters protected until the moment of execution
- Bots never see your trade details. You get a fair price.
- Smart Contracts: Solidity 0.8.20+, Foundry
- FHE Layer: Fhenix CoFHE (
@fhenixprotocol/cofhe-contracts/FHE.sol) - DEX Integration: Uniswap V4 Hooks (beforeSwap)
- Client SDK: cofhejs for client-side encryption
- Frontend: React
- Testnet: Arbitrum Sepolia (CoFHE is live here)
Trader (Frontend)
│
│ encrypts swap params using cofhejs
▼
FhenRoute Hook Contract (Uniswap V4 beforeSwap)
│
│ stores encrypted intent, validates via FHE operations
▼
Fhenix CoFHE Coprocessor (off-chain)
│
│ processes encrypted computation, returns results
▼
Uniswap V4 Pool Manager
│
│ swap executes, trader gets fair price
▼
Done. Bots saw nothing.
There are other projects working on encrypted trading. AlphaEngine by Fhenix is a full infrastructure stack using CoFHE + EigenLayer AVS + multichain settlement. The Iceberg hook does encrypted limit orders.
FhenRoute is intentionally simpler. It focuses on one thing: encrypting regular swaps so everyday traders stop losing money to bots. No complex operator networks, no multichain routing. Just plug in, encrypt, swap.
This project is being built for the Fhenix Wave Hack buildathon.
Current phase: Ideation and architecture (Wave 1)
Wave 1 (now): Concept, architecture, this README
Wave 2: Core hook contract that accepts encrypted swap amounts via InEuint128, validates using FHE operations, and hooks into Uniswap V4 beforeSwap. Basic React frontend with wallet connect and encrypted swap submission. Deploy to Arbitrum Sepolia.
Wave 3: Encrypted slippage protection, multiple pending swaps with FIFO ordering, and a basic display showing how much value was protected per swap.
# Clone
git clone https://github.com/designsheva/FhenRoute.git
cd FhenRoute
# Install Foundry (stable build)
curl -L https://foundry.paradigm.xyz | bash
foundryup
# Install deps
forge install
# Build
forge build
# Test with mock FHE contracts
forge test- Fhenix CoFHE Docs
- FHE Hook Template (our starting point)
- Iceberg Hook (closest reference implementation)
- Uniswap V4 Hooks
- cofhejs SDK
Built by a small team for the Fhenix Wave Hack.
MIT