What is a distributed exchange? How do I use it?

A distributed exchange is such exchange where there is no single person or organization that manages and operates the exchange, that matches offers and moves funds between participants. The Counterparty Distributed Exchange is commonly referred to as “DEx”.

Counterwallet Users

A walk through is available in article Buy and sell assets (tokens) on the DEx using XCP.

Developers

Orders on the DEx can be created in Counterwallet or programatically (via counterparty CLI or Counterparty API). In order to use the Distributed Exchange, a user must create an order, in which is specified:

  • The address from which you is making the order (source)
  • What asset you are selling (give-asset)
  • The quantity of give-asset you are selling (give-quantity)
  • What asset you are buying (get-asset)
  • The quantity of get-asset you are buying (get-quantity)
  • For how long the order is valid (expiration)

Once the user has made his order, the Counterparty protocol itself debits the necessary funds from his address, and holds them in escrow; an address cannot make an order to sell a quantity of an asset it does not have.

In order for a trade to completed, another order must match this order before expiration passes, otherwise the order will expire, unfulfilled.

If two orders are matched, then the Counterparty protocol sends the escrowed funds to the appropriate party, depending on the terms specified by the trade.

What about Over-The-Counter or direct trades between parties? Possibly at a price way above or below market rate?

1 XCP = 0.503836 BTC (earlier today at Poloniex).

  • Person A makes a DEx offer to sell 100 XCP for 0.4 BTC
  • Person B makes a DEx offer to sell 100 XCP for 0.5 BTC
  • Person C makes a DEx offer to sell 100 XCP for 0.6 BTC

You could use BTC to buy all the 300 XCP, but the matching engine would first match you with the lowest priced seller (A) and then progressively up.
Say you make a single buy offer 250 XCP for 0.006. The DEx would match your buy order with 200 XCP from guys A and B, and 50 XCP from guy C.

So you could sell and buy at a any price for which there’s a counter-offer. For example, someone makes a typo and sells or buys something at 10x the Poloniex price. If they’re selling at a 10x markup they may not necessarily find a buyer (unless someone is crazy enough to pay 10x, or has made a typo himself), but if they’re selling at 10% of the Poloniex price, maybe someone will spot his order and fetch it. I think that happens too rarely and in too small amounts to be a good way of making money.

I was only using those figures as an example. So one couldn’t use the DEx for direct trades between two parties because more party’s orders may become involved in the settlement.

You can use another tool that is not the DEX to accomplish this, and thats Swapbot:

https://letstalkbitcoin.com/forum/post/the-tokenly-ecosystem-rolls-into-alpha-swapbot-tend-services-now-available

@counterpart, correct - it is not possible to trade with named/predetermined parties because the DEx matches orders only based on price for any given token/asset pair.

It could work differently, but it’d require development. Because most parties want to get the best price (rather than a pre-determined buyer or seller), it’s probably not something that would be used by many people.