How do decentralized exchanges prevent front running?


With the coming rise of decentralized exchanges for bitcoin and altcoins. How do these exchanges prevent front running of trades? Since all the transactions are transparent, what stops someone from monitoring the blockchain to detect a big order coming in and then immediately execute a similar trade before it?

Patoshi パトシ

Posted 2017-10-23T03:14:02.297

Reputation: 9 661

1Exchange trades/orders happen within the exchange, not on the blockchain. – Pieter Wuille – 2017-10-23T04:29:46.843



For those not familiar with front running: it is the process of market/price manipulation. If I know, that a big purchase of valuable will happen, the amount of this would get more rare on the market and it's price may rise. Therefor I could quickly do my own purchase of such a good, speculating that the price will rise, and sell it after the big transaction at a higher price.

In the bitcoin world this is not excluded. Imagine that you are within a big financial corp, and this institute asks the trading desk to buy bitcoins for 10mio Euros. An employee could see this planned trade, and do a quick self trade before. So this is within corporations.

In the public bitcoin space, there is no indication of a "big" trade, that will happen on the blockchain. Usually a tx is composed and then sent into the network, to the nodes that you are linked with, and from there to the whole network. So if you could see this UTXO with an enourmous amount in your node, you have the time to create your own tx to do front running. It would need to get into a candidate block, before the "big" tx joins a block which is then minde. I do not see that there is a guarantee to do so. It might get different when a miner comes into the play, and he is hand crafting a tx, but I am not 100% sure... He would have to be fast enough, that no other miner has a candidate block, that get's into the blockchain before him...


Posted 2017-10-23T03:14:02.297

Reputation: 4 806


There is no practical technology that I've found that prevents front running in a trustless manner. This is the case whether the exchange is decentralized or centralized. The only thing that will prevent frontrunning is proper auditing performed by an independent third party.

I've written here in regards to how some cryptocurrency projects implement the orderbook onto the blockchain and how it doesn't prevent front running:

Other projects implement the orderbook outside the blockchain, and this does not prevent front running either, the same as centralized exchanges.


Posted 2017-10-23T03:14:02.297

Reputation: 1 967