Front-running bot prevented from exploiting transactions
DeFi and AMM SKALE Education

How SKALE Solves The Front-Running Problem

Ruby
Ruby

This is the second part of a two part article about Maximal Extractable Value (MEV) and front-running on Ethereum. Read Part 1: What Is MEV And Why Is Front-Running A Serious Problem?

Maximal Extractable Value (MEV) has become a significant problem for Ethereum mainnet users. The transparency of the blockchain means that "searcher" bots can see and exploit pending transactions, jumping the line at the expense of regular users. Front-running now threatens the efficiency and potentially even the future security of the DeFi sector. Unfortunately, while the problem is getting worse, counteracting it on Ethereum L1 would be difficult and would have unintended consequences.

Chart of MEV, May-December 2020
Known MEV increased 100-fold in the second half of 2020 alone (Credit: Paradigm Research).

SKALE's solution to MEV is to use Threshold Encryption to encrypt every transaction on the network before it is submitted to the mempool, decrypting transactions only after they are confirmed—meaning that all users are protected from front-running by default.

How Does Threshold Encryption Work?

Since the blockchain is transparent and front-running is so easy to automate with searchers, it likely costs ordinary users billions of dollars every year. SKALE has implemented a simple but highly effective solution to this problem using Threshold Encryption.

Threshold Encryption distributes cryptographic operations between multiple parties. In this respect, it is similar to multi-sig transactions, which allow any subset from a larger group to sign a transaction ("M-of-N"). For example, 2-of-3 multi-sig is often used to run a kind of crypto joint account, so that no single party has full control of a wallet.

However, Threshold Encryption is more private and secure than multi-sig. In a multi-sig transaction, each party signs the transaction separately, on the blockchain. Every signature is generated by a different private key, so the signatories are recorded and can be identified on-chain. In a Threshold Encryption system, the different members of the group coordinate off-chain and collectively create a single, signed transaction, which is then submitted to the network.

As well as being a cheaper, faster, and more efficient approach, that transaction will look the same no matter which parties sign it: There is no on-chain trail that can be used to learn which signatories from the group were responsible. In a sense, no whole, individual private key used to sign the transaction ever actually exists, only fragments of keys controlled by multiple nodes, spread around the world.

Solving MEV With Threshold Encryption

Threshold Encryption provides an elegant solution to the problem of front running. The network validators on the SKALE S-Chain collectively create a key that is used by senders to encrypt all transactions before they are submitted to the network, so their contents cannot be viewed while they are waiting in the mempool. Transactions are still encrypted when they are added to the blockchain. Only after this occurs are they decrypted by validators.

This means that a transaction remains encrypted the whole time it is "in transit", until it has been immutably included in a block. By the time the transaction is executed, it's too late for an attacker to submit a new transaction to front run it. This system is robust even if one or more network nodes are compromised, because no single node decrypts the transaction. So long as there is an honest super-majority, the system is secure.

One of the best parts of this solution is that it does not require any significant alterations to the Ethereum Virtual Machine (EVM), so it's fully compatible with existing Ethereum dapps. It's a solution that can therefore be added for free to SKALE, routinely protecting every user from all kinds of MEV attack. It's possible to run Uniswap or Aave on SKALE, for example, and the dapp will function perfectly—and also be immune to front-running.

In this video, SKALE CTO and co-founder Stan Kladko discusses the platform's use of threshold encryption in more detail.

Trading Securely On Ruby

MEV is a growing problem on Ethereum mainnet, and is likely to become an issue for any L2 solution that does not deliberately take preventative action. By using threshold encryption to protect all transactions before they are confirmed, SKALE provides a safe environment for DeFi dapps. Ruby users will enjoy the full functionality of the platform without worrying about front-running.

Learn more about SKALE, and follow Ruby.Exchange on Twitter and Telegram, as well as subscribing to the Ruby blog.