How True Decentralised Exchanges Work

Bitspark
The Ledger
Published in
3 min readAug 28, 2018
Sparkdex Trading View

Decentralised exchanges are taking over from their centralised counterparts, with crypto traders increasingly using DEXs as they become more sophisticated. What makes trading on the DEX more advantageous compared to a CEX, is that they give greater control of funds and trades to the users and eliminate the single point of failure that’s inherent in a centralised design.

Let’s take a deeper look at how a true decentralised exchange and Sparkdex works, analysing the 3 key components that make up an exchange:

  • Fund management
  • Order books
  • Crypto transactions

Fund management

On a decentralised exchange, each user is in control of their own funds because all crypto assets are stored in user-owned wallets. At any point in time, a user can withdraw or deposit funds without the need for centralised third-party mediation.

This is fundamentally different than the way it works on a centralised exchange where funds are held by the organisation running the exchange. In this case, users often don’t even have the private keys to access the actual wallets. This requires a level of trust which is easily exploited either by internal malicious behaviour or hackers from outside breaking into the exchange.

Order books

On any exchange, you have Makers and Takers. A Maker is a trader who submits buy or sell orders, and a Taker is the person that chooses to act on them. Both Maker and Taker activity is registered in what is known as the order book.

With a decentralised exchange system, the order book is processed and maintained on the blockchain so that anyone connected to the system can see and audit all trading activity. This way there is only one global consensus-driven order book which serves as the single source of truth.

As Dan Larimer explained in the BitShares whitepaper (currently being updated): having a global unified order book greatly improves market efficiencies by reducing arbitrage opportunities, minimising spreads, maximising liquidity and ultimately provides a better system for accountability and auditability.

Crypto transactions

Traders on the DEX exchange crypto assets directly, coin for coin. That may sound like an obvious way to trade tokens but the way that works on centralised exchanges is very different.

Centralised exchanges use an IOU trading system to effect trades quickly. When a Taker acts on a Maker order, IOU tokens are traded between users and the exchange. This means a user is not actually trading crypto assets, but merely a representation of them. The real transaction only occurs once the exchange database processes and reconciles the activity and history of each participant. This is slow way of effecting trades and completely unnecessary for trading cryptocurrencies.

Possible additions to true DEXs we can look forward to

Transactions on the DEX use another system of trading called atomic swaps, a smart contract technology. With atomic swaps, cryptocurrencies are traded directly between users without the need for IOUs. To ensure both parties fulfil the trade, atomic swaps use what is known as Hash Timelock Contracts (HTLCs). Both traders submit their transaction to the blockchain, and each must claim their received funds before a certain deadline by generating a cryptographic proof of payment. This transaction requires only trust in the blockchain and not a third-party.

Additionally, what makes atomic swaps even more exciting is that it enables transactions using two different blockchains, which also means traders aren’t limited to currency pairs supported on a specific trading platform. This consolidates what is currently a fragmented ecosystem and creates the potential for an intra-DEX world where all exchange order books are essentially connected through different gateways.

With decentralised exchanges, cryptocurrencies can finally achieve their ideological purpose — freedom from centralised authorities.

Enjoyed this article? Share Sparkdex with others.

WebsiteNewsletterTwitterTelegramReddit

By joining or subscribing to the links above you will only get Sparkdex specific content.

--

--

Bitspark
The Ledger

Bitspark helps you convert cash to cryptocurrency globally without banks. Send and receive money, and exchange between currencies at exceptional rates.