When you hear the term “exchange,” you’re probably thinking of a platform that’s run by a corporation and regulated by local laws. Where you may deposit USD (or other local fiat currency) to make cryptocurrency transactions at any time or at the request of government authorities, your data may be shared, stored, and handed over to them. This setup describes a centralized exchange. What if you could use an exchange that connects directly to your Ethereum wallet and allows you to trade for other Ethereum-based tokens using only Ethereum or an Ethereum token? All transaction and processing fees are paid in Ether coin. There is no need for KYC (know your customer) or waiting for bank transactions. Smart contracts are used to manage all swap and deposit transactions. This is a type of exchange called a decentralized exchange (DEX). Uniswap and 0x are examples of decentralized platforms that utilize Ether and Ethereum tokens. How do they work? What are their differences?
ERC-20 and Ether Swapping
ERC-20 tokens are cryptocurrencies that use the Ethereum blockchain network. Some examples are LINK, COMPOUND, USDT, and BAT (for an explanation of tokens, see “Exploring Tokens and the Blockchain Network“). It makes sense that you should be able to exchange those tokens for Ether, the “gas” (or incentive) for Ethereum miners, using Ethereum’s native currency, Ether. The blockchain has the most tokens in the cryptocurrency industry, and it also supports smart contract features. Many tokens and stablecoins are ERC-20 and eligible for swapping on Uniswap and 0x. Swaps are truly trustless; they rely on smart contracts for secure trading.
Let’s look at the top two decentralized exchanges that offer Ethereum token swapping.
What is Uniswap?
The Uniswap decentralized exchange (DEX) platform enables the swapping of Ethereum tokens and liquidity pooling. It does so by sending your cryptocurrency funds to your online wallet or through a wallet gateway. The process is easy. You pick the input token or Ether amount, the desired output token or Ether amount, then connect your wallet and execute the transaction.
- When you trade, you’re withdrawing (or “purchasing”) from a liquidity pool (think deposit pool for certain crypto pairs—each pair has its deposit pool). When trading occurs, a liquidity provider fee is charged to depositors who put money into a liquidity pool (a deposit pool representing a crypto pair). The majority of the fee is paid to the liquidity pool’s providers as a reward.
- When depositors contribute to a liquidity pool, they are depositing (or “selling”).
For withdrawing a token from a pool, you need to deposit the equivalent amount of cryptocurrency. For depositing a token into the pool, you have to withdraw two cryptocurrencies. The unit amounts within each pair must balance the constant product formula (explaining the formula in-depth requires further discussion, but you can click on the link to read more about it).
To add liquidity (or depositing) to a pool, you must either create a new cryptocurrency pool or join an existing one in exchange for a portion of the profits. You can also set the equivalent pair price when creating a new pool. After you’ve completed liquidity (added funds to a pool), you’ll get a “liquidity token” that’s linked to the public address of your wallet. Total deposits plus accrued fees are tracked in the “token” until they’re burned (when initial deposits plus accrued fees are returned to the depositors—aka liquidity provider). The “liquidity tokens” can be sold, transferred, or used like any other cryptocurrency. For example, Uniswap “liquidity tokens” can be used as collateral by some protocol platforms.
It’s possible to research the value and price of established pools by visiting Uniswap.info.
Another benefit of Uniswap is that crypto holders may swap ERC-20 tokens before popular centralized exchanges list them. Compound, an ERC-20 token, was offered on Uniswap before its deployment on Coinbase and elsewhere.
What is 0x?
You can think of 0x as an ERC-20 swapping comparison platform. Anyone with programming knowledge can use the protocol to compare trading fees and execute transactions among many decentralized exchanges. One aspect that differentiates 0x is the opportunity for someone to build their DEX utilizing the protocol.
0x also has a consumer-facing component, called Matcha. It’s a P2P marketplace where you can connect directly with other wallet addresses to swap tokens. Connecting to different addresses using Matcha isn’t an automatic process—you must first know the public address of the other party. This mechanism keeps the exchange decentralized since the blockchain keeps track of transactions.
The 0x protocol is associated with the ZRX token. If using the 0x protocol API directly, by creating a self-custom decentralized exchange, that person (or entity) becomes a Relayer, and they’re paid with ZRX tokens. The Relayer is the middle-agent that finds, creates, fills, or cancels orders on custom DEXs.
Differences Between Uniswap and 0x
The most significant difference between Uniswap and 0x is their flexibility. You can split orders across several swapping platforms with the 0x protocol, including on Uniswap.
0x is more of a P2P component than Uniswap. You need the wallet address of the other party to engage in a swap if you’re using the consumer-facing platform (Matcha). Furthermore, the protocol is flexible enough to enable the development of a self-created decentralized exchange. To fully benefit from 0x, you’ll need programming abilities, but Uniswap doesn’t require any. There are even more incentives for traders to trade on Uniswap than with 0x. The consumer interface is enough for traders to execute swaps and you can research liquidity pools.
Uniswap, 0x, and Yield Farming
Yield farming is a way to make money. There are many ways to do this, but you can use Uniswap and 0x to earn interest. Let’s use an example from Uniswap. You’re given a liquidity token if you contribute to a liquidity pool (a collective pool of deposits available for borrowing). Then you can go to a secondary money market (think classifieds for defi) and use the liquidity token as collateral. Deposit the collateral into another liquidity pool elsewhere and repeat the cycle. It’s an example of using Uniswap for yield farming, but the same scenario can apply to 0x with their ZRX token.
Alternatives to Uniswap and 0x Liquidity Pools
When it comes to liquidity pools, Uniswap and 0x aren’t the only players. Many other platforms and protocols exist. Here’s a list of platforms and tokens that make yield farming via liquidity pools possible:
- Tokens: Compound, Kyber Network, Celsius, Balancer, Aave, Oasis
- Platforms: Kyber Swap, Dex.ag, Radar Relay, AirSwap, 1inch, Unidex, Wallstreet Bets