project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

Fugazi

Fugazi is the first fully on-chain dark pool built on Fhenix.

Fugazi

Created At

ETHOnline 2024

Winner of

Fhenix - Best use of Fhenix Stack 1st place

Project Description

Fugazi is AMM-based dark pool. It leverages following three arms to hide order info (size and direction):

  1. Encrypted reserves and order info via FHE
  2. Batch execution
  3. Noise order

Unlike many other implementations of dark pool, Fugazi does not require any oracle or centralized operators and every action related to trading (pool creation, LPing, swap) is completely permissionless.

Except that users have to wait for a while after each submisson of order (due to the batching and heavy computational load), the UX Fugazi offers is almost as same as that of AMMs like Uniswap, Curve, Balancer, etc etc.

How it's Made

For the contract side:

To hide the order info, just slapping encryption is not enough, since attacker can notice the trader's intent by sandwiching it. So common practice is batching trades. Another way of hiding order information is proposed last year; that is, protocol-owned account submits randomized orders along the trader's order together so that the attacker can only know about the aggregated order (trader + random). The protocol takes an additional fee (separate from the swap fee) for providing privacy.

We decided to implement both of them. The final output is AMM-based dex, like uniswap, curve, and balancer, while each order is batched together with randomized order submitted by protocol-owned account. As we mentioned, now everything (user balance, pool reserves, order info, etc etc) is encrypted via fully homomorphic encryption. We believe it is still okay to encrypt pool reserves and hide the information about spot price: arbitrageurs will anyway get (maybe noisy) info about pool price and will set the price close to EBBO (Ethereum Best Bid & Offer).

Moreover, our exchange does not rely on any single centralized external players or resources, resulting in supporting permissionless pool creation.

For the frontend side we used following:

  1. Vite: Provides a fast build and development server. The module hot replacement (HMR) feature allows real-time reflection of changes during development, enhancing development efficiency.
  2. React: Offers a component-based architecture for efficiently structuring the UI, making state management and lifecycle management easier. Reusable components improve code maintainability.
  3. twin.macro: A library that allows the use of Tailwind CSS utility classes within JavaScript/TypeScript files. It combines the advantages of CSS-in-JS with the flexibility of Tailwind, simplifying styling.
  4. Tailwind CSS: A utility-first CSS framework that enables fast and intuitive styling. By applying styles through class-based utilities, it enhances code readability and maintains style consistency.
  5. ethers.js: A lightweight library for interacting with the Ethereum blockchain. It simplifies communication with smart contracts and transaction management, making it suitable for blockchain application development.
background image mobile

Join the mailing list

Get the latest news and updates