Tackling unhealthy orderbook ‘frontrunning’ in DEFI.
If you ever traded any of the rampant ‘deflationary’ tokens on ethereum blockchain, Binance smart chain or any similar blockchains, then you’re probably conversant with the popular warning while setting high slippage percentages. Slippages delineates the maximum percentage of the swapped tokens you’re willing to lose in the course of the transaction.
“Your transaction may be frontrun”, well who cares?! Yes; this warning is ignored most times, especially when you are chasing hotshots and the ‘next 100x’ lol. Guilty? Probably! While frontrunning may not sound so important, it is in fact an anomaly and an exploitation of defi projects, most times driven by greed. And sometimes for the fun of it.
Investopedia gives a rather simplified and realistic explanation of frontrunning:
Here's a straightforward example of front-running: Say a broker gets an order from a major client to buy 500,000 shares of XYZ Co. Such a huge purchase is bound to drive up the price of the stock immediately, at least in the short-term. The broker sets aside the request for a minute and first buys some XYZ stock for their own personal portfolio. Then the client's order is put through. The broker immediately sells the XYZ shares and pockets a profit.
Like a ubiquitous toxin, frontrunning finds its way into many financial systems. Perpetrated, by people with higher information, executed according to greed and urge to profit; frontrunning in the real is more of an exploitation of information rather than just technological inefficiencies. Investors with special information move to utilize them for their personal gains. While this may seem ‘normal’; it creates unfairness adding to tons of other toxic practices in the investment space.
With access to insider orderbook knowledge and a few tweaks at hand, frontrunning has found its way into cryptocurrency trading. Decentralized exchanges as well as centralized exchanges are left to battle out this unethical practice. Thanks to lack of in-depth understanding of how exactly the perpetrators gain firsthand information (on centralized exchanges) and the different techniques used to maneuver the orderbook, frontrunning has become a tedious issue to tackle. It has continued to undermine the reputation of exchanges; both centralized and decentralized.
On decentralized exchanges, validators and anyone with firsthand information of order queuing can exploit the order books in a similar manner. Perpetrators use data of pending transactions to maximize their profits. How exactly this is done depends on the blockchain’s technology. Each technique basically results in one trader jumping other trades to make purchases or sales.
With a large buy order on the queue; a frontrunner jumps the queue probably by paying higher transaction fees to make purchase as the large transaction in queue is expected to drive the price up. When this happens, he moves to sell at a profit. The reverse is the case when a large sale is detected.
Two factors determine the ability of a manipulator to successfully perform a frontrun operation; Visibility of the orderbook and speed of the blockchain. Most De-fi compatible blockchains are yet to develop a means to conceal orderbook details, they fall prey to orderbook frontrunning. Performing a frontrunning operation gets harder as the blockchain becomes faster. Maneuvering the orderbook in a fast blockchain is relatively tougher and sometimes impossible, depending on the blockchain network’s speed.
On the average, ethereum blockchain is slow. With tons of transactions being processed every second, ethereum blockchain could get really slow. Due to the requirement for blocks to confirm, it is possible for bots to monitor large transactions in the mempool that will influence the price of the ERC20 asset and then place buy or sell orders in front of these transactions thus profiting greatly. Defi platforms built on ethereum blockchain have suffered more from orderbook exploitation as perpetrators have just enough time to perform a counter transaction with higher gas fees.
What’s your frontrunning experience? Disappointing, I guess. Well, there’s a brilliant fix.
Ethereum layer-2 – Mute applies two measures to tackle order book manipulation; CONFIDENTIALITY and INSTANT SETTLEMENT.
As mentioned previously; to successfully frontrun an order book, one needs an in-depth knowledge of the orders in queue and be able to outbid them by paying higher fees. This ensure that his transaction is confirmed before the preceding transaction(s). ‘Pay a fine and jump the queue’? that’s about right!
To prevent frontrunners from gaining sufficient knowledge of the order book beforehand, MUTE add a privacy layer to its platform. Bids and asks are concealed as users once again retain the rights to the visibility of their transaction on MUTE’s Defi platform – Mute switch. Without knowledge of the order books, frontrunning becomes very tedious and impossible in the right sense. Mute’s technology protects traders from this manipulative practice thanks to its anonymity and privacy. Bots and users, unable to track transactions on Mute’s platform, fail to detect these large transactions and are hence unable to exploit the liquidity pool. This tackles the first exposure factor in normal function and ensures fair trading.
While Confidentiality ensures that the order book is not visible to anyone, its measures breaks down in cases of insider trading.
Insider trading is defined as a malpractice wherein trade of a company's securities is undertaken by people who by virtue of their work have access to the otherwise nonpublic information which can be crucial for making investment decisions.
Insider trading is a thing in crypto, projects and market makers in an attempt to artificially influence value performs trades in a specific direction to entice traders’ behavior. When successful, traders react in specific manner to trigger a cascade. Many popular price booms are thanks to insider trading.
On relatively slow blockchains, frontrunning is simplified by the long duration taken before transactions are confirmed. Frontrunners have enough time to outbid these pending transactions with their own transaction by paying higher fees. You’d notice that your transactions west to high slippage value usually attracts higher transaction fees.
To solve manipulations facilitated by sluggish transaction speed; Mute shifts away from the congested ethereum layer-1 to build its solution on ethereum’s layer-2. The layer-2 is equipped with impressive scalability and performance-improved features which ensures smooth running of transactions. Transactions are confirmed at light speed, faster than any frontrunner could get. This is Known as Instant settlement
Instant settlement as a measure to prevent orderbook manipulation is ‘final’ in my own opinion. With very little time between performance and execution of transactions, manipulation is reduced greatly. There will be no time (and no need) to jump a super-fast queue! It’s impossible to do so even when you want to. Mute employs this, coupled with Confidentiality.
One problem; two solutions. Mute is determined to solve the biggest problems facing defi and goes a mile beyond that. One solution after the other. Solving the orderbook manipulation restores fairness in crypto trading. All Buyers and sellers are given a common ground to run their transaction activities. Even with insider knowledge and more financial capacity to pay fees, Mute simply blocks manipulations by traders of different interests and ensures a healthy platform.
While we continue to wait for the initial launch of the Mute switch, you can take a look at the platform preview shared earlier.