





24



26 Shares

Cryptocurrency Exchanges

Anyone who wants to get into the cryptocurrency market and does not want to mine blocks needs to exchange his fiat money at an exchange, the only alternative to this is to get cryptocurrency from another holder. Centralized exchanges like Bitfinex, Coinbase, Kraken, Poloniex or Shapeshift intermediate the bid and offer matching process for cryptocurrencies and crypto tokens. The users of these exchanges must store their funds and private keys necessary to authenticate transactions in their accounts on the exchange server. This accumulation of sensitive data makes their servers very interesting targets for hackers. Moreover, intra-exchange movements are not transparent.

Decentralized exchanges (DEXs) are exchange platforms built on top of blockchain technology. This means, that there is no single intermediary, but a DEX is maintained by many network nodes, and the (whole) exchange process is recorded transparently in the ledger. Users do not have to store their funds at a central entity and the fault-tolerance property of a blockchain assures the availability of the service, i.e. it is not prone to server downtimes. However, in this approach, new challenges arise: liquidity and instant trades. Furthermore — and most importantly — there might be even severe DEX inherent “flaws” which are mentioned in this very informative post, like e.g., front-running and exposure to arbitrage. Certainly, privacy is due to transparency more difficult to achieve in this approach.

In our blog post, we did an informal survey of decentralized exchange designs and compare them on an abstract level. At the end of this article, we list implementations and proposals of existing DEXs, each accompanied with a short description of its specifications.

Overview of DEX Designs

The basic functionality of an exchange or market maker consists in making a match between a bid and an offer of currencies or tokens through an order book. Once a match is found, the transfer is executed. The market maker may have necessary reserves to function temporarily as the counterparty of a trade and may suggest fair prices (price discovery). In volatile markets, this can be advantageous as the trades may be processed almost instantaneously.

Complete DEX on-chain solutions

In the complete on-chain approach, both, the match of bid-offer in the order book and the exchange of the token or currency are processed on-chain. This might be on a separate blockchain where funds are locked, a decentralized order book is maintained, and an exchange engine performs the transactions according to given rules. Or, this can be organized through a smart contract on an existing blockchain, e.g. the Ethereum blockchain, which gives the users the possibility to write their offers in an order book and the contract manages a secure exchange of tokens.

Hybrid DEX Solutions

Hybrid solutions outsource the match of bid-offer and have an order book off the chain. Off-chain matching can be organized between the peers just with a broadcasting provider or could be performed by an automated market maker (AMM) engine. In both cases, the final settlement is established on-chain.

Survey of DEX Properties

The various designs of DEX are compared with respect to the following metrics:

Trust: The need for a trusted entity. In on-chain solutions, the bid-offer matches and settlement are verified by the network nodes, and there is no intermediary involved in the whole process. If bid-offer matches are done off-chain, the correct execution of the broadcast service must be assumed so that delays do not put someone at disadvantage. Trades without AMM can be executed via smart contracts where a bid is committed through a digital signature which another peer can take by signing again the same contract. This way, no trust is needed in the matchmaking process.

Liquidity: This property refers to the degree a token or coin can be sold or bought with a stable market price. In on-chain solutions, decentralized liquidity pools or reserve mechanisms may guarantee liquidity. In hybrid solutions, this depends on the activity of the exchange market to find a counterparty. Some exchanges offer cancellation calls since in volatile markets orders might become stale very quickly.

Instant Trades: On-chain bid-offer matches and settlement are slow as each step needs to be confirmed which depends on the confirmation time of the blockchain and whether liquidity is provided. Given that a counterparty exists, hybrid solutions can process trades faster (depending on confirmation time).

Costs: There are eventually fees for using the system when placing an order, canceling an order, or taking a bid. Every interaction with the blockchain has an additional cost, namely the fees to be paid to the miners. On-chain solutions are very costly since any step requires an interaction with the blockchain. In hybrid solutions, only cancellation calls cost blockchain fees and when a taker of an offer wants to settle the trade.

Secure: Informally, this should mean that it is very unlikely to lose money or to be subject of any misuse of its funds when using the exchange service. In contrast to centralized exchanges, arbitrage opportunities are transparent. This implies also that miners who are responsible for block insertion may take advantage of front-running, i.e., influence the transaction order to their favor resulting in worse trades for the users. In hybrid solutions without an AMM, this concerns only the cancellation calls, although the broadcast service may suppress orders to profit from exclusive access to the order book. There are more refined attack scenarios in specific implementations, e.g., maker griefing, just to name one.

On-chain (Blockchain) On-chain (Smart Contract) Hybrid (without AMM) Hybrid (with AMM) Trust Trustless Trustless Reliable broadcast

Trustless trade via smart contract Reliable broadcast

Trust in AMM Liquidity Yes

(decentralized liquidity pool) Possible

(reserves or pools) Not guaranteed

(depends on activity) Not guaranteed

(depends on activity) Instant Trades Medium

(depends on confirmation time, liquidity, micro-payment channels) Medium

with a reserve

No

without a reserve Yes

(depends on how quickly matches can be found) Yes

(depends on how quickly matches can be found) Cost Medium-High

(all changes are done on-chain;

depends on consensus model) High

without reserve

(all changes are done on-chain)

Lower

with a reserve Low

(latency in order book may takers lead to compete resulting in high gas costs) Low

(only cancel and settle is on-chain) Security Miner front-running

Exposure to arbitrage (stale orders can be filled) Miner front running

Exposure to arbitrage (stale orders can be filled) Miner front running

(in cancellation calls only)

Exposure to arbitrage (stale orders filled)

Suppress orders

Possible maker griefing

Possible DoS attacks Secure against front-running in cancellation. But exposure to arbitrage risk of matching service

More complex to code

Possible DoS attacks

Note that inter-blockchain exchanges is a very demanding task and can be solved only via a separate blockchain or sidechain techniques.

Decentralized Exchanges Projects

Projects in the growing sector of decentralized exchange sector are listed here:

On-chain/Smart contract based DEXs

Decentrex : On Ethereum blockchain, Ether or any Ethereum based token. On-chain order book. Maker creates an order and a taker order is one that trades against a resting order. The only fee is a taker fee. Deposit, withdraw, and maker transactions are all free. EtherDelta : smart contract overview here . On Ethereum blockchain, Ether or any ERC-20 Ethereum token. Price, volume, expiration time (measured in blocks), and signature are fixed in smart contract. Off-chain broadcast to the off-chain order book server. EtherDelta does have a backup mechanism that allows orders to be submitted with on-chain transactions. Taker takes the offer by signing the contract and contract checks signatures. If funds are available, funds are moved. Kybernetwork : On Ethereum blockchain, Ether or any ERC-20 Ethereum token with far goal to be cross-chain exchanger. Reserve to maintain exchange liquidity. Kyber contract organizes communication between maker, reserve, and reserve manager (who propose rates, best rate chosen for users). Upon agreement, funds are moved. OasisDEX : On Ethereum blockchain, EIP-20 token standard and more. MakerOTC contract for trades includes expiration date and cancellation option. Sell and buy orders cost gas which is first deposited into the ETH token contract. No matching engine, anyone can choose amongst proposed trades. Ubitok : On Ethereum blockchain, Ether and any ERC-20 Ethereum token. CryptoDerivatives.Market.

Hybrid/Smart contract based DEXs

0x : (similar to EtherDelta) On Ethereum blockchain, Ether or any ERC-20 Ethereum token. Price, volume, expiration time, and signature are fixed in smart contract with fill & partial fill option for taker. Off-chain broadcast to the off-chain order book server. Taker takes the offer by signing the contract and contract checks signatures. If funds are available and offer is filled, funds are moved. There are tokens to introduce governance to the platform system and the option to make direct P2P trades. Swap.tech : On Ethereum blockchain, Ether and any ERC-20 Ethereum token. Off-chain peer-to-peer negotiation via Indexer with the option to call an off-chain Oracle providing pricing information to makers and takers. Taker asks maker to get an order who responds with an offer. Taker takes the offer by signing the contract. Smart contract provides the option to cancel the order. Leverj whitepaper: On Ethereum blockchain. Order book and matching are centralized and are off-chain. User deposits into segregated account on Custodian and settlement through smart contract. Allows leverage trading. Loopring : On Ethereum blockchain, Ether and any ERC-20 Ethereum token. Employ a mechanism called “order ring” for matching orders to improve liquidity. Token.Store : On Ethereum blockchain, Ether and any ERC-20 Ethereum token. TokenStore contract is the key exchange contract with helpers Mandarin : Early stage, little details available. Bitsquare whitepaper: A peer-to-peer to buy and sell Bitcoin in exchange for national currencies or alternative cryptocurrencies. Bitmarket : LocalBitcoin Bitcoin escrow.

On-chain/separate smart contract blockchain

Bitshares : Smart contract blockchain. Industry-orientated. Price-stable smart coins. Cosmos : Inter-blockchain project based on Tendermint – DEX as a use case. EasyDEX : Cross-blockchain swap (so far only BTC and KMD), i.e. coins are exchanged directly between user wallets. NXT : Smart contract blockchain platform with asset exchange. Omega One : Smart contract blockchain. Trade engine, public/private exchange, balance sheet manager (settlement intermediation). OMG whitepaper : OmiseGo blockchain. Decentralized liquidity pool, decentralized order book and trading engine (mostly) for Ethereum blockchain. Lightning channels. PAX (Pegged Asset Exchange) InstantDEX accesses many different sources of liquidity. Wavesplatform specifications Waves general purpose blockchain platform. CounterpartyDex explication: Platform for exchange on Bitcoin blockchain. coinffeine : Bitcoin exchange. openledger : Platform for exchange on Bitcoin blockchain with cash out through PayPal, Ripple, or NanoCard.

Hardware supported DEX

Tesseract: A decentralized exchange using Intel SGX TEE.

References

If you liked this article, you might also like: