FairyCoW: Encrypted Orders for CoW Swap

FairyCoW: Encrypted Orders for CoW Swap

Privacy is a fundamental element of our daily lives. From financial decisions to personal healthcare data and voting behavior, maintaining privacy is a critical and necessary component of any meaningful interaction. 

When we share our pharmacy data with a healthcare provider or our bank records with a mortgage lender, for instance, we expect and require that this data remains confidential between the intended parties. Yet despite its prevalence within our everyday activities, privacy has largely escaped enshrinement within blockchains. Most users, knowingly or not, simply conduct their on-chain activities without the same safeguards afforded by legacy systems. 

In fact, the contents of blockchain transactions are publicly observable by default before, during, and after execution. One of the most powerful aspects of a distributed ledger is that effectively anyone with access to the internet can connect to the network and perform a transaction without the need for a middle party. Once the transaction is accepted and pushed to the network, it remains there, fully transparent and auditable, as an immutable part of the chain’s history. The caveat, however, is that these transactions are public for all to see. Among the audience are malicious actors who have significant financial incentives to continuously monitor the chain and take advantage of information symmetry or collect data about users and their preferences, which will grow more problematic as more consumer applications come on-chain. This leaves the contemporary blockchain user experience considerably vulnerable as spying eyes effectively know the end of a story before it’s told. In most cases, this information asymmetry makes it unlikely the less sophisticated user will achieve their desired results or remain protected in a trade, in-game decision, auction, or block.

As the desired infrastructure is built, next-generation applications emerge and new users – both individual and institutional – arrive. Users are becoming more sophisticated, transaction volumes are growing exponentially, and the stakes are higher than ever as trillions of dollars will soon be actively settled on-chain. On the other side of this, however, malicious actors are hyper-incentivized to be more relentless than ever as they tirelessly scour mempools, hunt wallets, and wait for opportunistic transactions. It’s an adversarial game. The actor with asymmetric information wins. 

Problem

The problem with existing approaches to on-chain encryption is that they are mainly one-size-fits-all and confined to an isolated chain or non-compliant application. This isolation of today’s encryption solutions is because of three issues: (1) the large cryptographic and infrastructure overhead required to host encryption on-chain (2) misaligned incentives to build another L1 versus building encryption-enabled applications on existing chains, and (3) functionality limitations of legacy VMs. The large overhead of on-chain encryption solutions is the biggest roadblock because high costs deter most existing blockchains from implementing them. Thus, information flow control is not available in major ecosystems; if users want encryption, they are instead required to bridge elsewhere or use dedicated encrypted applications they aren’t comfortable with. The end result is a landscape that recognizes the need for on-chain encryption but continues to fail in finding product-market fit for it, for users and developers alike.

The demand is here. Today, we witness a significant portion of Ethereum transactions being routed through centralized pathways to achieve private order flow. This signals that users are willing to go to great lengths, pay a nontrivial fee, and forfeit a degree of autonomy in order to find some level of protection from malicious actors. But centralized orderflow is a just short-term solution that only benefits DeFi-related use cases, not the broader demand for on-chain disclosure control. As the desire for encryption on-chain grows, networks, applications, and developers alike will need to answer the call with more fitting and lightweight solutions.

We can no longer afford for expensive overhead to stand in the way of universal user protection on-chain.

Solution

Lightweight encryption solutions that are plug-in, programmable, and all-inclusive are needed to make encryption a standard on-chain. Lightweight encryption plug-ins unlock the application design space in major ecosystems where developers and users already exist; these can be applied across on-chain intents, AI and ML applications, gaming, MEV prevention, sealed-bid and leaderless auctions, censorship-resistant shared sequencing, governance, and much more. Empowering users with the autonomy to pick and choose the contents they wish to disclose without leaving their favorite applications will soon become a baseline requirement throughout the industry.

Meet Fairblock

Fairblock is an encryption coprocessor that abstracts away the cryptography and infrastructure needed to host on-chain encryption and delivers it to users and developers in their preferred environments. This plug-in approach allows blockchains to incorporate multiple cryptographic primitives such as identity-based encryption (IBE), fully homomorphic encryption (FHE), and ZK for the purposes of conditional decryption, ZK proof verification, and re-encryption, all in one integration. 

Fairblock’s all-inclusive approach to cryptographic availability can be used to meet a wide variety of needs within confidential and verifiable computation across every blockchain rather than the rigid approaches to applied cryptography we see on-chain today. Delivering universal access to multiple cryptographic infrastructures gives users and developers the freedom to choose their desired encryption path when interacting on-chain or building apps. 

Encryption coprocessing allows users to protect their transactions and execute them in their favorite environments without the dangers of symmetric information access. Fairblock equips every blockchain and application with programmable encryption in a highly customizable and seamless manner. 

A Deep Dive into Fairblock

Fairblock’s product suite is composed of three core elements: FairyRing, FairyKit, and FairyPort. 

  • FairyRing is a service provider chain that provides encryption, zero knowledge proof verification, and re-encryption to any blockchain and application.
  • FairyKit is a chain-agnostic SDK that enables any network to receive, decrypt, and execute encrypted transactions. 
  • FairyPort is a cross-chain message passing protocol that manages the delivery of cryptographic packets and keys to chains and apps that request them.

Two core advantages of Fairblock’s encryption solution are its composability and the security it guarantees from operating fully on-chain. FairyRing and FairyKit serve as the building blocks for encryption to be delivered to every user on any blockchain and application. These solutions can be directly plugged into several layers of a decentralized network, from frontends and smart contracts to L1s, L2s, sequencers, full nodes, and wallets.

Using the visual example below, we can observe how Fairblock can be utilized to provide encryption to applications. This process begins by integrating the FairyKit SDK into an application’s frontend. From here, a user can interact with the frontend to initiate an encrypted transaction. The developer and user can declare specific conditions for the decryption of transactions, such as a block height, price of an asset, when a ZKP is verified, or at the conclusion of a voting period. Once these parameters have been set, the user’s encrypted transaction is submitted to reside in the mempool in the host blockchain.

 Once the decryption conditions are met, FairyRing validators are notified and generate their private key shares to construct a threshold decryption key. This decryption key is then delivered to the destination chain via FairyPort. Finally, the sequencer commits the encrypted transaction in a block and then uses the decryption key to decrypt and execute the transaction.

This approach serves as a substantial improvement to current encryption infrastructure and gives developers the freedom to choose when, where, and how to implement encryption into decentralized applications. Making encryption available in every blockchain is a significant step towards creating the safe and secure user experience required for mainstream blockchain adoption.

FairyCoW Swap

Given the power of plug–in encryption that Fairblock unlocks, we used this tooling internally to build FairyCoW Swap, an auxiliary application for CoW Swap that leverages and demonstrates Fairblock’s modular programmable privacy.

For our first feature, users can now set time-lock encrypted CoW Swap limit orders. No additional work is required on the user's behalf: simply set when you want a limit order to decrypt and become public, and the FairyCoW Swap takes care of the rest. During this process, user orders are never exposed to anyone (even Fairblock) until it is time to decrypt. 

How FairyCoW Swap Works

At a high level, a user will sign a FairyCoW Swap limit order with a designated block height to decrypt the transaction. The order is automatically encrypted on the client and directly submitted to the Fairyring, where it resides until the block height is met. Once the required block height is reached, the encrypted order is automatically decrypted. In FairyCoW specifically, the CoW swap limit order intent is signed by the user, encrypted client-side (so the limit order is never exposed to any third party service), and the encrypted transaction is submitted to Fairychain (Testnet). At a given target block height, the order is decrypted autonomously by Fairychain. From there, a FairyCoW Swap relayer watching blocks for decrypted events takes any newly decrypted orders and routes them to both the public orderbook and any available solvers.

Users could potentially queue up several encrypted limit orders to DCA ETH over a given time period. These limit orders only reveal the relevant DCA order when it is time to fill, so there is no more unnecessarily resting limit order liquidity. 

This is just a glimpse of the early framework and feature set for FairyCoW Swap. As more Fairblock programmable encryption functionality becomes available, we will add additional intent encryption functionality like decryption triggers on prices of certain assets, programmable orderflow, and other important trading conditions. We aim to use FairyCow Swap as an intent-based demonstration environment of what can be built with Fairblock's modular privacy coprocessor on top of the EVM.

FairyCoW Repo

Applications We’re Excited For

Fairblock fits into multiple categories of applications, inclusive of DeFi, gaming and NFTs, infrastructure, and soon AI and ML applications. For each of these sectors, we will list several applications made possible with Fairblock and then elaborate on one that we’re most excited about.

DeFi

Programmable encryption enables frontrunning protection, encrypted limit orders, programmable execution, and leaderless shill-proof and mev-resistant auctions for DeFi applications. Each of these applications greatly enhances the DeFi user experience, such that users don’t have to worry about being frontrun (in trading or in auctions), sandwiched, or having their trading strategies exposed.

Gaming & NFTS

Programmable encryption is the missing piece to many on-chain gaming applications, such as poker and other casino games, in-game actions, sealed bid auctions in NFT marketplaces, and NFTs with surprise elements encoded. Encryption strengthens the neutrality of on-chain games by protecting sensitive information and embedding randomness factors that are essential in the functionality of these applications.

Infrastructure

Encryption plugs into several layers of the blockchain infrastructure stack to power encrypted shared sequencers, encrypted transaction lanes for L1s using EigenLayer, mempools, L2 full nodes, MEV infrastructures, smart contracts, and wallets. The high composability of Fairblock’s products allows encryption to fit into critical paths of blockchain user experiences, such that encryption can be incorporated into any chain or application no matter what stage of development it is in.

In the Future: On-chain AI & ML, Institutional Finance & Healthcare

Confidentiality is a core component of on-chain AI and ML applications, such that users can maintain control of their sensitive data in the age of AI agents and the emergent on-chain consumer economy and access to ML models can be gated by cryptographic keys.

In the institutional landscape, programmable encryption will protect the trading strategies of asset managers and the net worth of their clientele, similar to the privacy that exists in the finance world today. Similarly, blockchains will soon be core to data management in the healthcare sector, and encryption will be critical to ensuring that patient information is only accessible to individuals and their care providers.

About Us

Anagram is a modern institution for a novel technology.

If you are working on interesting technology in the privacy domain we encourage you to apply here for the Anagram EIR program where alongside the Anagram team you will be able to test your thesis, build a company and tackle the biggest possible problems. Feel free to contribute or ask any questions.

Learn more about Fairblock:

Fairblock twitter

Fairblock Network

Learn more about Anagram:

anagram.xyz

twitter (x.com)

blog

Become an EIR