1

Imagine we have several different tokens, and we want to know which one is most valuable. Tokens are contracts with methods to satisfy the Token API.

If you have a decentralized exchange, you can put in a "buy" order at price X for a token, and if nobody is prepared to fill that order over a sufficient period of time anybody watching can conclude that the token is worth at least X. (You can manipulate this if you're prepared to spend enough buying your own token, but given enough liquidity making your token appear the most valuable should cost the market cap of the token that's really the most valuable.)

Is there a way to do this securely with arbitrary tokens (ie any code that satisfies the semantics of the Token API), or will that be impossible to secure? The kind of thing that occurs to me is that if the attacker can make the token contract themselves, they can prevent it from funding the exchange, so nobody is able to fill their offer. So I'm wondering if it's an inherently unsolvable problem, or if it's just that my decentralized exchange design is too dumb.

2
  • Maybe it's me, but I don't fully understand. Can you give pseudo-code of what an attacker would do? Commented Sep 14, 2016 at 10:34
  • @XavierLeprêtreB9lab, not just you.... The question is unclear
    – o0ragman0o
    Commented Sep 14, 2016 at 12:44

2 Answers 2

3

Building a fully decentralised exchange on the blockchain is a very difficult task. It has quite major operational differences compared to centralised exchanges, not least the problem you describe about being able to game the exchange, and the technical differences mentioned by @Mikko.

However simply placing an order to sell token A at price X for token B even after any length of time and even if you own both token A and B does not mean that the actual value of token A is X.

For real value to be established you have to see it in the context of the market as a whole. Even if you have tonnes of Token A and the last sale price in B was Price X, you have to start over when you want to sell A for token C or D or E etc... in other words you have to consider if third-parties are prepared to pay your asking price or not.

2

Based on the question, I am not sure where the problem is, no matter if the exchange is decentralized or not.

Most exchanges are based on public orderbook. Everybody sees ask and bid offers there. That's how e.g. Ether price is formed - you get lowest/highest/average ask and bid. If somebody wants to buy tokens at market price of course they should be able to do so and that moves the price. The motivation of this action is irrelevant from the perspective of the orderbook.

One problem with decentralized exchanges is that if somebody intercepts buy/sell order transaction in memory pool before it's written to a block in blockchain and has narrow time window to inject their own order first. But as far as I see this is unrelevant to the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.