Created on 2nd March 2024
•
In the traditional finance world, users expect their transactions to remain private, think Veno, bank transfers, forex, etc. Our project introduces a new privacy primitive to the DeFi ecosystem. It allows users to swap tokens without revealing the transaction amounts. By encrypting these amounts, we also ensure that validators cannot profitably front-run transactions, preserving the integrity and fairness of the trading environment.
Creating an exchange with private reserves presented unique challenges. A token's price is typically derived from the ratio of reserves between tokenA and tokenB, which means revealing the price could inadvertently disclose information about the reserves. To address this, we adopted a strategy that involves dealing with ratios when accessing reserve information. As a result, the only potential information leakage pertains to the ratio itself, rather than the actual reserve amounts. While its possible there still might be some data leakage about the reserves given certain circumstances, This method better ensures the confidentiality of reserve quantities.
The encryption library we uses introduced new Solidity data types specifically designed for encrypted integers and booleans. However, these new types come with computational limitations that become more pronounced as their size increases. The largest data type we could efficiently use was euint16, as euint32 proved to be computationally prohibitive and could exceed the block size limit, making some functions too large to execute within a single block. A more production-grade dex would require larger encrypted integer values to properly handle the math needed and mitigate underflow and overflow errors.
Tracks Applied (2)
Fhenix
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.