In part one of the ListedReserve smart contract series, we explored the potential for a blockchain based smart contract to serve as the basis for trustless financial transactions involving digital assets. One key application of this potential is in decentralised exchanges (DEXs), where smart contracts are used as the basis of a market involving the sale and purchase of digital assets.
To understand the power of a DEX, we must first define what a centralised digital asset exchange is. Centralised digital asset exchanges are typically based around a single company structure, with that company governing everything from the market structure to the escrow and exchange of assets.
A centralised exchange requires users to deposit their assets into an account with a centralised exchange (a bit like modern banking), trusting the exchange to hold their assets securely. They then proceed to trade those assets on markets created by that exchange. Finally, they withdraw their newly exchanged assets from the exchange to their personal accounts. These centralised exchanges make profits by charging fees at each stage of the process, usually with users paying the bulk of their fees for ‘making’ markets and ‘taking’ prices, on top of small charges on deposits and withdrawals. Currently, most of the top digital asset exchanges like Binance and Bitfinex are centralised.
DEXs differ in that they create a transaction infrastructure which makes the process entirely trustless. Instead of using a centralised database of user accounts, trades are done via the use of individual wallets on a particular blockchain. Market based trades are conducted via the use of smart contracts, with the smart contract performing the escrow role of the centralised exchange. These contracts are deployed onto a blockchain network at a small cost to exchanges, with users paying small fees to process their transactions through the exchange’s contracts.Typically, a DEX will have an interface that tracks all of their smart contract markets on the blockchain, allowing users to interact with particular markets much like in a centralised exchange — observe the screenshot below. At no point does the decentralised exchange hold assets on behalf of the user, with the contract acting as the escrow or middleman service that the user can trust.
Thus, the decentralisation of exchanges solves a number of pain points faced by centralised exchanges. The first and most important one is the ‘trustless’ nature of the decentralised system. A common occurrence and cause of turbulence in blockchain asset markets has been the repeated ‘hacks’ and subsequent losses of assets by centralised exchanges. For example, the hack of the centralised Mt Gox exchange in 2014 cost users an estimated US $476 million. Even following this hack, more modern and secure exchanges can still be hacked by hostile actors. The recent hack of Korean exchange Coinrail in June 2018 was estimated to have cost users around KRW 40 Billion US$ 36m), illustrating the massive security risks centralised exchanges face.
By keeping the storage of customer currency based in a secure smart contract, decentralised exchanges create an environment where a user can only lose their assets by having their personal wallet private key (equivalent to a particularly complex password) compromised. Additionally, by allowing users to directly send and receive their assets through smart contracts, these exchanges enable users to add their own additional layers of security. For example, the current leading decentralised exchange — IDEX— allows for users to use their own hardware or multi-signature wallets.
It is important to note, however, that decentralised exchanges do have some of their own associated security risks. These exchanges need to firstly make sure their contract code is thoroughly tested and secure, and secondly they need to construct and maintain a User Interface (UI) which allows users to access and interact with the exchange securely. These challenges are significantly easier to resolve than those faced by centralised exchanges, but poor management and security can still lead to user losses. One example of this can be seen in the late 2017 hack of the early-stage decentralised exchange EtherDelta, where the UI (in this case the site of EtherDelta) was hacked and replaced with one that would redirect fund transfers to the hackers address.
The second pain point that decentralised exchanges address are fees. The amount of resources required to run a successful centralised exchange, customer trading fees are naturally significantly higher than the decentralised model. Decentralised exchanges eliminate the requirement for costly business aspects such as asset security, account and transaction database management, KYC/regulator compliance and finally a dispute resolution system. The major operating expenses of a decentralised exchange are simply in the fees for deploying and managing their smart contracts, along with the maintenance of their UI/site. These cost reductions can be seen in IDEX having a very similar fee structure to Binance, the lowest cost of the centralised exchanges.
Again, however, it is not always true that decentralised exchanges are cheaper to run than centralised exchanges. With the major functional smart contract network currently being Ethereum, the transaction bottleneck issues faced by that network can cause the costs of trading on these smart contract exchanges to be significant for users. Maturation of the networks which host smart contracts should naturally solve this problem, but for now it certainly is a limiting factor on DEX growth (the implementation of side chains will also help but this will be the subject of a separate post)
Despite DEXs providing serious benefits over their centralised counterparts, the current fragmentation of the digital asset space into many discrete blockchain networks seriously limits their potential for growth. Currently, smart contracts can only securely process the exchange of assets on their particular platform. For example, an Ethereum based DEX can process exchanges of ether and Ethereum network tokens relatively easily, but it cannot securely facilitate the exchange of assets not on the Ethereum network using a smart contract (as an example, bitcoin cannot be exchanged using Ethereum smart contracts). Until a complete solution for the secure trustless exchange of assets across blockchain networks can be developed, DEXs will be limited to trading the tokens and assets of individual smart contract blockchains.
Even with these issues to solve, decentralised exchanges are clearly the future of digital asset exchange. They provide an important use case for smart contracts by improving greatly on the traditional centralised model of exchange, and the optimism around their potential is substantial but warranted.
Check back next week for more from the ListedReserve smart contract series.