Decentralized Cryptocurrency Exchange Most Comprehensive Tutorial

Decentralized Cryptocurrency Exchange Most Comprehensive Tutorial

in Cryptocurrency

Bitcoin, the first decentralized blockchain-based cryptocurrency initially was created to bypass third parties during the transaction process. With Bitcoin miners, such currency problems like fraud and censorship are also seemed to stay behind. The mining itself means that there is no more any control over the money producing and no economic crisis can ever happen. 

 

However, it seems that the decentralization idea is forgotten: people created cryptocurrency exchanges with centralized servers to operate with decentralized tokens. Sounds ridiculous, doesn’t it? 

 

But how else do we exchange our cryptocurrencies, you may ask. On a decentralized cryptocurrency exchange! 

 

Contents: 

  1. What is a Decentralized Exchange? 
  2. Cryptocurrency Market Overview
  3. Decentralized Exchanges Criteria 
  4. Decentralized Exchanges Benefits 
  5. Decentralized Exchanges Downsides 
  6. Decentralized Exchanges Projects
  7. Funds Management
  8. Trading Logic
  9. Why are the decentralized crypto exchanges not adopted? 
  10. List of decentralized crypto exchanges
  11. Conclusion

 

What is a Decentralized Exchange? 

 

A decentralized exchange (DEX) is a cryptocurrency exchange market run on a distributed ledgerю It creates p2p (peer-to-peer) marketplaces on the blockchain and allows traders to control their own funds. 

This aim is reached with the help of proxy tokens (which represent fiats or crypto coins), assets (represent companies’ shares) or a multi-signature escrow system (like in peer-to-peer cryptocurrency exchanges). 

 

What is a Decentralized Exchange

 

However, the majority of currently-existing cryptocurrency exchanges are semi-decentralized. They have a centralized server that holds order books, but anyway it doesn’t hold IDs or private keys, unlike the centralized crypto exchanges. 

 

Cryptocurrency Market Overview

 

According to the Coinmarketcap website, the total market capitalization level in April 2013, was $1 599 410 000. Nowadays it can be estimated at $277 071 833 878 which is 173 times more: 

 

Cryptocurrency market chart

 

 It also means that the cryptocurrency market has grown up to 17323 percent. 

 

Cryptocurrency market chart

 

In the same way, a 24-hour volume has grown from $0 to $12 885 900 000. 

 

The number of live crypto exchanges has enlarged 170 times. The majority of them are centralized ones.

 

Decentralized Exchanges Criteria 

A Decentralized Exchange should comply with the following parameters: 

  1. Traders own their capital, not a server or any other middleman
  2. Order books are compiled by the traders and the orders are transmitted between them directly through blockchain. 
  3. Orders match from trader to trader in a direct way as well and 
  4. Their apps produce the crypto money exchange, not a third party. 

 

In order to be a decentralized an exchange should meet the following criteria: 

  1. No ID inquiry (no e-mail, Facebook, Google, etc.)
  2. No third parties
  3. No replacement, IOU ("I owe you") / intermediate token/coin or a coloured coin approach
  4. Noone runs the exchange 
  5. No profit from the transactions
  6. No withdrawal limits
  7. No centralized order books
  8. None centralized crypto exchange functions
  9. No cost lists 
  10. No certain coin pairs to trade.

 

Decentralized Exchanges Benefits 

Decentralized Exchanges Benefits

 

  • Works like the Internet. Fast & Cheap. 

I mean, the decentralized crypto exchanges work globally, all the transactions are produced fast and efficient. Moreover, they are cheap - the cost can be hundreds or thousands times less than the centralized’ ones. 

 

  • Clear like water

All the transactions and codes processing in the network is open and accessible to everyone. 

 

Clear like water bitcoin

 

  • Secure

A middleman can be hacked, corrupted, robbed or coerced while with decentralized crypto exchanges all you private keys are under your control. A hacker will have to compromise half of the world to get access to the steering control.

 

  • Hardware wallets integration 

Yes, you can integrate a decentralized exchange with your hardware wallet like Trezor or Ledger Nano to send and get funds directly to your wallet. 

 

Hardware wallets integration

 

  • No identity documents (ID) / Funds control

Your private key is your ID. If you keep it, it is yours. 

 

  • Financial innovation 

When Wikipedia appeared an information revolution happened. everyone can now click and get the necessary information about almost everything he wants. With the decentralized crypto exchanges, the same happens in the financial sphere. 

 

Financial innovation

 

  • No banks or governments. Borderless Anonymity.

You own your private key. Noone knows that this string of letters and numbers belong to you if you don’t tell this someone. You don’t know who is behind the addresses in the blockchain network. So no one has to hide them. Or to store in a company like banks. And no government can demand your IDs and addresses. Brave new world! 

 

Decentralized Exchanges Downsides 

 

  • Hard to understand

Centralized crypto exchanges have everything to get a lot of users - intuitive interfaces, understandable buttons, and tubs. As to the decentralized ones - well, you will need some time and patience to understand smart contracts and their working principle. However, the gamble worth taking. 

 

  • No basic functions

Decentralized crypto exchanges don’t have the basic functionality such as margin trading, stop losses etc. 

 

  • Low trade volume

Because of the previous items, the transaction volume here is low that’s why it may be hard to find a business partner to trade. 

 


Decentralized Exchanges Projects

A decentralized crypto exchange runs on open protocols which provide liquidity common pools - enable to communicate with each other. 

 

The basic open protocols are the following: 

 

Ox protocol was created specifically for ERC20 tokens to merge off-chain orders with on-chain settlements. The division between the two is to provide low ether gas fees. The native token of the protocol is Ox (ZRX). The order protocols called “relayers” broadcast orders to the blockchain network. A buyer fulfills the order, the trade or exchange is taking place and the order broadcasts. 

 

Here is how the founders describe Ox Protocol in the white paper:

 

“We describe a protocol that facilitates low friction peer-to-peer exchange of ERC20 tokens on the Ethereum blockchain. The protocol is intended to serve as an open standard and common building block, driving interoperability among decentralized applications (dApps) that incorporate exchange functionality. Trades are executed by a system of Ethereum smart contracts that are publicly accessible, free to use and that any dApp can hook into. DApps built on top of the protocol can access public liquidity pools or create their own liquidity pool and charge transaction fees on the resulting volume.”

Ox protocol

 

Kyber Network is a platform for decentralized crypto exchanges to enable instant on-chain cryptocurrency exchange or trade. It has a lot of similarities with the Ox protocol such as the search of low-liquidity problem solution and the high-cost minimization. However, all the activities are implemented on-chain. The native token of the system is Kyber Network Crystal (KNC) (ERC20 token as well). 

 

The liquidity is achieved with the help of the Dynamic Reserve Pool. Once the exchange request comes from a buyer, the protocol finds the best available exchange rate for him. 

 

Here is how the founders describe Ox Protocol in the white paper: 

 

“We design and build KyberNetwork, an on-chain protocol which allows instant exchange and conversion of digital assets (e.g. crypto tokens) and cryptocurrencies (e.g. Ether, Bitcoin, ZCash) with high liquidity. 

 

KyberNetwork will be the first system that implements several ideal operating properties of an exchange including trustless, decentralized execution, instant trade and high liquidity. Besides serving as an exchange, KyberNetwork also provides payment APIs that will allow Ethereum accounts to easily receive payments from any crypto tokens. As an example, any merchant can now use KyberNetwork APIs to allow users to pay in any crypto tokens, but the merchant will receive payments in Ether (ETH) or other preferred tokens.

 

Although running on the Ethereum network, KyberNetwork’s roadmap includes supporting cross-chain trades between different cryptocurrencies using relays and future protocols like Polkadot and Cosmos. Ethereum accounts will be able to safely receive payment from Bitcoin, ZCash and other cryptocurrencies via our payment APIs, through this trustless payment service. Derivatives will be introduced to mitigate the exposure to the risk of volatilities for the users of KyberNetwork Crystals (KNC) and selected cryptocurrencies. This will allow users to participate.” 

Cyber network protocol

 


Airswap also reminds Ox protocol except for the off-chain trades negotiation, unlike the Ox’s relayers system. 

 

As to the other moments, the founders told about them better: 

 

“We present a peer-to-peer methodology for trading ERC20 tokens on the Ethereum blockchain. First, we outline the limitations of blockchain order books and offer a strong alternative in peer-to-peer token trading: off-chain negotiation and on-chain settlement. We then describe a protocol through which parties are able to signal to others their intent to trade tokens. Once connected, counterparties freely communicate prices and transmit orders among themselves. During this process, parties may request prices from an independent third party oracle to verify accuracy. Finally, we present an Ethereum smart contract to fill orders on the Ethereum blockchain.”

Airswap protocol

 

  • OmiseGO

OmiseGO aims to build a decentralization crypto exchange system that accepts all possible crypto coins. 

 

The founders describe their protocol in such a way: 

 

“OmiseGO is building a decentralized exchange, liquidity provider mechanism, clearinghouse messaging network, and asset-backed blockchain gateway. OmiseGO is not owned by any single one party. Instead, it is an open distributed network of validators which enforce behavior of all participants. It uses the mechanism of a protocol token to create a proof-of-stake blockchain to enable enforcement of market activity amongst participants. This high-performant distributed network enforces exchange across asset classes, from fiat-backed issuers to fully decentralized blockchain tokens (ERC-20 style and native cryptocurrencies). Unlike nearly all other decentralized exchange platforms, this allows for decentralized exchange of other blockchains and between multiple blockchains directly without a trusted gateway token.” 

Omisego protocol

 

Let’s try to understand the decentralized cryptocurrency exchange’s working principle in the EtherDelta example. 

 

Etherdelta crypto exchange

 

EtherDeltra is existing decentralized crypto exchange run by Ox protocol. The main aim of the crypto exchange is to guarantee open protocol for DEX. The native cryptocurrency there is - as you can guess yourself - ZRX which provides management tools in smart contracts and protocols. 

 

The user interface of the crypto exchange is rather difficult: 

 

EtherDelta interface


Ethereum smart contracts are pieces of code which are written in Solidity language and compiled by Ethereum Virtual Machine. Everyone can read the code here .

 

Here we will look through the Funds Management and Trading Logic parts of the code. 

 

Funds Management

 

As I already mentioned, the decentralized crypto exchanges allow users to control their funds. The funds are pooled in the smart contracts which are in a distributed ledger. The bottom line of the code underlines that a user can easily withdraw or deposit funds on his own. 

 

Funds can be moved by two mechanisms: 

  • Ethereum (ETH) moving
  • ERC20 tokens moving

 

The majority of ICOs are ERC20 tokens on the Ethereum blockchain. 

 

On the screen of the code, only one of the methods is payable because the Solidity safety mechanism allows sending ETH. However, to move ERC20 token a client should implement one more step. 

Solidity code explanation

 

Trading Logic

Newmarket orders are stored on-chain (in the smart contract) or off-chain (middleman). In fact, it’s expensive to store them on-chain, that’s why the following mechanism works: 

 

A person (Maker) open a sell or buy order. Another person (Taker) browse the orders to make some actions with them. Elliptic Curve Digital Signature Algorithm (ECDSA) starts working. 

 

How it looks from the inside: 

  1. Maker creates ERC20 token order, specifies its amount, points out the amount of ETH in exchange, and the kind of the order (buy/sell). 
  2. Then, using SHA3 he creates the order’s cryptographic hash
  3. Using the ECDSA the maker signs the order hash with the help of his Ethereum private key. 
  4. He sends the order and the signature off-chain
  5. Taker trades against the order and the order data with his key comes to the trade function of the smart contract, where 
  6. the smart contracts verify the signature and 
  7. ensures that the order is not filled or expired. 
  8. The operation happens - voila - funds are transferred and fees are taken. 

 

Solidity code explanation

 

Line 5 - a unique market order - hash with order amount, price, expiration. 


Line 7 - on-chain order is checked and verified. 

 

Then the validation is complete and fees are charged: 

 

Solidity code explanation


Why are the decentralized crypto exchanges not adopted? 

It seems the crypto exchanges grunts us new opportunities but a few people have heard about them and even fewer use them. Why? I suppose, there are two factors for that - lack of education and Technology difficulties. How ’s that? 

 

  • Lack of education - people unaware that there is/are: 

  1. Decentralized Crypto Exchanges
  2. Its advantages
  3. Its drawbacks 
  4. How to manage private keys

Lack of education

  • Technology difficulties

  1. Usability: hard to use, not an intuitive interface
  2. Speed: long time to make a transaction
  3. Liquidity: Large adaptation ecosystem that needs time to join. 
  4. Full decentralization: Not all the services are decentralized so far.
  5. Front-running risk: Market manipulation can take place as miners can preview transactions before the validation. 
  6. Accessibility: the cryptocurrency market is volatile, so there is a need for stable crypto coins and fiat integration. 

technology difficulties


List of decentralized crypto exchanges: 

  1. AirSwap (Airswap blog)
  2. Altcoin.io (Altcoin.io Exchange)
  3. Barterdex (by Komodo Platform)
  4. Bancor Protocol (Bancor)
  5. Bisq (ex Bitsquare)
  6. Blocknet (TheBlocknet)
  7. Coinffeine:
  8. Catalyst (by Enigma Project)
  9. Etherdelta
  10. Etherex
  11. Forkdelta
  12. Gnosis Dutch Exchange (by Gnosis)
  13. Heat
  14. Herdius 
  15. Hodl Hodl
  16. IDEX (by Aurora DAO)
  17. KyberNetwork
  18. Legolas 
  19. Loopring
  20. Lykke
  21. Mothership 
  22. NEX
  23. Next.exchange
  24. Nvo.io
  25. Oasis DEX
  26. OmegaOne
  27. OpenANX
  28. Raidex
  29. SingularX
  30. Stellar Distributed Exchange
  31. Streamity
  32. Token Store
  33. Waves 
  34. Xchainge

 

Graphene Decentralized Crypto  Exchanges:

  1. Bitshares
  2. Blocktrades
  3. BTSABC
  4. CryptoBridge
  5. Cybex
  6. DEEX Exchange
  7. GDEX
  8. OpenLedger
  9. RuDEX

 

0x Relayers

  1. Amadeus
  2. DDEX 
  3. Decent Ex
  4. Dextroid
  5. ERC dEX
  6. Ethfinex
  7. IDT Exchange
  8. Paradex 
  9. RadarRelay
  10. The Ocean X 

 

Conclusion: 

Decentralized cryptocurrency exchanges is a way to a new world that was suggested by Satoshi Nakamoto initially. The route is long and difficult, full of dangers and surprises.There are a lot of new innovations and implementation ahead. 

 

I wrote this guide to underline that this world exists and which is more, it lives and operates. There is an alternative of centralized crypto exchanges, there is an absolute freedom. And there are us who stopped never making the last step. Let’s make this step together! 

crypto coins


Follow us on Twitter! 


 

Facebook Comment
Security Cryptocurrency or not Security is not Question for ISA

March 20, 2018

Security Cryptocurrency or not Security is Read more