Improvements on Uniswap

Post by
Sidhanth Kumar
Improvements on Uniswap

Part 1: Cross Chain Swaps

In my last post about balancer I introduced the concept of decentralised exchanges along with some more fundamentals of the defi ecosystem like AMMs, Liquidity providers, arbitrage, impermanent loss and slippage. Now it would be unfair of me if I, while explaining about defi, don’t mention Uniswap, the biggest decentralised exchange to date in terms of trading volume. Although it was briefly mentioned in the balancer article, but a concept like Uniswap deserves an article of its own. But now here’s the thing, in my last blog whatever I explained about Balancer, all those concepts be it arbitrage, impermanent loss, slippage or LP all those things apply to Uniswap as well and in fact the AMM algorithm that Uniswap uses, x*y = k is just one of the cases of the general algorithm that Balancer has as AMM. So from mathematical standpoint if one understands Balancer, Uniswap then(atleast V2) is just a cakewalk. So does that mean that the Uniswap part is over and all the hype built in the starting of the article was for nothing? Well of course not, there’s a still lot to understand about Uniswap especially after the launch of V3 a couple of months back where they addressed some of the challenges that the AMM based dexes face in general. But before we jump onto the solutions they provided, we first need to understand what the problems were and how other competitors attempted to solve them and then finally have a look at Uniswap V3 and its way of addressing those challenges.

So there will be a series of blogs I’ll be writing on this stuff, each article will be about something that Uniswap is missing or something at which its competitors arrived first. The reason why I am choosing Uniswap as my basis is because it is the largest decentralised exchange currently, so if one wants to have an insight into how an ideal DEX should look like, an awareness about the things that the world’s best dex is lacking or the problems which it faced is definitely going to help. 

One of the things that Uniswap is lacking even after its latest launch is chain interoperability. Lets have a look at it in little more detail in this article.

Cross Chain Swaps

Uniswap is built on the Ethereum blockchain which in other words mean that it only supports the trade of only those tokens that are built on Ethereum blockchain i.e. the ERC20 tokens. But Ethereum is just one of many blockchains currently there in the blockchain market which over past few years has been rapidly growing. So in such a scenario limiting any exchange to just one chain would significantly reduce the available market. And as a matter of fact according to Ethereum blockchain only constitutes 2.4% of the total transactions occurring across all blockchains, though the market cap is high because of the price of tokens traded on it but nevertheless the figure of 2.4 % speaks volumes about the need for exchanges to have cross chain trading functionality. With a rapidly rising blockchain market, in future it won’t make sense for thousands of blockchains to run independently without interacting with each other and also the increasing traffic on the Ethereum blockchain has led to high gas fees, making the transactions expensive thus there’s a high possibility that interoperability will become a mandatory feature for an exchange to sustain. 

Now there are certain protocols which have proven themselves quite useful in closing this interchain gap without the help of any centralised 3rd party by just relying on smart contract. One of these protocols is the atomic swap protocol.

Atomic Swap

Suppose you want to exchange ETH for XTZ(native token for Tezos blockchain) on Uniswap, you simply can’t because these two tokens belong to two different block chains and since Uniswap doesn’t support cross chain transactions it’s not possible. Now that’s where atomic swap protocol comes into picture. Atomic swaps are essentially peer to peer trades across different blockchains. Let’s understand this through a simple example:

Suppose Alice wants to buy some ETH for XTZ and Bob is the one she’s going to buy it from i.e. Alice owns XTZ and Bob owns ETH for now. So first Alice submits her transaction to the Tezos blockchain i.e. she locks the amount of XTZ she wants to get converted to ETH into a contract address on the Tezos blockchain which sort of acts like a virtual safe, upon depositing the XTZ she also generates a key for that safe so as to access it and then sends the cryptographic hash of that key to Bob, just the hash not the key. Now using that hash Bob generates a contract address(the safe) on the Ethereum Blockchain and sends the equivalent amount of ETH to that address. Now it’s only Alice who can withdraw funds from the contract address created by Bob within the time limit set by Bob because the hash was generated using the key possessed by her, now after she redeems her ETH, the key she has that is disclosed to the Bob because of a special function called hashlock and since now Bob has the key, he can use it to redeem XTZ from the Contract address where they were deposited by Alice within the time limit set by Alice, one thing to note here is that the time set by Alice for Bob has to be greater than the time set by Bob for Alice to prevent the case where Alice first makes a refund and then redeems Bob’s funds. The cross chain transaction is now complete.  

So that’s how the atomic swap protocol can be utilized to perform cross chain transactions and there are quite a few DEXes using this protocol to facilitate cross chain transactions for example Atomex, 0x, etc. And another thing to note here is that atomic swap isn’t the only technology that is used to perform cross chain transactions, protocols like THORChain using cross-chain bridges instead of atomic swaps to support inter chain transactions. 


So the point at the end is that given the increasing number of blockchains in the market and increasing congestion on the Ethereum blockchain, interoperability is going to become one of the most essential feature for a decentralised exchange in the future and there already are DEXes which have accommodated this as one of their feature but Uniswap for now isn’t one of them. 



  • Coinmonks
  • Binance Academy
  • Investopedia
Looking to develop a DeFi project like an exchange or swap platform or something else? Reach out to Tektorch.AI ---> Learn all about their Crypto Projects here