CEX vs. DEX by example

in #bitshares7 years ago (edited)

CEX

A trader wanting to exchange 1 CoinA for 10 CoinB first has to transfer his CoinA to an exchange. Once that is done, he no longer has direct access to his funds and the keys controlling them and has placed his trust with the exchange.

He places an order (off-chain) to sell his 1 CoinA for 10 CoinB. Again the timing and correct handling of his order is dependant on the exchange's actions and the exchange has to be trusted to do this honestly and correctly.

He then has to wait for another exchange user to go through the same process for selling 10 CoinB for 1 CoinA.
Once that is done, they both place their trust in the exchange's off-chain order-matching algorithm for order-matching to be done correctly and honestly.

Once the transaction (off-chain) is complete, they both place their trust in the exchange having enough liquidity and allowing them to transfer their new coins back to a wallet that they control thus obtaining complete access over their funds again.

CEX vs. DEX

DEX

A trader wanting to exchange 1 CoinA for 10 CoinB on the DEX (where CoinA or CoinB are DEX-native assets, either core currency BTS, MPAs such as bitUSD or UIAs such as open.BTC) simply places an order from his wallet (which he has complete control over).

The order is registered on-chain. When another trader places a matching order of 10 CoinB for 1 CoinA (again registered on-chain), there is on-chain matching of those orders as part of the consensus algorithm. This is completely transparent and the transfer of funds between the 2 traders is done as an ATOMIC process between the 2 traders, each one being in complete control of their funds at any time.

Thus, any trade in the DEX between DEX-native assets is a trustless atomic swap.

This reduces the problem of cross-chain transactions to the on-ramp and off-ramp of a coin from a different blockchain into a DEX-native asset rather than on every single transaction.

This is currently handled by trusted 3rd party gateways such as OpenLedger. However there is less trust required because:
a) conversion from say core BTC (on a user-controlled wallet) to open.BTC (on a user-controlled DEX wallet) takes a short time

b) Transparency is enhanced (as long as OL's BTC wallet has equivalent funds to the open.BTC UIAs it has put into circulation , liquidity is guaranteed. No way to check for CEXs)

c) The order-submitting and order-matching processes are trustless and transparent and the actual exchange of assets is atomic as described above.

What's more, because the main problem with trustless ACCTs is that they take time to be performed (due to the way the trustless algoorithm works), reducing the need for them on the on- and off-ramp alone (and actual trading remaining instant), means that it's quite possible in the future for even that part of the process to be made completely trustless on the DEX.

Note: ACCT refers to Atomic Cross-Chain Transaction

Sort:  

Thanks ! Great article, perfect explained !

You did a great job of explaining this. I've had a problem explaining the difference to newcomers.

This was actually prompted by a conversation I had with the OpenLedger CEO regarding the exact same thing and how to best explain it to newcomers.

Actually it is even worse with DEX, because if a gateway like OpenLedger is a scam, then users loose trust in both - DEX and gateway. They do not understand that a gateway is a 3rd party exchange. At the same time DEX gateways are "silently" sitting in shadow and doing their business. It is like a Trojan horse.

Which is why educating users to the difference is key.

And the DEX is fast as hell :)

Hey @clockwork! : )

Very nicely explained - thank you :)

What a breakthrough! challenge other existed algorithm..