Fast Fairy Series: Programmable Privacy in DeFi

Fairblock Network ✨
8 min readFeb 23, 2024

--

Decentralized finance is a radically new and distinct means of conducting financial activities. It enables far more peer-to-peer interactions and cuts out various forms of financial intermediaries in favor of code, so users don’t have to hand the reins to corporate institutions to facilitate trades of assets, borrow money, and so on.

Such a novel infrastructure for finance has required building from the ground up, and there remains plenty of room for refinement in these systems. Notably, using DeFi continues to be a shockingly public activity. In contrast to the traditional financial world where people are afforded privacy when they make trades, take out loans, etc., in DeFi this norm of privacy has not yet been implemented in most applications.

Fairblock is here to make privacy a standard, not a luxury, throughout the space and to give users a more comfortable and more protected experience. The reality is that privacy is a basic and fundamental element of well-functioning financial mechanisms, not something primarily used for conducting covert activities or hiding from authorities. In fact, it’s complementary to the transparency that’s needed to stop criminal activity. Here’s how Fairblock’s encryption tools usher in a much-needed upgrade to DeFi.

Protecting Order Flow

DeFi users deserve protection against malicious actors. Publicly visible order flow exposes users’ trades to being front run or sandwiched, among other strategies that bleed value from users and have them suffer worse trade execution through manipulated prices.

In order to mitigate this maximal extractable value (MEV) that’s being leached from DeFi users, Fairblock enables the encryption of blockchain transactions, which means order flow is private. At launch, Fairblock will offer identity-based encryption (IBE) of transactions, a kind of cryptography that allows for encrypting transactions prior to their being broadcast to a blockchain network and decrypting them for execution after they’ve already been included in blocks.

Some financial actors may want even greater privacy than just order flow protection. Sophisticated traders, for instance, may wish to keep their trading strategies private. To make this possible, we’re working on an implementation of fully-homomorphic encryption (FHE) that will enable transactions to remain encrypted even as their contents are executed. For a deeper dive into Fairblock’s cryptography toolkit, including IBE, FHE, and witness encryption, check out our previous blog post.

A Powerful Primitive for Limit Orders

A particularly sensitive kind of order flow is limit orders. While in traditional finance regulations make it illegal to manipulate order flow, we have the opportunity in DeFi to take technological approaches to protecting order flow. Limit orders beg for privacy in order to not be subjected to malicious strategies. Implementing this functionality on decentralized exchanges has proven challenging for a number of reasons, but Fairblock is providing on-chain solutions to allow DEXes on any chain to incorporate these protections.

Fairblock not only makes implementing private limit orders straightforward, but it also allows for the entire paradigm of limit orders to be expanded. With conditional decryption, a traditional limit order can be submitted as an encrypted transaction, and it will only be decrypted and executed when the limit price of the target asset is reached. However, the conditions for trade orders can be more complex as well. A trade could be conditioned on any variety of market conditions–when the total value locked in a protocol reaches a certain level, when the volume of assets bridged into or out of a particular chain breaks a set threshold, and you can imagine many more.

Conditional Decryption for Embedded DeFi

Today many of the leading DeFi applications are for trading, lending, and borrowing, but finance is embedded in a wide variety of apps that can be built on blockchains and encompasses a wider variety of activities. For instance, decentralized financial rails can support prediction markets, such as sports or political betting. In this context, one use for Fairblock can be for programmatically releasing winnings when bets hit. In such a system, when a bet is placed, an encrypted transaction with the instructions to send winnings to the user is generated, and only if the winning conditions for the bet arise will that transaction be decrypted and the assets be transferred.

A similar concept can be applied for enabling on-chain escrow contracts. When the conditions for the contract are fulfilled, an encrypted transaction to transfer escrowed assets to the party fulfilling the contract will automatically decrypt. And in other legal arrangements, an encrypted contract could be posted on-chain. If either party violates the contract, the other party could decrypt all or part of the contract and trigger the decryption of another transaction that effectuates the agreed-upon recourse.

Privacy and Transparency are Complementary

Fairblock’s flexible privacy tools allow for the best-of-both-worlds, where users have optimal experiences and the financial activities in DeFi don’t become a black box.

Using IBE, DeFi applications are able to offer users strong safeguards against malicious MEV and also reveal their trades when they’re executed. This strikes a balance where there’s both privacy protections in the critical period leading up to execution and public visibility into completed trades.

With FHE, more creative approaches must be taken to allow for transparency into trades, but there’s also the opportunity to restrict who is able to view them. One model that’s being explored by our friends at Zama is to store encrypted KYC (Know Your Customer) information like date of birth and citizenship on-chain as well as a set of rules, which could be managed by regulatory bodies. With these pieces in place, trades could be verified as to who is submitting them and checked for compliance with applicable regulations before being executed–and all of this is accomplished privately.

Customizability is what makes Fairblock such an elegant solution for DeFi applications and users. In stark contrast to methods like routing assets through a dark pool in order to achieve a measure of financial privacy, Fairblock allows applications to offer users a range of privacy protections tailored to different users’ needs. And it does so without compromising on the transparency that’s essential for authorities to verify compliance with regulations.

Intents are Order Flow Too. Fairblock Can Protect Them

The cutting edge of DeFi user experiences are intents, and we want to help with making these systems as user-friendly as possible. Intents allow apps to simplify user interactions by allowing them to simply express a desired outcome and have it accomplished without needing to provide all of the specifics on the steps to achieving their aims. In DeFi, intent-based systems can deliver better counterparty matching and price discovery to improve trading experiences.

So long as intents are public, however, they’re susceptible to harmful MEV strategies similar to what we see in public transaction-based DeFi today. Because of this, there are many teams exploring ways to incorporate privacy into intent-based systems, so that users’ intents are not broadcast for all the world to see and additionally so that the process of matching intents and solvers doesn’t expose users’ intents.

Fairblock is well-suited to addressing these issues. For instance, a decentralized exchange could selectively decrypt the contents of an intent, revealing the price a user desires for a trade to a matching solver willing to fill trades at that price but not the volume of their trade until the final moment before the trade is executed. Thus, the user retains protection against attacks like sandwiching because the would-be attacker doesn’t know what the price impact of the trade will be in advance.

Other possibilities include leveraging Fairblock’s conditional decryption capabilities to only match intents with solvers matching certain criteria. As an example, intents for trades could be restricted, so they’re only ever matched with and revealed to solvers that have not interacted with MEV extraction relayers.

Auctions Need Privacy and Decentralization

Auctions are proliferating in DeFi as a means of promoting decentralization, from matching intents with solvers to granting access to order flow. As designed and implemented today, however, these systems come with the significant drawback of introducing more trust assumptions. In particular, these auctions are being conducted by centralized third-parties who have the power to manipulate the auctions.

Research shows that introducing privacy into the auction process eliminates nearly all of the potential for auctioneers to compromise the integrity of auctions. Fairblock provides this privacy in a decentralized and programmable manner, making it the ideal solution.

Today, a significant portion of on-chain transactions are first passing through Flashbots’ off-chain MEV-Share orderflow auction system. MEV-Share has been successful in mitigating a large amount of MEV by concealing transaction information. And its thoughtful design even allows for selectively exposing certain information within transactions — such as revealing the trading pair but not the trade amount or direction — which can help optimize block building in a way that results in better execution for users. Still, it’s a centralized system that requires trust in Flashbots.

The need for decentralizing MEV auctions has garnered significant attention. Mike Neuder and Justin Drake have proposed enshrining MEV auctions on-chain in Ethereum, while dYdX has presented research on mitigating MEV through an on-chain auction model that involves collaborative block building and batching of orders into multiple auctions per block. In the Cosmos ecosystem, Skip has implemented the Protocol Owned Builder, an on-chain orderflow auction that is allowing chains like Osmosis to recapture MEV.

On-chain orderflow auctions like these can be improved by harnessing the benefits of decentralized programmable privacy. With Fairblock, these auctions can be implemented in a trust-minimized sealed-bid fashion which introduces improvements in multiple settings. Sealed-bid auctions address the asymmetrical information access that results from public bids being submitted one after another, including resulting challenges such as the last look problem. They also promote more fair and decentralized competition, providing a better alternative to the current MEV-Boost auctions, in which a market structure has emerged with high barriers to new participants. Additionally, Fairblock’s programmable privacy may even enhance the UX by removing the need for collateral (as seen in models such as this one) and speeding the auction process by eliminating the need for multiple communication rounds. And finally, Fairblock’s flexible encryption tools allow for tailoring information leakage to support better execution.

Beyond these kinds of MEV order flow auctions, intent-based systems are also a growing area in which auctions are playing a significant role. The Uniswap X whitepaper, for instance, details a dutch auction system in which fillers compete to fill swaps. Dutch auctions also appear in DeFi applications like Inter Protocol, where they’re used for liquidations, and Sommelier, where they’re used to convert vault fees into SOMM tokens for distribution to stakers. In all of these cases, substituting first-price sealed-bid auctions makes for a more decentralized system that’s faster and enables better price discovery.

Over the coming months, we’re excited to unveil some of the first DeFi integrations of Fairblock. Be sure to give us a follow on Twitter to be the first to hear about them, and if you’re a DeFi builder looking to improve UX, reach out to us. We’d love to chat!

About Fairblock

Fairblock is the modular ecosystem of privacy-enabled infrastructure and applications. Fairblock’s programmable privacy unlocks a wide range of applications as well as protecting users from malicious actors. It provides builders in any blockchain ecosystem with an array of cryptographic tools that are purpose-built for a variety of use-cases. With Fairblock, blockchain transactions are protected against manipulative strategies, and new kinds of applications and utilities are unlocked, such as private governance, sealed-bid auctions, bad-MEV and censorship-resistant rollup sequencing, verifiable randomness, and even on-chain gaming.

--

--

Fairblock Network ✨

The modular ecosystem of privacy-enabled infrastructure and applications.