Blockchain101 Others Public Protocols What Is a DEX? Decentralized Exchanges, Explained By AtoZcrypto Posted on September 1, 2018 19 min read 0 2 724 First Published 28 AUGUST 2018 By BENNETT GARNER – coincentral.com A DEX is a decentralized exchange, and is essentially a new type of pair matching that allows people to place orders and trade cryptocurrencies without an intermediary institution managing the ledger or controlling user funds. Cryptocurrencies excited a lot of people because they created a way to trade value without the need for intermediaries. Blockchain technology allows strangers to trust one another without the need for a central institution. It’s an amazing technology with the potential to change the way we structure our economy and the way we think about trade. DON’T SPEND A PENNY ON BITCOIN WITHOUT FIRST READING THIS EBOOK! The challenge, of course, is in order to enter the ecosystem you need to purchase some cryptocurrency using a currency you already have (dollars, euros, etc). Typically, you’d do so at one of the major exchanges, like Coinbase or Kraken. However, those are both centralized institutions. They take your information, manage your accounts, and are vulnerable to slowdowns or outright attacks. Using centralized exchanges to buy cryptocurrency is an ironic experience. In order to enter a trustless, decentralized ecosystem, you have to trust a centralized institution. DEXs seek to change that experience, offering users ways to find one another and trade directly on-chain. No major DEX has a fiat gateway so far, but many competitors have built decentralized exchanges that allow for crypto-to-crypto trading. In this comprehensive guide, we’ll examine what a DEX is, the benefits and drawbacks of such an approach, and who the major players are in the race to build viable DEX platforms. Custodial vs. Non-Custodial, Centralized vs. Decentralized In order to understand DEXs, it’s important to realize that cryptocurrency exchanges exist on two basic axes: custody and centralization. Custody Custody refers to who holds the keys to accounts on the exchange. When you buy a Bitcoin on Coinbase, for example, it shows up in your Coinbase account, but you don’t actually own and control that Bitcoin yet. You need to request a transfer off Coinbase to an external wallet address that you control before the Bitcoin is really yours. If Coinbase is attacked, slowed down, or has technical issues, you don’t have recourse to secure your Bitcoin. This has been a problem so often with many exchanges that “funds are safe” has become a meme in the community as exchange operators attempt to reassure users in the wake of system problems. A non-custodial exchange leaves all funds in the private wallets of its users. Users can then submit and confirm trades on their own from their personal wallets, essentially using the exchange as a matching service. An in-between solution involves users submitting funds to open source, verified smart contracts that execute when a match is made and can be canceled at any time. This has the advantage of security and automation, but there is a period of time where funds aren’t in users’ wallets. If there’s an issue with the contract, the funds could disappear. Centralization Centralization refers to where the order matching, routing, and execution take place. In a centralized exchange, there’s a proprietary order book that reviews all incoming orders and creates matches between users. The exchange software and servers then execute the transaction. Decentralized exchanges operate on a network of computers. Some function directly on-chain through the use of smart contracts. Others rely on second-layer networks of trusted nodes, known as relayers, to find and make order matches. According to Tom Goldenberg writing at CoinDesk, 99 percent of trading volume takes place on centralized exchanges. Of these, 73 percent are custodial. The implication, here, is the vast majority of crypto trading happens through centralized institutions. To some, this is an enormous shortcoming of the cryptocurrency space, building the decentralized future atop centralized exchange providers. For others, it seems obvious that an exchange should be centralized. In fact, many have argued that “decentralized exchange” is an oxymoron. After all, an exchange is a gathering point where people congregate to trade. Of course, it should be a single entity to quickly facilitate transactions. As with most debates, both sides have merit to their arguments. The challenges of building a great non-custodial DEX are highly nuanced, but the benefits are also difficult to deny. Benefits of DEXs Trading on a DEX comes with many benefits that make it attractive to cryptocurrency users. Most importantly, DEXs disintermediate the exchange ecosystem, removing middlemen and allowing free, direct trade between parties. This fits with the decentralizing philosophy and mission of crypto generally. That alone makes DEXs a rallying cry for the decentralization-at-any-cost, libertarian diehards, of which the crypto community has a fair few. But there are other benefits to DEXs that the average user might also find attractive. 1. Anonymity Since DEXs in their purest form use only blockchain information, all you need to share in order to use a DEX is a public address. Most centralized exchanges require a complete signup process with name, email, and even bank account information. Even anonymous crypto-to-crypto exchanges still require location information and other personal details to comply with government regulations and restrictions. That said, if DEXs come to greater prominence, they’ll likely meet up against regulators. Most DEX creators plan to say they’re only releasing open source software and are not liable for what the community does with that software, thus avoiding the KYC and AML issues. However, it remains to be seen if that argument holds up legally long-term, especially if damages result from a poorly written smart contract or security flaw. 2. Control of Funds DEXs are generally, but not necessarily, non-custodial. As a result, users keep control of their funds throughout the entire transfer process until the moment of exchange, when a smart contract executes the signed trade. No more “funds are safu” messages. Keeping your funds safe is your own responsibility of a DEX. 3. Hacks Since a DEX exists across a network of computers, it becomes much more complicated to attack. There’s no single point of entry or failure. This makes DEXs exponentially more secure. It also makes them more difficult to design and test, which is one of the reasons why DEX development has been slow to date. 4. Downtime Because there’s no single point of failure in a distributed exchange, there’s less chance of DEX going down. Rollouts of updates happen on a node-by-node basis. Even if individual nodes have to go down due to maintenance or an attack, the remaining nodes can still operate the exchange network. Drawbacks of DEXs DEXs are inherently more complicated than their centralized counterparts. This leads to challenges in implementation and usability that major DEXs have yet to fully address. 1. Usability The first and biggest challenge is user-friendliness. Creating an account on a major centralized exchange is a fairly straightforward process, and it functions much like banking and brokerage applications that users are familiar with. On the other hand, using a DEX requires connecting to a dapp or even installing a standalone DEX client. At its simplest, you may only need to set up a MetaMask wallet, fund that wallet, then connect with an Ethereum-based DEX dapp. At its most complicated, you might have to set up an independent node and stay online for long periods of time to sign transactions. 2. Simplified Trading Tools Centralized exchanges offer advanced tools like options and margin trading. These simply aren’t possible for today’s DEXs. Trading on a DEX typically includes buy or sell orders only. 3. Low Liquidity DEXs represent about one percent of the cryptocurrency market’s trading volume. As a result, only low volume trading of popular coins is possible. There’s not enough liquidity to allow for high-volume trading, and there are no centralized institutions providing market maker services. 4. Latency When you make a trade on an exchange, you want as close to instant execution as possible. Otherwise, you could miss out on a price change. Unfortunately, DEXs so far have shown slow cancelation and slow order processing times, since all requests have to propagate across the decentralized network. As a result, price slipping–price changes between order time and execution time–is common. 5. Front-running Because you must broadcast your intentions to the entire network in order to execute a trade, it’s possible for bad actors on the network with fast connections to jump ahead of you in line and buy up coins at a lower price in order to sell them back to you. Known as front-running, this practice undermines the fairness of the exchange. There’s no real way to make sure miners or relayers on a decentralized exchange can’t jump in line for orders. Currently, DEX creators are working on potential solutions that involve signatures or collateral, but no concrete solution exists thus far. 6. Real Decentralization? Some DEXs still require you to hand over custody of your coins. Others involve small, centralized node networks of relayers. Still, others run an off-chain order book that must be maintained somehow by third-party entities. These caveats all subvert the exchanges’ claims of decentralization. Top DEX Projects While DEXs only make up one percent of the total market trading volume, there are still quite a few projects in the space. EtherDelta and IDEX are two of the most established decentralized exchanges. They’re limited to tokens built on Ethereum, and they both have some first-generation usability issues. More recent entrants, like Bitsquare, Bitshares, Waves DEX, and 0x have greater flexibility for more coins and features. Each platform comes with its own challenges for usability, future developments, and liquidity as well. These are just a few of the many projects attempting to decentralize coin transfers. Other projects are working on atomic swaps, instant order processing, and integrations for second-tier technologies like Lightning Network to make DEXs more usable. The Future of Decentralized Exchanges There are still major technical hurdles facing DEXs moving forward, and complete decentralization isn’t possible or even desirable. Most likely, a hybrid model will prevail where the speed and front-running protections of a centralized order book meet the security and non-custodial nature of decentralized solutions. Atomic swaps, Lightning, and other layered solutions will make the transition and hybridization easier. It’s also still unclear the role regulation will play in all this, and perhaps exchanges will still need centralized authorities to collect KYC information and answer to government regulators. Ultimately, the technology behind today’s DEXs will drive a wave of innovation in the ways coins get traded. We’ll see fewer security issues as exchanges diversify their network of nodes and greater coin custody for exchange users. The perfect DEX is probably imaginary, but if development continues, we’ll get a lot closer to fair, fast, cheap, and secure coin trading.