BitShares Forum

Main => General Discussion => Topic started by: eng on July 05, 2017, 06:56:14 pm

Title: How does bitshares2 eliminate HFT and front running?
Post by: eng on July 05, 2017, 06:56:14 pm
Hi,

I've read that there can be no HFT and front-running in bitshares2.0. (https://bitshares.org/blog/2015/06/08/lessons-learned-from-bitshares-0.x/ )

But I can not understand how bitshares2.0 eliminate front-running.

I think witness can easily front run and get profits without any risk.

Does "defined fee charged by network" prevent it?
If so, is it fair for everyone than allowing front-run?
Can anybody tell me with an example?
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: MarkoPaasila on July 06, 2017, 06:29:53 am
I don't understand too much about trading, but 2 things come to mind:
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: eng on July 06, 2017, 09:12:21 am
- Then someone put order of "I will buy at least X of asset A with no more than Y of asset B", a node between him and witness (or witness itself) can see the order, and obtain profit margin  about "Y - (best ask in that time)"?


- This feature is not a distinctive feature of Decentralized Exchange, I think all normal trading markets have same feature.


- I understand " front-running will eventually be detected, and the witness could loose his (hopefully profitable) position as a witness.".
If someone do front-running greedy and foolishly, it's easy to detect.
But is there any detail report about this?
How often nodes can front-run without being detected?
How can we detect front-running concretely? What kind of statistical method can we use?
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: yvv on July 06, 2017, 02:07:50 pm
I think, the best way to investigate this issue is to try to come up with front running strategy and try it. I wish I had enough knowledge to do this.
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: Chronos on July 06, 2017, 04:41:18 pm
Hi,

I've read that there can be no HFT and front-running in bitshares2.0. (https://bitshares.org/blog/2015/06/08/lessons-learned-from-bitshares-0.x/ )

But I can not understand how bitshares2.0 eliminate front-running.

I think witness can easily front run and get profits without any risk.
You are correct. I also think the witnesses can front run.

The linked article speaks of the old "You Get What You Ask For" orders from Bitshares, which were supposed to prevent front running. Does the article really say that Bitshares2.0 can't be front run by witnesses?
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: eng on July 06, 2017, 07:09:31 pm
Sorry, you're right. That article doesn't state bitshares2.0 eliminate front-run, but this article does.
https://bitshares.org/technology/decentralized-asset-exchange/

And as this blog (http://kaykurokawa.blogspot.jp/2015/06/front-running-decentralized-exchanges.html) stated about bitshares0.X's approach thoroughly, hft/front-running is important and difficult problem.

I think, saying that bitshares2.0 eliminate front-run without detailed discussion is not good.
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: pc on July 06, 2017, 07:16:50 pm
Yes, witnesses can front-run, but

Everything is transparent, front-running will eventually be detected, and the witness could loose his (hopefully profitable) position as a witness.

this!

If someone do front-running greedy and foolishly, it's easy to detect.
But is there any detail report about this?
How often nodes can front-run without being detected?
How can we detect front-running concretely? What kind of statistical method can we use?

There are no reports (that I know of).

How does front-running work?
Suppose there's one (or more) order on the book that sells (for example) 1 BTS for 0.9 bitUSD. Suppose that another order comes in that wants to buy 1 BTS for 1 bitUSD. The evil witness who is about to create a block scans the incoming transactions and detects that there's a price overlap between the market and the incoming order. He then inserts two transactions of his own, right before the overlapping tx: one to buy 1 BTS for 0.9 bitUSD, and one to sell 1 BTS for 1 bitUSD. The first one will be matched with the order on the book, the second one will be placed into the book, only to be matched with the overlapping tx a moment later. Evil witness has a risk-free profit of 0.1 bitUSD.

How to detect that?
Look for blocks that contain such a suspicious succession of transactions. Note that the evil witness could exclude the original tx from his own block to make it look less suspicious, because most likely it will be included by the next witness. In conclusion, you should check such suspicious sequences in adjacent blocks as well. If you detect any, count such events for each witness. An evil one should stick out like a sore thumb.
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: tehdos on July 06, 2017, 10:27:16 pm
Doesn't AntPool mine like 14% of Bitcoin or something? Are there risks there?
Title: Re: How does bitshares2 eliminate HFT and front running?
Post by: eng on July 07, 2017, 08:00:34 pm
How to detect that?
Look for blocks that contain such a suspicious succession of transactions. Note that the evil witness could exclude the original tx from his own block to make it look less suspicious, because most likely it will be included by the next witness. In conclusion, you should check such suspicious sequences in adjacent blocks as well. If you detect any, count such events for each witness. An evil one should stick out like a sore thumb.
Hmm, I see.
But It's economically rational for witnesses to do several front-runnings less frequently than the count stick out like a sore thumb .
Releasing a tool that shows the analysis result based on good algorithm will make the community safer.