Sitemap
Chaisomsri

Chaisomsri

Fullstack | Blockchain Engineer

Unlocking Encrypted Mempools (1): Genesis & Blueprint

12 min readFeb 22, 2024

--

Press enter or click to view image in full size

Series

  • Unlocking Encrypted Mempools (1): Genesis & Blueprint
  • Deciphering Encrypted Mempools (2): Project Insights

Table of Contents

  1. What is an Encrypted Mempool?
  2. The Background of Encrypted Mempools
  • Public Mempool
  • Private Mempool
  • What is Censorship?
  • What is MEV (Maximal Extractable Value)?

3. Methodologies for Implementing Encrypted Mempools

  • TEE (Trusted Execution Environment)
  • Threshold Encryption/Decryption
  • Time-lock Puzzle

4. Summary of the Implementation Methodologies for Encrypted Mempools

1. What is an Encrypted Mempool?

An encrypted mempool is a type of mempool where transactions in the Pending Transaction pool are waiting in an encrypted form. Once these encrypted transactions are placed on the block and their execution order is determined, the transaction contents undergo decryption and are executed, ultimately resulting in the completion of the block. In other words, transactions are encrypted, making it difficult to exploit MEV (Maximal Extractable Value) and conduct censorship, leading to a more secure mempool structure.

Press enter or click to view image in full size

The primary advantages of encrypted mempools include protection of transaction details and prevention of transaction manipulation.

1)Protection of Transaction Details
Encrypted mempools prevent the contents of transactions from being disclosed until they are committed and placed on the block. This means that transactions cannot be preemptively copied or censored, thus negating any negative impact on users.

This enhances network participants’ privacy and strengthens user trust. It also prevents situations where transactions could be interfered with by identifying wallet addresses and transaction contents.

2)Prevention of Transaction Manipulation
The characteristic of users’ transactions not being disclosed in advance can prevent malicious MEV activities, such as Non-Broadcast Transactions, thereby proactively safeguarding against them.

However, encrypted mempools come with their disadvantages. The main drawbacks can be summarized into three categories: performance degradation, increased implementation difficulty, and compatibility issues with existing systems.

1)Performance Degradation and Increased Computing Resources, Reduced Network Efficiency
Encrypted mempools add encryption and decryption processes to the traditional block creation process. These processes increase computing resources, leading to longer transaction processing times, which could reduce network efficiency.

2)Increased Implementation Difficulty
Correctly implementing and managing encryption technology requires a high level of technical expertise. Efforts are actively being made to implement encrypted mempools at both the hardware and software levels. This will be discussed further in the implementation methodology section.

3)Compatibility Issues with Existing Systems
The encryption/decryption process may potentially conflict with existing blockchain networks, so interoperability must be considered.

What then necessitated the development of encrypted mempools?

2. The Background of Encrypted Mempools

Public Mempool

When we initiate transactions from our wallets, be it swapping on a DEX, transferring virtual assets, or when a smart contract is executed, all these transaction records ascend to the public mempool. This public mempool serves as a virtual space where unprocessed transactions float, accessible for inspection by all network participants. It is open to all, allowing anyone to check the status and details of pending transactions. This transparency enables users to track the status of their transactions while waiting for processing or to adjust transaction fees if necessary. Transactions here refer to the records of transferring virtual assets between participants, representing the smallest indivisible unit of business processing.

Services exist to explore and query information on the Ethereum blockchain, such as blocks, transactions, and smart contracts, with Etherscan being a prime example. Etherscan provides visibility into the status and history of transactions within the Ethereum network, enabling users to search and analyze specific addresses, transactions, blocks, and smart contracts.

On Etherscan, one can view transactions that have been committed and placed on a block (Transactions) as well as those still pending and awaiting commitment (Pending Transactions). One of the blockchain technology’s hallmarks, transparency, means that transactions are open to all. However, this transparency can sometimes adversely affect the blockchain ecosystem’s users.

Malicious MEV (Maximal Extractable Value) and censorship are prime examples of activities that can lead to financial losses. While some may consider these practices natural within the blockchain environment, the majority of transaction participants tend to prioritize stability, harboring negative perceptions towards malicious MEV and censorship.

For those unfamiliar with MEV and censorship, here’s a brief explanation.

What is MEV (Maximal Extractable Value)?

MEV stands for Maximal Extractable Value, referring to the maximum value miners or validators can extract from block production, in addition to block rewards and transaction fees, by adding, excluding, or reordering transactions. MEV represents a unique privilege of miners and validators, allowing them to generate additional revenue beyond gas fees by freely choosing the transactions that go into their blocks.

Below is a dashboard where one can view the profits generated from MEV.

Press enter or click to view image in full size
https://transparency.flashbots.net/

However, there are cases where the MEV reward system is maliciously exploited, including practices like frontrunning, sandwich attacks, time-bandit attacks, and the uncle bandit attack, among others.

By visiting the eigenphi website, one can check the current status of MEV. Charts summarizing sandwich attacks show that within a short period, a significant number of MEV incidents can occur through these attacks, and one can also see the financial gains made from them. In the situation depicted below, there were as many as 10 sandwich attacks within just 4 minutes.

Press enter or click to view image in full size

What is Censorship?

Censorship refers to the deliberate exclusion of transactions from a block by someone, which can be categorized into weak and strong censorship. Below is a dashboard showing the censorship status on the Ethereum network, illustrating censorship activities over 60 days, with the majority occurring at the Builder level.

Press enter or click to view image in full size
https://censorship.pics/

Weak Censorship

Weak censorship occurs when transactions are not accepted by some block producers but can still be included in the block by others, leading to a mere degradation of UX. An example of this is the impact of OFAC (Office of Foreign Assets Control) compliant Relays under MEV-Boost, where 38% of daily transactions are being censored, as seen in the picture below.

Press enter or click to view image in full size
https://www.mevwatch.info/

If one wishes to send transactions that do not comply with OFAC regulations, they can be sent to block producers using MEV-Boost or Relay that do not adhere to OFAC. In cases of weak censorship, paying attention to specific block producers can sufficiently circumvent this, causing inconvenience and time delays without significantly impacting the execution of transactions.

Strong Censorship

This represents a situation where transactions are permanently excluded from blocks, leading to a dangerous form of censorship that can result in financial losses. Unlike weak censorship, strong censorship occurs at the network level and is executed by attacking the network, posing a significant threat to the blockchain ecosystem. The method of attack and resulting censorship vary depending on the block mining mechanism, such as PoS (Proof of Stake) or PoW (Proof of Work).

Get Chaisomsri’s stories in your inbox

Join Medium for free to get updates from this writer.

The topic of this research, the Encrypted mempool, is more effective in preventing weak censorship than strong censorship.

“Ethereum is a dark forest”

The term “dark forest” is a metaphorical expression often used to describe the dangers of public mempools. It refers to a place where, once discovered, one is at the mercy of top-tier predators, in this case, arbitrage bots. These arbitrage bots continuously monitor pending transactions, seizing any advantageous opportunities for frontrunning, thereby depriving users of opportunities and causing financial losses. In addition to these scenarios, situations arise where transactions require higher gas fees than originally anticipated and arbitrary extraction of additional value occurs. This can instill a negative perception of the blockchain ecosystem among its users, potentially eroding trust in the ecosystem.

Then, have there been efforts to avoid the dangers of MEV and censorship in public mempools by using alternative means? Some users have turned to private mempools to avoid the risks associated with public mempools and to gain stability.

Visiting a mempool site that shows transactions in real-time allows for a comparison between expected blocks and actual blocks. By examining the relationship between blocks, one can often find transactions that made it into the actual block but not the expected one. The sky-blue transaction in the top-right picture, for example, is significantly large but was not included in the expected block, suggesting the use of a private mempool to reduce exposure of one’s transaction and avoid MEV and censorship.

Private Mempool

A private mempool is a transaction memory pool exclusively used and maintained by specific nodes, groups, or institutions within the blockchain network, not shared with the network at large. Unlike public mempools, transactions in a private mempool are only valid within the node or group and are not shared externally. Using a private mempool enhances security and confidentiality since trust is placed solely in the specific block producers managing the mempool, compared to the use of a public mempool.

However, the possibility that block producers of a private mempool could steal transaction contents or engage in malicious MEV and censorship remains an unresolved issue. Additionally, the likelihood of transactions being included in a block decreases compared to when transactions are posted to a public mempool, where they have the chance to be chosen by multiple block producers. Posting to a private mempool means that commitment can only be obtained from the designated block producer, leading to a dilemma. To address this, posting transactions to multiple private mempools increases the number of block producers that must be trusted, along with the potential for MEV and censorship, presenting a catch-22 situation. Various mechanisms, such as PBS and MEV-Boost, have emerged to overcome the disadvantages of private mempools and prevent malicious MEV and censorship. These mechanisms ensure an environment conducive to MEV while minimizing its negative aspects.

Alongside these various methods, “Encrypted mempool” is one of the newly devised mechanisms aimed at blocking weak censorship and negative MEV. This mempool combines the stability and reliability of private mempools while also increasing the likelihood of transactions being included, similar to public mempools.

3. Methodologies for Implementing Encrypted Mempools

How then is an Encrypted Mempool implemented? There are various methods for implementing an Encrypted Mempool, and currently, it is being implemented in these three ways.

  • TEE(Trusted Execution Environment)
  • Threshold Encryption/Decryption
  • Time-lock-puzzle

3.1 TEE(Trusted Execution Environment)

The TEE method implements the Encrypted Mempool through hardware. Let’s take a look at how an Encrypted Mempool can be implemented using Intel SGX, an example of a TEE setup.

At the heart of this environment is the “Enclave” located in the hardware memory. The Enclave is a designated virtual secure area within the CPU, where code and data stored inside can be executed under certain conditions.

A key feature of the Enclave is that even when using a debugger, the code and data inside cannot be viewed, and if untrusted code attempts to alter the contents within the Enclave memory, SGX will deactivate the environment and refuse the operation. A debugger is a tool that assists in debugging by allowing the inspection of the code’s progress and values stored in memory.

Utilizing this feature, the code and data intended for encryption are placed in a lock-box, an arbitrary space created within the memory, and then encrypted. The decryption key for this space is stored within the Enclave, making it impossible to decrypt unless specific conditions are met.

This trusted hardware-based Encrypted Mempool encrypts transactions while they are in the pending mempool at the hardware level, existing in encrypted form until they are placed on a block by a block producer (under specific conditions), at which point they are decrypted at the hardware level and the transactions are revealed.

The Encrypted Mempool, created through trusted hardware, ensures that code and data can be executed securely without external interference or manipulation. It also features unique encryption keys and security mechanisms, making it isolated from the rest of the system.

The advantages of this method include:

1)Secure Execution Environment
Since the Enclave cannot be arbitrarily controlled, it provides a secure execution environment, ensuring that code and data can be executed safely without external interference or manipulation.

2)Hardware-based Security
Being based on hardware security, it is immune to software-based hacking attempts. Software-based hacking allows remote access to other computers, which many hackers use to attempt hacks. In contrast, hardware-based hacking requires physical access, making it more difficult and less accessible.

3)Physical Isolation
Being physically isolated from the rest of the system reduces vulnerabilities to software attacks and hacking.

On the other hand, the disadvantages of this method include:

1)High Hardware Dependency
The system might become highly dependent on specific hardware, raising concerns about being affected by the major vulnerabilities or limitations of that hardware.

2)Low Compatibility with Software
It may only be compatible with specific software environments, limiting the flexibility in technology choices.

3)Centralization Issues of the System
Dependency on specific hardware manufacturers or suppliers could increase the degree of centralization of the system.\

4)Difficulties in Updates and Maintenance
Updating and maintaining the hardware can be complex and time-consuming since it might require changing the hardware itself.

3.2 Threshold Encryption/Decryption

As the name implies, this method implements an Encrypted Mempool through a threshold value. In this approach, the concept of a Keyper (committee) emerges. These Keypers generate both the encryption and decryption keys, with the encryption key being made public. The decryption key, however, is divided among the Keypers. When a transaction is committed, and a threshold number of Keypers agree, the divided decryption keys are combined, and decryption proceeds. This threshold can be set by the user or by the protocol. This structure of encryption through a threshold makes it impossible for a single attacker to attempt decryption before the transaction order is decided.

The advantages of this method include:

1)Reduced Risk of Centralization
Security is enhanced by having multiple participants hold parts of the key instead of a single key. Thus, even if one key is stolen or compromised, the entire system is not threatened.

2)Continuous Access to Data
Even if some of the participants become unavailable, the remaining participants can still access and process the data.

On the other hand, the disadvantages are as follows:

1)Majority’s Honesty and Trust Issue with Keyper (Committee)
The system revolves around the Keyper (committee), requiring the assumption that the majority are honest.

2)Instability of the Protocol
If the majority of Keypers do not decrypt for an extended period, the processing of users’ transactions could halt, potentially stopping the protocol. This could lead to a loss of user trust and damage the stability of the blockchain network.

3)Failure to Meet High Threshold
If a high threshold is set and an external situation (e.g., network failure) prevents enough participants from contributing, transaction processing could stop.

4)Degradation of User Experience (UX)
Because voting by the Keyper (committee) is required each time, unwanted waiting times and costs could be added depending on the implementation details.

3.3 Time-lock Puzzle

This method implements an Encrypted Mempool through the formula of a Time-lock puzzle. Users generate a symmetric key and encrypt their transaction, then provide the block producer with the parameters needed to generate the decryption key.

Users can set the desired delay time through a parameter “T”. The block producer can decrypt the transaction using the parameters provided by the user. The key to this implementation is that data can only be accessed after certain conditions are met or after a specific time has elapsed, as dictated by the formula.

The advantages of this method include:

1)Enhanced Data Protection
By preventing access to data for a specific time, sensitive data can be further protected.

2)Trustless Environment
The absence of a trust entity allows for decentralization.

However, the disadvantages of this method include:

1)Increased User Responsibility
The responsibility for keeping the symmetric key safe is emphasized, and if leaked, the data may not be decrypted as the user intended, potentially exposing the transaction to MEV and censorship. Furthermore, if users set the parameters themselves, they must predict the delay time and difficulty, emphasizing user responsibility.

2)Need for Ideal System Structure Design
Creating a trustless environment requires a detailed and thorough plan and resources to establish and manage an appropriate puzzle strategy, meaning the system’s structure must be ideally designed.

4. Summary of the Implementation Methodologies for Encrypted Mempools

Firstly, the TEE (Trusted Execution Environment) method offers hardware-based security strong against software-based hacking or vulnerabilities but requires “trust in the hardware.”

Secondly, the Threshold method, which decrypts when a threshold number of Keypers agree, has the advantage of a decentralized verification method. However, it operates under the premise that a majority of Keypers are honest, requiring “trust in the Keyper.”

Thirdly, the Time-lock puzzle method eliminates the subject of trust through puzzles, offering the advantage of trustlessness but requiring “weak trust in system design.”

Thus, we have explored the background and definition of Encrypted Mempool and its implementation methodologies. In the next articles, let’s delve into detailed analyses of projects based on each implementation methodology.

--

--

Written by Chaisomsri

Fullstack | Blockchain Engineer