An Intro to De-Fi — Part III — Decentralized Exchanges (DEX)
We talked about Decentralized Exchanges in Part I of this series briefly. We received a number of requests to cover them in greater detail, and so here it is: A more detailed post on DEXes.
Centralized Exchanges (CEX)
First off, let’s talk a bit about CEXes and the problems we face with them. A CEX is similar to other traditional web-based services in that it’s usually a website where users create accounts and log into a view of their own personal account on the service.
The flow of how one would buy crypto on this type of services goes something like this:
Deposit fiat currency (USD, EUR, INR etc..) into your account -> Check prices of the crypto token you want and find a suitable level -> Place an order to buy the token -> Order gets filled -> Leave the token on the exchange in your account or withdraw to your own wallet.
As you can imagine the process of selling crypto is quite similar except that you start by depositing crypto to the exchange and withdraw fiat to your bank account, when you are done selling.
While this is great and is probably how 99.99% of people acquired their first crypto, it does leave a lot to be desired.
Problems
There are a number of problems with the flows described above for how people acquire and dispose of crypto in a CEX. Let’s cover them one by one.
Prone to Theft
It’s possible that your exchange is fraudulent and intends to steal your funds. Once you deposit fiat or crypto to an exchange they are in addresses or bank accounts controlled by the exchange. You are now dependent on them to perform as good actors and return your funds when you wish. This is unfortunately not always the case. There have been a number of high profile cases such as Quadriga and others where huge amounts of crypto were stolen by the exchange operators.
Can be hacked
CEXes by their very nature hold a lot of user funds and are natural targets for hackers that wish to breach the security systems of the exchange to steal funds. Again, there have been several high-profile cases such as Mt. Gox in 2013 and Binance more recently. While the security is getting more sophisticated, so are the hackers. This will likely always be a problem for CEXes.
Lack of Censorship resistance
One of the main pillars of Cryptocurrency is that it is decentralized technology that is resistant to censorship. Even today there is nothing any entity can do to stop a person from sending crypto anywhere in the world they wish. This is not the case with crypto exchanges. One may be subject to censorship by the exchange themselves or by exchanges at the behest of their governments.
Since exchanges are typically companies with a physical office, registration and known physical location, they tend to comply with local laws and decrees handed to them by their governments. This somewhat defeats the notion that cryptocurrency is decentralized and resistant to censorship.
Need for KYC / AML
Most centralized exchanges have to comply with some form of KYC (Know your customer) / AML (Anti money laundering) laws and collect information on their customers on behalf of their governments. This is onerous at best for most people and untenable at worst for people who are concerned about their privacy.
Can be Shutdown
Centralized exchanges can be shut down quite easily by governments, should they choose to. It behooves us in the Crypto space to develop alternatives.
Difficult to achieve full transparency
A somewhat more subtle point is that once you deposit your cryptocurrency to an exchange and trade it, all of those transfers occur internally and not on any public blockchain. To the outside world, the only 2 transactions that are visible are the deposit and the withdrawal from exchange addresses.
This leads to some concerns about transparency and if, for instance, an exchange is in possession of all the funds they need to fulfil user withdrawal requests. Quite similar to a traditional bank in that respect.
Enter the DEX
DEXes solve a number of problems that affect CEXes. First off, let’s start by defining what a DEX is. A DEX or decentralized exchange is a mechanism for users to exchange crypto value through a decentralized system, in a trustless and non-custodial manner. Let’s break this down.
Decentralized
A core of a DEX is typically a Smart contract that either A. maintains an orderbook of all the users that wish to sell or buy crypto (Etherdelta, IDEX) or B. maintains a liquidity pool of various crypto tokens and a set formula to calculate the price of a particular trading pair (Uniswap, Kyber). A user can choose to take an existing order on the orderbook or add a new one, in the case of A, or exchange one token for another at a calculated price, in the case of B.
Anyone can deploy a DEX smart contract and build a UI to frontend the experience, which makes it decentralized.
Trust-less
The users crypto wallet typically integrates via a web-based UI with the blockchain in question with technologies like Web3.js. They can then swap their tokens for the ones they want in a trustless manner i.e. the smart contract has been written in such a way with the appropriate locking mechanisms to ensure that a transaction involving a token swap either finishes completely without error, or not at all.
Non-custodial
The token swap described above takes place in such a way that there is no third party in between the users swapping tokens that has control over the tokens at any point in time, during a swap transaction.
DEXes — Not a panacea
By implementing peer-to-peer exchange of value with decentralized smart contracts facilitating the transaction, DEXes have somewhat solved the CEX issues of Censorship resistance, KYC / AML, Shutdown and Transparency (not completely as we’ll see).
They have also solved the problem of large scale theft or hacking as there is no central entity holding a large amount of funds (Individual users can still get hacked, which while unfortunate is less of a problem).
While the above mechanisms improve a lot and solve some of the issues faced with CEXes, it is not a complete solution.
Censorship, Shutdown still an issue
As was seen in the recent case of the SEC vs Etherdelta, just being technically decentralized does not insulate one from a Government crackdown or censorship resistance. The issue here was that a. Etherdelta was still a real-world company with an office in San Francisco and b. They were allowing the trading of what the SEC deemed securities on their platform without the proper registration.
Fiat onramp
Most if not all transactions facilitated by DEXes are crypto to crypto swaps. While that is great, this means that they do nothing to solve the problem of onboarding new users that wish to exchange fiat currency for crypto. This is something that we at Indra Crypto Capital call ‘The Holy grail’: Being able to accept fiat payments into a system in a decentralized manner. A solution to this problem will mean that cryptocurrency will become an unstoppable force of nature worldwide and mean game over for the ones that would like to censor or shutdown the technology.
While there are notable examples such as Localbitcoins, a service that facilitates people meeting offline to complete the exchange, or BISQ, another peer-to-peer service that conducts the transaction online but involves a complex dispute resolution, arbitration and escrow process, no one has solve the problem in a simple, scalable and earth-shattering way.
Cross blockchain Atomic swaps
Most DEXes are based on one of the main blockchains that support tokens on their network i.e. Ethereum, EOS or Tron to a lesser extent. This means they facilitate transfer of value by swapping tokens within their respective blockchains e.g. MKR-ETH, USDC-ETH, EOS-DICE and so on.
While there are a few notable examples that have begun work on Atomic swaps, a technology that helps with Cross blockchain trustless exchanges of value e.g. DCR-BTC, LTC-DCR and so on, this technology needs to be developed further.
User beware
DEXes are typically meant for the more advanced user, which in and of itself is a problem. One needs to understand Wallet software, Browser plugins for a start, but that’s not all. How do you know that a DEX does what it says it does? That the smart contract code is exactly what was deployed to the blockchain? That a service is masquerading as a DEX, but really does take possession of funds or worse yet steals them? Users need to get familiar with Smart contract verification among other things.
More likely there will be trusted providers that will roll out this type of service to users, who will delegate the verification to them.
Solutions
There are things that DEXes can do to mitigate or solve the problems described.
Really decentralize
No company, No physical office. Open source the DEX smart contracts and reference UI implementations. Allow anyone to verify and deploy the code on anonymous nodes on the internet. Throw away the keys, like you know, none other than Satoshi did.
Setup a DAO (Decentralized Autonomous Organization)
A DAO is essentially a set of smart contracts that is managed and controlled by a community on the blockchain. Having a decentralized community of interested parties and no central actors operating the exchange, with it’s best interests at heart, is a good solution to the risk of getting shut down or censored.
Atomic Swaps, Easy-to-use Fiat Onramps
The Atomic swap technology needs to be extended to cover more Cryptocurrency pairs. A DEX fully integrated with both atomic swaps and intra-blockchain token swaps in a seamless easy-to-use interface that includes fiat to crypto swaps would be ideal.
However, CEXes are going to be an important part of the Crypto ecosystem for the foreseeable future, notwithstanding the issues noted above. They will continue to play a key role. A fully integrated solution that ties a CEX in with a DEX with a unified user interface would be a good interim step towards the ideal solution.
Conclusion
While it may seem like it, this piece does not intend to convey a message that CEXes are bad, DEXes are good. There are great and not-so-great players of both types. Crypto would never have achieved the level of adoption it has without CEXes.
Until the ‘Holy Grail’ is found, they will be a necessary and important part of the crypto ecosystem. DEXes are great, but suffer from their own set of problems with possible solutions, as described above. Having said that, the desired direction is clear. We should continue to push the ‘decentralization’ envelope to it’s logical endpoint. We should find the holy grail and watch this space really explode in terms of usage and adoption.
Finally, do check out Part I and Part II of this series if you have not already.
Connect with us
Join our communities and participate in the ongoing discussion.
Twitter, Facebook, Telegram, Email, Medium, LinkedIn
Please leave your comments and questions about Indra Crypto Capital, YieldWallet or anything else you’d like to talk about and we will be sure to get back to you.