The Role of Decentralized Exchanges

A DEX, or Decentralized Exchange, is a blockchain based tool that allows users to trade their cryptocurrency coins and tokens in a decentralized manner. It does this by replacing the trusted third parties of traditional centralized exchanges with smart contracts.

A smart contract is just code that allows two parties to enter into something similar to a legal agreement but which is enforced entirely by the deployed code. The way it works is as long as both parties engaged with the contract do exactly what they agreed to do the smart contract will work as it should.

However, if either party decides not to act in good faith, then the smart contract recognizes the previously agreed upon terms have been breached and will not execute any further. This is a very rough, non technical overview of smart contracts. However, it equips us with enough of a general idea as to how they work that we can now examine the differences in the trading process when using a DEX compared to a centralized exchange.

There are four core functions of any exchange: asset exchange, capital deposits, order books, and order matching. A true DEX must do all four of these in a decentralized manner.

The asset exchange portion of this equation is decentralized by default because you are exchanging blockchain based cryptocurrencies. However, the other three areas are not as easy to solve and are centralized at exchanges like Coinbase or Binance despite the fact that they deal with cryptocurrencies. This is due to KYC and AML regulations that require them to ask for ID when accepting any capital deposits.

When using a decentralized exchange you are typically asked to connect a 3rd party wallet extension or app such as Metamask where you hold and are truly in control of your assets. Decentralized applications such as this often do not require the same level of KYC requirements to use their services as their centralized counterparts.

When it comes to order books and order matching we must first understand how traditional order books operate. The order book method has worked for ages and is utilized by the US Stock market. When you want to buy an asset you pick a price that you want to buy at and then place your order. By doing this you give the 3rd party (ex. stock market exchange) your money and when it finds someone else who wants to perform the opposite end of the exact same trade that you’re offering it will swap the assets for the funds and give each party what they want. When you want to sell an asset the same process is repeated in reverse.

The downside to this is that after placing an order you have to sit around and wait for someone else to come along who wants to buy or sell what you are looking for and at the same time have your assets locked up with this 3rd party until the trade is executed.

The other option at your disposal is taking the time to search through all the orders placed with a specific order book and find someone who has placed an order and agree to their terms. The aforementioned process utilizes what is called limit orders. You can also use market orders which work by submitting an order where you’re willing to buy all the stocks you want at the current price at which sellers are willing to sell them for.

The order book method works well but is inefficient if you want to buy or sell your asset immediately because you have to wait around if no one matches the opposite end of your order right away. The first generation of DEX’s also used an order book method. However, many newer DEX’s have since innovated and now utilize automated market makers and liquidity pools to make the entire trading process much faster, cheaper, and more efficient.

An automated market maker is an algorithm that allows traders to buy/sell their coins at a price dictated by how much of the asset there currently is in a liquidity pool. A liquidity pool is just a pool of money containing both assets you are looking to trade that is facilitated by a smart contract. This smart contract is written in a way that allows traders to always be able to buy or sell an asset no matter how high or low the price is, the time of day, or whether there is someone else out there that matches the other end of their order/needs. This is accomplished by holding on to certain funds, doing math with these funds, and then allowing you to trade based on the math that was done.

The benefits of using this method are made possible because you are trading with a pool of funds instead of another person. For each token of a certain kind that you buy, the pool will gradually charge you more and more. For each token of a certain kind that you sell the pool will gradually give you less and less in return. These liquidity pools use a special formula to make sure they can always sell more coins even if they barely have any left because the less they have of an asset the more they will charge.

This incentivizes some traders to come along and balance the pool back out by making a profit on the opposite trade and results in these algorithms working very well at setting prices. A very common algorithm utilized by DEX’s today is called a Constant Product Market Maker (CPMM). This algorithm is essentially just a simple formula of X * Y = K, where X and Y represent the 2 assets being traded in the pool and K represents a constant number that the values of both assets should always multiply to.

So at this point you might be wondering, where do the funds in these liquidity pools come from? Well the answer is from other users/traders who are incentivized to put up funds. If you put money into a liquidity pool you are considered a liquidity provider. Every transaction completed using a liquidity pool has a tax. It will cost a very small percentage of every trade for it to be executed.

As more people trade and utilize a certain pool the fees begin to add up quickly and they go to the liquidity providers of the pool as a reward. As more liquidity providers join the pool, it makes your individual share of the fees less but it also makes the prices of the tokens traded more and more stable. Something to consider when thinking about liquidity pools is the price impact. Price impact represents how much a user can affect the price of an asset by buying/selling from a given pool. If the pool is small there will be a very high price impact but as the pool grows the price impact of each trade gets smaller and smaller.

Using a DEX can come with many benefits for crypto savvy traders such as faster transactions, lower fees, and no KYC requirements. This has been a driving force in the rise of decentralized finance (DeFi). As touched upon previously, there is no central authority and you are trusting a smart contract. This might seem intimidating for people new to the space, but this idea has already proven to be vitally important for people around the world who want to access these blockchain ecosystems in countries with restricted access.

Another point proponents of this system tend to make is that code has often proved more reliable than humans. This is especially true when it is open source and anyone can look at it. This might seem counterintuitive because it means potential hackers or malicious actors also have access to the code and can scan it for exploitable bugs.

However, there are also hundreds of insanely smart developers who constantly examine and maintain the same code because they benefit from using the protocol. These “good” developers far outnumber the malicious actors in healthy ecosystems which greatly reduces the chance that something goes wrong or a bad actor is the first to find a bug in the code.

Although open source code can be a double edged sword because hackers can experiment too, many of the most important computer systems in the world currently run on open source code. Linux is open source, and it remains the worlds most used operating system with an estimated 3–3.5 billion users (as of 2021). It’s even used by industry giants such as GoogleNASA, and the U.S. Department of Defense who are clearly incentivized to use a system with the highest security assurances. Some other popular open source projects that are widely used and trusted in recent years are VS CodeTensorFlow, and React-Native.

As with any new technology there are tradeoffs and potential downsides to using a decentralized exchange. For starters, there are limitations in the fact that you can only trade cryptocurrency for cryptocurrency and both of the coins or tokens you wish to trade have to be on the same blockchain.

If you want to swap assets cross blockchain you still have to use what is called a bridge. Another downside, especially for new users who lack experience with cryptocurrency, is that there is no support team or number to call when something goes wrong. Most of the bigger platforms have community forums where you can ask a question, but those are made up strictly of other members of the community who are just generously helping out.

This means that if you do something wrong such as send your coins to the wrong address or buy a scam coin it ultimately winds up being your responsibility and you can lose your funds. You also must use a hot storage device that connects to the internet in order to utilize the services of a DEX which is less secure and desirable than holding your cryptocurrency in cold storage. A final potential downside to consider is that some DEXs, especially smaller ones, can have low liquidity. This means that the price can shoot up quickly if you buy too much of a token or vice versa if you try to sell a bunch at once.

Decentralized exchanges are a new technology with a very exciting future. However, they definitely come with tradeoffs and are not perfect for everyone. Although they do often provide users with the best value and most control over their trading, DEX’s still have some catching up to do when it comes to creating more robust features and a better user experience compared to their centralized counterparts.

Despite this, decentralized exchanges have already emerged as a vitally important part of blockchain ecosystems and will remain an important part of the future in this space. As is in line with the ethos of much of the cryptocurrency industry, DEX’s ultimately make your currency your responsibility. Although there are many smart people working tirelessly on these projects, ultimately any DEX’s code could still have vulnerabilities or be compromised so you should always do your research and use these new technologies with caution.

With this said, I do believe the continued growth and development spearheaded by talented engineers in the coming years will gradually make decentralized exchanges become a better and more enticing option for most people compared to their centralized alternatives.

Previous
Previous

US Renewable Energy Services Provider to Build $2.4 Billion Data Center with Bitcoin Mining

Next
Next

Revisiting Ripple's Legal Battle with SEC on Its One-Year Anniversary