Front Running and its Effect on Decentralized Exchanges

Totle
Totle
Jul 26, 2018 · 5 min read
Image for post
Image for post

Since the era of barter trade, traders lacking in scruples have sought ways to defraud their counterparty, with earlier tricksters employing modified scales as a way to cheat in commerce.

The invention of money and the internet created a globally networked marketplace with more opportunities for cheaters to exploit. Dishonest brokers leverage their superior knowledge and high-frequency trading algorithms to profit off schemes such as front running. Efforts to restrain immoral financial behavior relies on sophisticated financial legal systems and an enforcement network robust enough to punish offenders.

Today, decentralized financial infrastructure is being laid to achieve trustlessness, rendering judges and lawyers redundant.

In trustless systems, we do not rely on participant’s morals and ethics in maintaining the health of the system. Rather, the challenge lies in designing incentive mechanisms that make it unprofitable if not outright impossible to cheat, leaving fair-play as the only dominant strategy from a game theory perspective.

In trustless systems, we do not rely on participant’s morals and ethics in maintaining the health of the system. Rather, the challenge lies in designing incentive mechanisms that make it unprofitable if not outright impossible to cheat, leaving fair-play as the only dominant strategy from a game theory perspective.

Running from the front

Image for post
Image for post

Clients were under the impression that their trades were taking place in-house, all the while BoA had been routing their orders to electronic market makers. These market makers employ high-frequency trading algorithms, allowing them to hop in front of incoming trades and profit lucratively at the expense of Bank of America’s customers.

Front running on decentralized exchanges

However, the transparent nature of a blockchain mempools enables front runners to enter their trades first, profiting on the resulting price movements when prior orders are finally executed. By setting a higher gas price and making it attractive for miners to prioritize their transaction, these malicious actors can ensure that their trade executes before the transaction they are attempting to front-run. Furthermore, miners can participate in front running themselves by choosing to execute their own trades ahead of time.

Find me a taker

Airswap is a decentralized exchange that enables users to find counterparties for trade privately. An indexer aggregates ‘intent to trade’ from both makers and takers, opening up a channel of communication between them once they have been matched. Thereafter they agree on a price using Airswap’s price oracle as a starting point for negotiation.

Image for post
Image for post

Don’t stop the flow, create a better funnel

Peek-a-Boo

Auctioneers use first-price sealed-bid auctions, or blind auctions, as a way to entice bidders to bid their true valuation of an item, irrespective of the preferences of others. Commit-reveal schemes such as the blind auction can be employed on the blockchain in order to disclose information selectively such that front running is precluded. In the commit-reveal scheme proposed by the 0x framework, a maker initiates a trade by cryptographically signing an order which is then added to the open order book. A taker can then commit to an attractive offer by signing an order declaring intent to trade, effectively ruling out other parties from filling the order. While this transaction sits in the mempool, onlookers are prevented from viewing the order details. Once this transaction is mined, the order details are then revealed to the commit-reveal smart contract. However, since the order has already been preassigned to the taker, observers can look but they cannot touch this impending trade.

Just as designers of ‘analog’ economies need to preclude unethical behavior such as front running, so too in order to thrive, blockchain economies require efficient mechanisms for dealing with potential cheaters. However, while the traditional financial system deploys an army of lawyers and congressmen to legislate against dubious financial practices, the blockchain economy is occupied with designing protocols that preclude cheating. Using a combination of cryptograhpy and incentive mechanisms, blockchains allow for the creation of bespoke economies that can be stressed tested in real-time.

Successfully defending against front runners will provide decentralized exchanges, and by extension the entire crypto market, with a platform to reach mass adoption.

Written by: David Azaraf

Get Started with Totle

Easily convert tokens with Totle: Totle Swap

Follow us on Twitter, Facebook, Telegram, or Medium for the most up-to-date news on Totle.

Totle

Decentralized Liquidity on Autopilot.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store