The growth of decentralized finance (DeFi) is staggering, with its market cap hitting close to $100 billion in Q1 this year (source). An important driver of this growth is decentralized exchanges (DEX), with weekly average trading volume crossing the $3 billion bar in the same quarter (source).
A DEX manages liquidity and executes trades through the use of smart contracts. This use of smart contracts removes the need to rely on central authorities, institutions and intermediaries, and sets the stage for a pure peer-to-peer trading environment. No banks, no brokerage firms, no government intervention – just users, tokens and smart contracts. This makes DEX “a fundamental piece of infrastructure for any decentralized community”, to quote Dan Simerman, the IOTA Foundation’s Head of Financial Relations.
Here, we’ll explain what they are and what a DEX can be used for, and why the new IOTA Smart Contracts are ushering in the next chapter of DEX.
From CEX to DEX
Before diving into decentralized exchanges, it’s worth comparing them to centralized exchanges (CEX).
The term 'CEX' covers both the classic financial exchanges, like NASDAQ or the New York Stock Exchange, as well as digital platforms for buying and selling cryptocurrencies in exchange for fiat currency (like the US dollar) or other digital assets like Bitcoin and Ethereum. You may have heard of some of the more famous examples of digital CEX, including Binance, Huobi and Coinbase.
CEX is popular for several good reasons. It enables the entire spectrum of the digital asset trading process: from security to fair market pricing, regulatory compliance to consumer protection, as well as access to various digital assets. It is regulated, subject to third-party control, and runs security checks such as Know Your Customer (KYC), Anti-Money Laundering (AML) and Counter-Terrorism Financing (CTF). It also frequently uses multi-signature wallets, which require several entities to sign a transaction before allowing funds to be accessed, adding another layer of security.
Several CEXs hold the private keys and most of their users’ funds offline in crypto wallets that aren’t connected to the internet (these are known as “cold” wallets”). Some also insure assets that are kept online, in “hot” wallets.
What is a DEX?
In contrast to a centralized exchange, a DEX is a decentralized exchange used for trading cryptocurrencies. On a DEX, all the four core functions of any exchange – Capital Deposits, Order Books, Order Matching, Asset Exchange – are decentralized and managed on-chain. They are non-custodial (users have sole control of their private keys), permissionless (anyone can use it without vetting from a centralized authority), and do not place barriers on access.
Rather than a centralized order book – the essential hallmark of CEX, whether Binance or the New York Stock Exchange – DEX enables the exchange of digital assets among peers by matching and executing trades through smart contracts. What’s a smart contract? Put very simply, smart contracts are algorithms that can execute, enforce, verify and constrain pre-programmed instructions all by themselves. Find out more about IOTA Smart Contracts here.
DEX users know that their assets are in the hands of a smart contract and not a third party with its own agenda, so they can rest assured that their funds aren’t being used as collateral by the centralized third party for any other purpose than agreed on by the smart contract. In fact, they can trace the movement of their assets through every stage of the decentralized exchange. Adding more transparency, smart contracts can also be verified by anyone (for example in order to check whether there are any functions included that enable the smart contract author to withdraw funds to an address under their own control).
A lack of centralized control also means that DEX users don’t have to hand over their private keys to a third party. From this perspective, a DEX offers additional security and control.
Unlike CEX, DEX doesn’t enable transactions with fiat currencies, so you have to have crypto to trade crypto (and not with your debit card, for instance). They also don’t come with their own internal servers or IT infrastructure but act as a decentralized application (dApp) on a blockchain or DLT.
A building block of DEX is liquidity pools, which are hosted on platforms like PancakeSwap. In liquidity pools, users willing to act as liquidity providers pool together two different assets (such as Bitcoin or Binance Coin) that they want to trade on the DEX (note that, unlike CEX, DEX doesn’t enable transactions with fiat currencies). The ’foreign’ or non-native assets are brought onto the DEX in a process known as “wrapping” – users take an asset that isn’t native to DLT.
Other traders are able to borrow the funds from the pool (all secured by the smart contract) to make trades, such as arbitrage or loans. This automated trading is facilitated by Automated Market Makers. Users pay a trading fee equal to, for example, 0.3% paid per trade, which is allocated to everyone in the pool based on the percentage of their share of the pool, thus rewarding anyone who adds liquidity to the pool. Users who move between different lending marketplaces specifically to provide liquidity with the purpose of reaping the rewards given to liquidity providers are doing what is known as “yield farming”.
By bringing in tokens from other distributed ledger technologies, DEX (or more specifically, the decentralized apps – or ‘dApps’ – integrated into the DEX) become bridges between different networks, enabling the easy transfer of assets and opening up a world of possibilities.
The benefits of DEX
So why choose DEX? It boils down to the following highlights:
- Ease of access: Virtually no user data is required for trading on a DEX: Often, just a public address is needed before being allowed to trade. With a DEX, you aren’t subject to interference by a central entity, and a central power can't block anyone from using it or from interacting with anyone else. In this way, a DEX represents a more inclusive and equitable ecosystem.
- Security: CEX users have no control over their private keys and are vulnerable to attack, with several instances of CEXs getting hacked over the past few years, such as BitMEX in December 2020.
DEX sidesteps this risk because cryptocurrency trades are made directly between users through smart contracts without going through a hackable intermediary third party. The operation of a DEX is decentralized and “code is law”: whatever is written in the smart contract will be executed. As such, it’s “trustless” - you don’t need to invest your trust into a central third party to take care of your assets and ensure the exchange keeps running. And as a ‘non-custodial' process, DEX users keep hold of their private keys to access it.
- Better privacy. Data leakage is on everyone's mind and the protection of private data is a top priority. On a DEX, users don't provide sensitive personal details to third parties and there are usually no registration processes for using the exchanges.
- Transparency: It’s on a smart contract so everything is logged, traceable and transparent. On CEX, trading occurs off-chain in local databases, which reduces the transparency of trades to the outside world (until the tokens are withdrawn and registered again on the blockchain). So there is no proof that someone bought something at a given price, and it opens up the possibility of an exchange selling more tokens of a certain type than they actually have. This can’t happen on DEX.
- Reliability: It’s a more reliable option than big exchanges that are centralized entities with total control, who can be overwhelmed by simply shut down trading when a market crashes and they are overwhelmed by the number of users wanting to trade or liquidate their assets.
However, as with any new technology, there are still a few growing pains and room for improvement.
Disadvantages of DEX
Most DEXs offer a poor user experience. The current state of design of most of them is certainly not beginner-friendly, and it can take exploring dozens of platforms to begin to familiarize yourself with the trading experience, combined with a relative lack of customer support or very little customer support. And as already mentioned, DEX doesn’t engage with fiat currencies, so you have to have crypto to trade crypto (and not with your debit card, for instance).
Until recently, two major obstacles preventing widespread adoption were low throughput and the expense of building and running a DEX. However, with the advent of layer 2 blockchains and layer 1s like Solana, high throughput capabilities and cheaper transaction costs are opening up possibilities for DEX.
This is where IOTA comes in.
Why choose IOTA for your DEX?
Choosing a technology to entrust with a DEX is a big decision and not to be taken lightly. But running a decentralized exchange on top of IOTA is as good as DeFi can get. To confirm this, we spoke to the founder of TangleSea, the first DEX built on IOTA. A member of the IOTA community since 2017 IOTA, the founder (who wishes to remain anonymous) decided to take the plunge and work on developing a DEX “ It's been a great experience so far,” he says. “I see it as a journey together.” A few characteristics make building a DEX on IOTA easy for developers like TangleSea:
- IOTA Smart Contracts is a multi-chain concept (many parallel chains can be spawned on top of the IOTA base layer, the Tangle. This enables parallel processing, which means that the throughput of an IOTA DEX is much higher than other DEXs that lack parallel processing, such as the already-mentioned Etherum.
- IOTA has designed its Smart Contract protocol to be compatible with the Ethereum Virtual Machine, so any smart contracts on other blockchains such as Etherum will be compatible. Other EVM-compatible DEXs can integrate with IOTA in cross-chain strategies.
- On IOTA, while the owner of the quorum of nodes that executes the smart contract will incur a fee, the underlying network (the “Tangle”) is feeless. This means that, unlike other DEXs, transactions won’t incur ‘gas fees’, the fee that “pays” for a transaction to be processed. Gas fees are the main obstacle preventing smaller users from using DEXs: on a busy trading day on some of the bigger DEXs, they can be tens of dollars per transaction, and that clearly can quickly add up. For lower-level traders, that’s a major disincentive. In the words of TangleSea, “with the IOTA DEX, you could even invest just 10 dollars, because you don’t have to pay operational costs. This will open the door for everyone who wants to get involved. “
- Other actions, such as staking, wrapping or trading tokens, can incur fees, but won’t cost you an arm and a leg. For example, wrapping an Ethereum coin into a dollar token so that you can exchange it for a different coin can be prohibitively expensive on other networks. On IOTA, it will be up to the validator to set the fee, which could be justified by arguments such as the resilience of their network, and so on.
- Remember Miner Extractable Value (MEV)? That’s a problem of the past on #IOTA. Stay tuned for more information.
The ease and transparency of using a DEX, especially when combined with the benefits of the IOTA protocol, makes it easy to see why it will be a driving force behind the multitude of use cases in decentralized finance, empowering decentralized communities to scale up. The lack of a centralized service offers individuals and communities the freedom to launch their own token economies and build their own trading infrastructure.
IOTA Smart Contracts offer the ease of use of the EVM industry standard, its existing ecosystem and existing tooling, while also offering a seamless transfer of assets across chains at no cost, as well as parallel execution of smart contracts leading to much higher capacity and throughput than any competitor can offer at no (transaction) cost.
While the development of the IOTA Smart Contract protocol progresses, we already see increased interest in its architecture and unique characteristics. Some projects are even under heavy development already, preparing and testing the protocol ahead of the official release. We are curious to see what will be built on it.
If you have any questions about IOTA Smart Contracts, head onto our Discord and talk to our developers in the #smartcontracts-discussion channel.