Skip to content

Decentralized Dark Pools, implemented using Zama's fhEVM & fhenix

Notifications You must be signed in to change notification settings

omurovec/fhe-darkpools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FHE Dark Pools

This is a hackathon project for the ethcc6 Fhenix & ZAMA hackathon.

This project is an effort to recreate Dark Pools in a decentralized form. Dark Pools are a popular offering in tradfi where parties can create buy or sell orders without revealing the size or price of their order. This is very beneficial for large trades which would drastically impact the market causing an unsatisfactory execution price or otherwise suffer from high frequency trading.

As far as I know, Dark pools are not possible within the contraints of the EVM since there is no way to obfuscate the order size or price while allowing buy & sell orders to be matched with eachother unless there is a singular party who can see the orders.

With FHE, we can encrypt the order size & price while still allowing solvers/market makers to match orders. Using FHE, solvers can watch new orders and check for orders with equal prices then fill those orders.

⚠️ Note: When I originally wrote this code I had thought that a plaintext boolean value was achievable when using fhe comparison operations off-chain, however all that is retrievable is the cyphertext. In order to get the plaintext, you would require the validator set to collectively decrypt the cyphertext. This makes it impossible to run solvers off-chain and therefore any orders placed through the contract cannot be filled with this implementation.

This repo only contains the contracts for the dark pools. Given more time, I would build out a front-end and solvers to match the orders.

Setup

1. Start local network

docker run -it -p 8545:8545 -p 6000:6000 \
  --name localfhenix ghcr.io/fhenixprotocol/fhenix-devnet:0.1.6

2. Grab funds from faucet

curl "http://localhost:6000/faucet?address=${ADDRESS}"

Notes

  • Tests don't seem to be working properly, could be due to the TFHE lib or I could be dumb 🫠🤷

About

Decentralized Dark Pools, implemented using Zama's fhEVM & fhenix

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published