The development of robust exchange platforms has become critical to advancing the tokenized economy. As the cryptocurrency market goes mainstream, there is massive demand on exchanges to quickly and securely facilitate digital asset trading for the masses. This article explains centralized vs. decentralized exchanges, and compares the functionality of different types of decentralized exchanges when it comes to achieving their goals.
Technologically, there are a couple of ways to justify the current hype surrounding blockchain technology. One of them is the possibility to decentralize formerly centralized information systems, thereby distributing control over them. This is considered beneficial for a number of reasons: First, decentralization may help to increase bureaucratic efficiency by rendering centralized management of information obsolete, instead running a consensus algorithm which decides on various issues. Second, it is expected to increase security of the system by distributing control over a shared ledger. In theory, the distribution of control over a network means there no longer is a single point of failure. To control the ledger, one now needs to control the majority of an entire network instead of a single central database. Lastly, a centralized information system may be rejected out of purely ideological reasons, as in the belief that an economic system should be organized through peer-to-peer trade which is unmediated by a central authority.
The 2008 Bitcoin whitepaper, which sparked a huge amount of blockchain innovation, envisioned the cryptocurrency Bitcoin as a peer-to-peer electronic cash system independent of centralized monetary authorities.
Fast forward to 2018 and traditional centralized models of custodianship remain the dominant form of storing and exchanging digital assets. The vast majority of digital tokens are currently stored on centralized exchanges. The old structures of centralized store and exchange of value seem to have persisted culturally as well as technically.
Why exactly is this bad? Because centralized exchanges are vulnerable to the same criticism that other centralized institutions face. Centralized exchanges become critical points of failure, which due to the large amounts of digital token value they store, are increasingly attractive for attacks. The recent loss of 500 million USD worth of a cryptocurrency called NEM on Japanese exchange coincheck is only one of a handful of significant losses on centralized exchanges. Even though these losses are unconnected to the security of blockchain technology, such losses clearly hurt public perception of blockchain and slow down adoption.
In short, centralized exchanges keep their systems off-chain meaning that transactions are not stored on the blockchain. As a result, a centralized exchange will never provide the same security which stems from a distributed network of peers.
It is also critical to note that most centralized exchanges do not pass on control of private keys, thereby only giving users indirect access to the stored assets. Thus, significant trust needs to be put on the exchange for something that was originally devised as a trustless technology. Counterparty risk, in the form of incompetent or ill-intentioned exchanges or regulatory uncertainty may be the ultimate reason for why new ways of storing and exchanging digital assets are on the rise.
Introducing the Decentralized Exchange (DEX)
One potential solution to the problems outlined above is the decentralized exchange, or decentralized exchange protocols (DEXs). These systems are trying to build peer-to-peer marketplaces to differing degrees. Some try to take ideas from the structure of centralized exchanges and add decentralized elements, while others take a more radical peer-to-peer approach in the decentralization of digital asset trading. Most adopt the concept of an order book in their design decision while some embrace a more peer-to-peer alternative of directly swapping assets with others.
An element which all of the DEXs share is their non-custodial nature. Users remain in control of their funds while trading on these platforms. Leveraging the potential of smart contracts, users only give away control over their funds once the trade has been executed. Currently, a common limitation of DEXs is low levels of liquidity given that most trades are still done on centralized exchanges.
Here is a short and non-exhaustive overview of a handful options for decentralized exchange protocol design. The differences between these types of exchanges will be further explained thereafter.
on-chain order book: Etherdelta, Omisego
on-chain peer-to-peer: KyberNetwork
off-chain order book: 0x
off-chain peer-to-peer: Airswap
Note that whether something strictly qualifies as a peer-to-peer network is a contentious philosophical question, which is why the list above is only correct to a certain extent. Obviously, there are many different interpretations as to what these applications represent.
Decentralized Exchange Protocols: Hosting an Orderbook
When designing an exchange of value, we need to be mindful of the following characteristics all exchanges share in theory: An exchange matches those that want to sell a specific asset (makers) and those that want to buy a specific asset (takers). On centralized exchanges like Coinbase and Bitfinex, the exchange hosts a centralized order book where orders of both kinds are being recorded. Once the orders match, the centralized exchange fills the order. All of this happens off-chain.
The problem with current implementations of decentralized exchanges is that they are slow due to low liquidity. Plus, already existing decentralized exchanges like Etherdelta host order books on the blockchain to provide security. Hosting order books on chain slows down trading when the used blockchains themselves have scaling problems. For example, hosting, modifying or cancelling an order on the Ethereum blockchain will cost gas on the Ethereum blockchain. The decentralized exchange protocol 0x technically solves this problem by the principle of “off-chain order relay, on-chain settlement”, meaning the broadcasting of orders off-chain and the settlement of trades in ERC 20 tokens (native Ethereum tokens) on-chain. Cryptographically signed offers are broadcasted by makers off the blockchain to so-called relayers (3). Relayers curate order books off-chain (4) and provide those for takers to go on and settle the trades on the Ethereum blockchain (6) (see Graphic 1).
In theory, the hosting of order books by several specialized relayers is meant to provide the necessary liquidity for trading. Relayers, exchanges building on the 0x protocol, provide automated smart contracts where users can store their assets until their particular order gets filled by a taker. Unlike in centralized exchanges, relayers no longer control the assets that are being traded on the exchange, but only host order books with liquidity provided by the end users. For the hosting of order books relayers receive fees in the 0x protocol native currency ZRX. Over time the competition of various relayers will lower prices.
Technically, big centralized exchanges like Coinbase and Bitfinex could become future relayers on the 0x protocol. This would guarantee that users still remain in control of their funds due to the non custodial nature of the 0x protocol while benefiting from shared liquidity pools.
Decentralized Exchange Protocols: Peer-to-Peer
Contrary to the principle of “off-chain order relay, on-chain settlement”, KyberNetwork aims to build an exchange which performs all necessary steps for the exchange of tokens on the Ethereum blockchain. As we said before running order books on chain can be very costly in case orders need to be taken offline or adjusted slightly. With this in mind, KyberNetwork decided to build a peer-to-peer network which performs trades through smart contract built entirely on the Ethereum blockchain. This way it can offer a trustless trading experience paired with affordable fees.
KyberNetwork tries to solve currently low levels of liquidity on decentralized exchanges through the introduction of so-called reserves. Reserves already provide high levels of liquidity which can be leveraged for the platform. In the initial stages KyberNetwork plans to be the first reserve in the network, but in the long run hopes to win over big exchanges as part of the reserve system.
In addition to offering an exchange for tokens, KyberNetwork wants to provide a solution to the immense fragmentation of the token economy into services which only are accessible through specific tokens. Service providers can use the Kyber smart contract interface to enable users to pay for the service in whatever other digital currency and letting Kyber reserves provide the necessary token. Thus, a user can send token A to an intended recipient who accepts payment in token B in one single transaction.
An even more radical approach for decentralized exchanges is off chain peer-to-peer trading. One of the projects which intends to build such an exchange is the ConsenSys backed Airswap. Users are supposed to match off-chain and settle the transaction on-chain. The way users are able to find each other on the exchange ecosystem is through a so-called indexer. The indexer aggregates intentions to trade which does not include the running of an order book.
Once the taker has gathered information on potential deals with makers from the Indexer, he can optionally call on an Oracle to receive price information. The Oracle helps both makers and takers make more educated pricing decisions and smooth the negotiation process. Because settlement of the trade ultimately happens on-chain on a peer-to-peer basis, Airswap is able to provide a high level of privacy than its counterparts.
The Question of Adoption
To overcome the problems associated with centralized exchanges, projects have come up with a variety of contrasting design decisions to create trustless exchanges. In theory, decentralized exchange protocols provide increased security over traded assets while not compromising on trading liquidity.
If we want to answer the question of why and when decentralized exchange protocols will be adopted, we need to understand what drew users to centralized exchanges in the first place. One of the reasons clearly is the low level of responsibility over assets associated with holding funds on a centralized exchange. When these exchanges do not hand over private keys, users cannot be expected to manage and keep those.
Increased regulatory attention on these centralized exchanges will furthermore make sure that in case of theft exchanges have to compensate users for their losses as we saw in the recent loss of NEM on Coincheck. Holding digital assets on a centralized exchange will more and more resemble one’s relationship with a bank who assumes responsibility for customers’ funds by law. The decision to withdraw funds from a centralized exchange then becomes more of an ideological one in line with reasons for why we designed decentralized systems in the first place.
Users may also put their assets on decentralized exchange protocols for fear of regulatory uncertainty pertaining to centralized exchanges.
Finally, as the description of the various alternatives has shown, decentralized exchange protocols are a promising way to lower barriers of entry for exchange services. Relayers for order books can more easily be set up through the 0x API than an entirely new centralized exchange. Reserves on KyberNetwork may enable easy swaps between currencies for a better user experience in the tokenized economy. Decentralized exchanges of the future may be the channels through which most of economic activity in the tokenized economy transacts.