Stellar news delivered weekly:

Decentralized Exchange

Stellar Overview Course

Lesson Description

Cross-border and cross-asset payments are powered by Stellar's decentralized exchange with on-ledger order books and atomic swaps of up to 6 hops.

Lesson Transcript

You can think of Stellar’s decentralized ledger as a database - a database that can store more than just account balances and payments.

Another use case for this database is the storing of offers to buy and sell assets, and all these offers represent a global order book on a decentralized exchange, or DEX for short.

Stellar’s DEX is similar to a decentralized version of exchanges like GDAX, Bittrex, and Binance. You’ve got sell orders, buy orders, and order matchmaking.

The best way to understand the Stellar Dex is to compare it to other exchanges. In this video, we will be comparing the features of the Stellar DEX to that of centralized exchanges and of DEXs built on Ethereum.

The first and most important being private key possession - do you own and hold your private key or not.

Centralized exchanges store private keys on central servers, which have a history of being hacked.\

Ethereum DEXs store your funds in smart contracts, which also have a hacking history

But with Stellar’s DEX, you are in control of your private keys - you control your money.

The next is whether or not the order book is stored on-ledger or off.  An order book is the list of everyone’s buy and sell offers, and on-ledger implies a datapoint is stored in the decentralized database.

A large amount of trust is placed in centralized exchanges and the servers they store orders on - you can be locked out or it can go down and you won’t be able to place an order.

Due to long transaction times and too few transactions per second, buy and sell offers stored in the Ethereum blockchain get backed up, forcing many Ethereum DEXs to store order books and match orders off-ledger on one server.

But because Stellar has an order book and offer matching built in at the protocol level, on-ledger offers are a simple addition to the decentralized database.

Next up: on-ledger settlement. Once an order is matched with another compatible order, does the trade execute in the network with tokens truly being swapped.

On centralized exchanges, this is not the case - the private key holding the newly traded tokens is stored on the centralized server.

With Ethereum DEXs and Stellar’s DEX, the trade actually occurs on ledger.

Another key difference is cost.

Most centralized exchanges charge a substantial fee for purchases,

Ethereum DEXs also take a cut on top of the Ethereum network fee for a transaction.

But the Stellar DEX only costs 100 stroops per operation, a very small amount - many fractions of a cent.

Another way to understand the cost differences is the total cost for 100,000 hundred dollar transactions.

Around $25,000 for centralized exchanges, $24,000 for ethereum dexs, and an incredibly tiny $0.40 for the Stellar DEX.

A final distinction is transaction speed.

Centralized exchanges are incredibly fast at around 1 second,

And Ethereum DEXs experience the same lag that all transactions on Ethereum do, currently at around 3 minutes, while Stellar’s 5 second ledger closing time makes it likely the fastest DEX out there.

When you line up all these features, it becomes clear that the Stellar DEX is a winner, offering what users want, with the exception of having a large inventory of different tokens. The small inventory problem can be fixed over time as more tokens are added.

All of this - the on-ledger order book, the on-ledger settlement, the matchmaking - happens under the hood in the Stellar network.

To interact with the Stellar DEX, you must use the Stellar API called Horizon if you are a developer, or use a UI (or user interface, basically a website or app) not created by the Stellar Development Foundation like StellarTerm if you are not a developer.