Private Transactions on Ethereum

Jan Rock
8 min readDec 23, 2022

1. Introduction

Nowadays, decentralized platforms are moving to another stage of their evolution. The traders’ experience is growing. Many are trying to find opportunities to profit from the not entirely legal way of executing front-running attacks and leveraging Miner Extractable Values (MEVs) from public mempool. To protect other traders from such behaviour — private transactions have been proposed as a solution. The mechanism allows a transaction to be sent directly to a miner (PoW/validator for PoS) and prioritizes it when a new block is composed. That means the private transaction are not visible in the public mempool. Current studies are predominantly focused on MEV, and the area of PT is still open. In this article, I will analyze and consolidate the view from the present whitepapers.

2. Background

DEFI (decentralized finance) is in “Crypto winter”, similar to all other crypto assets. DappRadar [1] application to monitor the Total Value Locked (TVL) of DEFI showed $114 billion in June 2022. December 2022 is down to $40 billion. The number is still vast and equal to the GDP of Venezuela [2] in 2022.

Most TVL (around 85%) is locked with the second-largest network measured by market capitalization — Ethereum.

Unregulated environments with a lot of money attract people, not just the good ones. We can split the attacks into a few categories based on the level of danger for other market participants. The first lightweight attack is simple: access and parses pending transactions in the mempool to gain information. Running this on a large scale with enough computation power and linking to named wallets can give an insight into what is happening. It could be immediately connected to a front-running type of attack. That means the attacker can send a transaction with, e.g., GasPrice (award for a miner/validator to process the transaction) higher than, e.g., large pending transactions to get priority to be mined first. This behaviour can affect fair trading and create massive profits [3] for the attacker without significant risk.

3. Private Transaction

To prevent the transaction been exposed in the mempool to an attacker or just an advantage searcher, the private transaction has been invented. The transaction can be sent instead of a mempool directly to a miner/validator and cannot be revealed by others. Another benefit of the private transaction is a priority in a queue to be added to a new block. The capability has been introduced since September 2020 [4]; however, there are still many issues related to security [5].

The most interesting work, which includes an empirical test of private transactions, is from The University of Ohio [6]; however, there are some missing pieces related to explaining the process. The best would be to look at the difference in Figure 1. There are two stages of mining. The standard Tx transaction created by user A is sent to a mempool on node 1. At the same time, the mempool content is broadcasted to the other peers (N2 and M — miner/validator). Private transaction PTx from user B goes directly to stage 2, bypassing mempool and broadcasting on N1. When the block is mined, the PTx transaction is put in front of Tx. The question which is following is what happens with the transactions. Is it still private? The answer can be yes. It all depends on the consensus mechanism used. General protocol/consensus will make the transaction visible in a block explorer.

Figure 1 — Private transaction — mempool bypass

Extended protocol/consensus, e.g., Quorum [7], has processing public transactions the same as standard Ethereum. It updates only the public state of the blockchain. The private transactions are composed by adding an extra field — “privateFor” along with other fields. The field is dedicated to the public keys of the nodes for which the transaction should be readable. The private transactions are logged only in the private state of the blockchain, as the Quorum protects the modification of both public and private states for the same transaction.

The Quorum documentation [8] extends the private transactions with additional detail. When the Quorum Node is broadcasting the transaction to the pears in the network, it modifies the original transaction payload with a hash of the encrypted payload generated from Constellation [9] (from JPMorgan)/Tessera [10] (from ConsenSys). All participants that have their public key in the field can replace the hash with the actual payload via their Constellation/Tessera instance. Other participants that are whitelisted will see only the encrypted hash. When a private transaction is sent to an account that holds a smart contract code, those participants who are not a party to the transaction will simply end up skipping the transaction and not executing the smart contract code. However, those participants that are party to the transaction will replace the hash with the original payload before calling the EVM for execution, and their state will be updated accordingly. In the absence of corresponding changes to a client, these two sets of participants would therefore end up in different states and unable to reach a consensus. In order to support this bifurcation of contract state, Quorum stores the state of public contracts in a public state trie that is globally synchronized. At the same time, it stores the state of private contracts in a private state trie that is not synchronized globally.

Finally, I want to come back to the Miner Extractable Values (MEV) as something that is very closely related to the problem. Almost a billion dollars has been extracted from Ethereum over the last year, which can be the potential downfall for the future of Ethereum. I will try to explain the MEV in a single sentence. MEV is the amount of value/money made by miners who randomly exclude, include, or reorder transactions in any block there are able to mine. The term can also be named Maximum Extractable Value or Proposer Extractable Value when we talk about moving from PoW to PoS. MEV plays a critical role in all decentralized exchanges (DEX) like Uniswap and landers platforms like AVVE in the form of arbitrage and liquidation. To explain the MEV for Uniswap, we have to use an example. A trader spots an opportunity for arbitrage worth $5000 profit and submits the transaction with a $10 fee for a miner. The miner can “block” the original transaction resubmitting a new transaction from his account with a fee of $15 to get priority. There can be an even more sophisticated setup when other players, like automated bots, bid against the miner with an even higher fee. This model is called Priority Gas Auction (PGA). MEV, in this case, is the $5000 profit. However, if PGA starts and the fee is escalated to, e.g., $4000, it would be the new award for the miner and $1000 for the highest bidder in the PGA auction [11].

There are also other types of Ethereum-based market manipulation techniques [12]. To prevent it from happening, we have to decrease a miner/validator’s ability to perform MEV [13], allowing democratization — giving all market participants the same access to transactions as miners have. An alternative could be based on encryption of the content until the transaction is committed to the blockchain. Flashbots [14] is an R&D organization mitigating MEV on Ethereum supported by people like Vitalik Buterin. The focus is on three goals: set up private communication for searchers and miners, establish transparency, and share knowledge.

Figure 2 — Cumulative Sum of Miner Payments for MEV [15]

4. Summary

Our outcome is that there will always be a little bit of MEV. Even if the support for Flashbots and other similar projects [16, 17, 18, 19, 20] continues to grow, the “bad” guys will always be a step ahead. Blockchain technology is still in development, and all public network participants must be prepared to deal with similar scenarios or choose products with protection from MEV. Everything new, accessible, and with money involved will attract people and organizations to spend time and deconstruct to absolute detail to try to find a weakness to extract a benefit. Sharing awareness supported by examples is always the most effective tool.

Companies like ConsenSys, Alchemy and others provide safe APIs with other features like, e.g., cancelling transactions. The future of public blockchain depends on consumers and their needs. The opinion that private transaction is a prerequisite for the future cashless world seems to be more relevant. Nobody wants to “carry” a transparent wallet or at least have the option to choose. A similar debate is around KYC, where government organizations pay large amounts of money to private companies to track the movements of anonymous transactions connected to fiat money accounts. There has to be an option for a participant to stay on a fully decentralized anonymous network without KYC and fiat money interaction or have an official wallet generated by an authorized provider with completed KYC and a link to a fiat money account.

Right now, privacy and a little bit of sensitive regulation are necessary for the next epoch in future of public blockchain.

5. Bibliography and Web Sources

[1] https://dappradar.com/defi

[2] https://worldpopulationreview.com/countries/by-gdp

[3] https://www.theblock.co/post/139155/mev-bots-earn-476000-by-targeting-large-stablecoin-swaps/

[4] https://github.com/Taichi-Network

[5] M. Zhang, X. Zhang, Y. Zhang, and Z. Lin. Txspector: Uncovering attacks in Ethereum from transactions. USENIX Security Symposium, 2020. Online: https://web.cse.ohio-state.edu/~lin.3021/file/SEC20e.pdf

[6] X. Lyu1, M. Zhang, X. Zhang, J. Niu, Y. Zhang, Z. Lin. An Empirical Study on Ethereum

Private Transactions and the Security Implications. Southern University of Science and Technology. The Ohio State University, 2022. Online: https://arxiv.org/pdf/2208.02858.pdf

[7] https://github.com/ConsenSys/quorum

[8] https://github.com/ConsenSys/quorum/wiki/

[9] https://github.com/ConsenSys/constellation

[10] https://docs.tessera.consensys.net/en/stable/

[11] https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest

[12] https://medium.com/coinmonks/defi-sandwich-attack-explain-776f6f43b2fd

[13] https://ethereum.org/en/developers/docs/mev

[14] https://docs.flashbots.net

[15] https://explore.flashbots.net

[16] https://www.gnosis.io

[17] https://www.ata.network

[18] https://www.edennetwork.io

[19] https://www.alchemist.wtf

[20] https://archerdao.io

6. Recommended Books

Proof of Stake: The Making of Ethereum and the Philosophy of Blockchains by Vitalik Buterin (Penguin, 2022)

Virtual Society: The Metaverse and the New Frontiers of Human Experience by Herman Narula (Penguin, 2022)

Crypto Art — Begins by NFT Magazine (Rizzoli, 2022)

The Truth About Crypto: A Practical, Easy-to-Understand Guide to Bitcoin, Blockchain, NFTs, and Other Digital Assets by Ric Edelman (Simon & Schuster, 2022)

The Book of Crypto: The Complete Guide to Understanding Bitcoin, Cryptocurrencies and Digital Assets by Henri Arslanian (Palgrave Macmillan, 2022)

The Genius of Algorand: Technical Elegance and the DeFi Revolution by Anthony Scaramucci (SALT Books, 2022)

The Blockchain Future: Bitcoin, Cryptocurrency, Blockchain Technology, Decentralized Ledgers, Smart Contracts, Crypto Wallets, NFTS, and Web 3.0. What … do in the real world now and in the future! by Robert B. Seymour (Independent, 2022)

Metaverse Investing Beginners to Advance Invest in the Metaverse; Cryptocurrency, NFT (non-fungible tokens) Crypto Art, Bitcoin, Virtual Land, … 2022 & Beyond by The Meta-Verse

(Metaverse Investing Books, 2022)

Secret Lives by Mark de Castrique (Poisoned Pen Press, 2022)

Crypto-Finance, Law, and Regulation. Governing an Emerging Ecosystem by Joseph Lee (Routledge, 2022)

Thank you! If you like the article, please, click on the applause icon below. Please, add comments and ideas for the next DLT-related content.

--

--