ZKSwap - A Layer 2 Decentralized Exchange based on zkRollups

Do repost and rate:

Prior to giving my experience, first I would like to provide some intuition for what makes zkSwap different from exchanges like Uniswap and its ilk. This article is not intended to provide a low-level technical description of how zkSwap works, just to provide a high-level intuition for why I believe zkSwap is so special. First, to appreciate zkSwap, one must appreciate the zkRollup, which is what sets zkSwap apart from the others.

zkRollups in a Nutshell

Imagine that we have a number of on-going transactions from multiple users of a given platform such as Uniswap, where each user is attempting to exchange ETH or an ERC-20 token to ETH or another ERC-20 token. Imagine K transactions represented as the white rectangles shown below, where the black box abstracts the actions required to submit the transaction. K can be any number, but for this example, assume K=1000.

These K individual transactions lead to increased network traffic and ultimately towards congestion. What zkRollups effectively do is aggregate these individual transactions into blocks of fixed sizes and perform the computation for each transaction off-chain, on Layer 2, then commit the result of these changes back to Layer 1, on the Ethereum network. For example, zkSwap has a block size of 20 transactions, and so given a block of size 20, assuming K=1000, we would have n=K/20=50 blocks. 

Essentially, this aggregation of transactions and their computation will spare the Ethereum network a lot of unnecessary network traffic, you get more transactions being processed at once, get scalability in parallel processing transactions at the block-granularity, and save on gas fees as these changes get committed in bulk rather than individually. Details about how Zero-Knowledge Proofs work, how the results of the computation for each transaction get verified, etc., are beyond the scope of this article. All-in-all, the purpose of this section is to just provide an intuition behind zkRollups.

From Layer 1 to Layer 2 and then back to Layer 1

Before you can truly use zkSwap, you must first move your ETH or ERC-20 tokens from Layer 1 to Layer 2, which can be done directly through the app. This will set you back one smart-contract, which is really the majority of the fee associated with using zkSwap. It should be noted that you need to have at least 200 USDT or 50 ZKS worth of assets in Layer 2 to perform a swap, so make sure to deposit at least that much. It should be noted that your Layer 2 wallet is directly linked to your Layer 1 Ethereum address, and so your funds are always accessible from the same wallet, even if it is not visible, i.e. if you deposit 1 ETH from Layer 1 to Layer 2, you will not see that 1 ETH in your wallet, but it is always accessible on Layer 2 via your wallet.

Once you have enough deposited, you can make an exchange using the ever-growing selection of coins, all with just a 0.3% liquidity pool fee but no gas fee for each transaction. It should be noted that, unfortunately, you do not always get the best price for swaps, likely since prices are determined based on the aggregation of price data from multiple sources. In my case, I exchanged 0.115 ETH for 76.6266ZKS, and on Uniswap I could have gotten as much as 86 ZKS. This is something that will hopefully be improved in the future, say by always choosing the best price.

Transactions will take substantially longer than individual transactions based on traffic through zkSwap, because those blocks, as mentioned before, need to fill up before being committed back to Layer 1. 

Withdrawing from Layer 2 to Layer 1 only set me back a constant $5 worth, which is relatively cheap. Again, withdrawing may take a while based on traffic, where the higher the traffic the faster the transactions.

My Experience

Overall, my experience has been very positive and I see a lot of potential growth for zkSwap, in both utility, usage, and price. I will say that I do not believe that zkSwap is going to be a "Uniswap killer" as you will be able to enjoy better prices (for now) along with faster transactions for your one-off transactions. However, zkSwap really shines when you wish to make multiple transactions. For example, one could decide to manually Dollar Cost Average (DCA) into their favorite ERC-20 coins, and instead of paying gas fees to buy more of each, you could instead make the up-front deposit to Layer 2, and then make the exchanges for only the 0.3% liquidity pool fee each. As another example, say you are more of a risk-taker and want to swing trade on some highly volatile ERC-20 tokens, you could keep them on Layer 2 and exchange them whenever you want to take profit for that 0.3% liquidity pool fee each time, no gas fees required. As well, if more people used zkSwap over Uniswap where appropriate, you would have much less network congestion on the Ethereum network, leading to lower overall gas fees! I have high hopes for zkSwap! 

Regulation and Society adoption

Ждем новостей

Нет новых страниц

Следующая новость