ZKSwap ChainNews Interview
Challenges and Opportunities for Layer2 and ZKSwap
On Feb 7, 2021, ChainNews, a leading crypto media in China, interviewed ZKSwap. Below is the transcript.
ChainNews: Since ZKSwap’s inception in August 2020, it has created many buzzwords in the industry. From pioneering in the layer 2 defi sector by launching the ZK-Rollups+AMM model, introducing zero-knowledge community mining, to massive testnet incentive programs. From your perspective, can you summarize ZKSwap in a few sentences?
ZKSwap: The ZKSwap project started in August 2020. By then, we realized that with the development of DeFi, the Ethereum chain would certainly be not able to support a large number of applications, and many applications will inevitably migrate to Layer 2. We founded ZKSwap following the inevitable need of the market.
What makes ZKSwap unique lies in our talent pools and continuous innovation. Restricted by the global regulatory uncertainty, the early development of ZKSwap is in Stealth Mode. The ZKSwap team has rich experience in the blockchain industry. Many team members joined the blockchain industry in 2013 and began to research zero-knowledge proof in 2018 vigorously. With a team of 20, we have deep field expertise in zero-knowledge proof and smart contract development.
Regarding innovation, the upcoming version of ZKSwap fully implements Uniswap on layer-2. The transaction capacity of ZKSwap is about 100 times that of Uniswap, while the gas cost is only 1/100 of that on Ethereum layer 1. A small step for us, a big step for the industry. Although there are many layer-2 products on the market, most of them are not production-ready, and the user experience is relatively poor. ZKSwap will bring a safe, efficient, and smooth defi experience on layer-2.
ChainNews: At present, ZKSwap has just about to complete the final stage of the testnet. It is said that this is the fifth version of the testnet. Can you briefly summarize the challenges encountered during the development of the testnet and what milestones have been achieved?
ZKSwap: When developing ZKSwap, there are indeed many challenges.
We chose the ZK-Rollup-based solution as the foundation of layer2 based on our in-depth assessment of all scalability solutions. The main reason is that other layer 2 solutions cannot solve fund efficiency and fund safety in the short term. For example, in many Optimistic Rollup solutions, it takes about 1 week to withdraw funds from layer-2 to layer-1. This lack of transaction finality is a problem.
To provide an easy-to-use layer 2 system, ZKSwap needs to solve the problems of layer 2 TPS, GAS costs, and system scalability. Those are the challenges we met in the development.
Two factors affect layer-2 TPS, a. in ZK-Rollups solutions, with more complicated logic, it requires bigger circuits, and then one rollup can contain fewer transactions; and b. the zero-knowledge proof takes longer to generate.
ZKSwap has optimized circuits for AMM transaction scenarios and currently contains more than 200 transactions in one block. Additionally, we have customized a GPU accelerated version of the PLONKs algorithm to generate zk-SNARKs. At present, ZKSwap’s transaction TPS can reach over 100. To put into perspective, ZKsync’s TPS is currently lower than 10, or even less than 5. Based on ZKSync, ZKSwap has achieved a 10-fold increase in TPS.
(2) Gas fee:
There are also two factors affecting gas fees on ZKSwap: a. On-chain transaction data; b. on-chain block state verification. There are two types of transactions: transactions initiated on layer1 and transactions initiated on layer2. ZKSwap stores layer2 transactions off-chain while ensuring the security of layer1 transaction data. Any user can compare whether the transaction data in each block is consistent with the data on-chain at any time. At the same time, ZKSwap has optimized the logic of block data going on-chain to upload multiple blocks at once. ZKSwap team has achieved multi-block aggregation verification technology first in the industry, allowing multiple blocks to be verified on-chain jointly at one time. The gas fee is greatly reduced through the above optimization, and the system has huge scalability. The zero-knowledge proof aggregation technology lays a solid foundation for ZKSwap’s long-term development and can build an infinitely scalable layer2 system.
3)Off-chain state Merkle tree:
The design of the off-chain state tree requires many considerations: a. The number of supported accounts and tokens; b. The status of AMM is simple to update; c. The circuit scale. Based on a deep understanding of AMM’s state change, we have adopted a unique design that can support larger accounts and the number of tokens while maintaining a certain circuit scale.
ChainNews: With the DeFi boom, we’ve seen growth in lending, assets, and DEXes. A lot of new products have emerged. From your perspective, what do you think about the development of the entire DEX sector?
ZKSwap: The development of DEXes has gone through several phases.
In the early phase between 2013 to 2015, there were already some defi products, including BTC-based decentralized exchanges of colored coins, BitShare-based DEX, and NXT’s decentralized exchange, all order-book DEXes. This period was an early exploration of defi. As for why those early DEXes failed to gain traction, it was because the industry was too early with not enough assets or users.
The second phase was between 2015 to 2019. With Ethereum smart contracts, some smart contract-based order-book DEXes appeared, such as IDEX and EtherDelta.They met users’ demand for fund security and private transactions but did not bring fundamental changes to the industry.
The third phase of DeFi was between 2019 to late 2020. The rise of AMM modeled DEX spearheaded by Uniswap has brought a huge impact and growth to the blockchain industry. Unlike the order-book model, with the AMM model, liquidity is sustained in the pool and hence less likely to have low liquidity. The AMM model is a truly disruptive innovation of the trading model. However, bottlenecks on layer1 such as transaction capacity, and gas price are unsolvable in layer1 DEXes.
The fourth phase of DeFi: We believe that the fourth phase of DeFi is layer2 DEXes with the AMM model. Because ZKSwap is based on the ZK-Rollup technology, funds in layer2 are as secure as the underpinning layer1, but the transaction capacity and efficiency are 100x that of layer-1, while the transaction cost is only 1/100 of layer-1. Therefore, we believe that ZKSwap is the next-generation DEX and we are ahead of the curve. DEXes will exceed CEX in both the asset classes and the final trading volume. It’ll be inevitable.
The challenge of DEX lies in regulatory uncertainty. CEX has a strict KYC mechanism, where DEXes have none. There is no clear supervision measure on DEX at present, which is concerning.
ChainNews: With the rising gas fee, more and more users are looking at layer-2, and many projects have chosen ZK-Rollups, e.g., Matter Labs (zkSync 1.0 only supports transfers), StarkWare (from StarkEx to StarkNet), Loopring (currently only supports trading and Transfer), Hermez (currently only supports transfer), etc. What do you think are the similarities and differences between ZKSwap and them?
ZKSwap: When ZKSwap first started, ZKSwap was based on the ZKSync framework. As we delve deeper into the development, we learned that ZKSync had many issues to be solved. Zksync only supports payment and does not support token swap, and based on its open-source code, its TPS is less than 10, its layer2 still costs gas fees, and the fee is somewhat expensive. So in the subsequent development, we only reused ZKSync’s open-source code of layer 1 contract; for layer2 solutions, we basically developed it independently, achieving a substantial improvement in TPS and gas efficiency.
The table above uses four technical designs to categorize current product offerings in laye2 roughly. Under one technical route, there are different schemes with huge differences.
In the short term, we favor solutions that ensure fund security through zero-knowledge proof such as ZKSync, Loopring, and Starkware because they provide financial security. In the short term, Optimistic’s technical route still has problems with fund security.
ZKSwap has realized both token transfer and swap functionality on layer2, which is a great leap forward compared to transfer-only layer2 applications and different to applications that only support layer2 token transfer such as ZKSync and Hermez.
Assuming the same fund security, another major difference between ZKSwap and other layer2 DEX lies in its layer-2 system's scalability. A layer-2 system's scalability depends on two factors, TPS and on-chain cost, which are mutually restrictive.
ZKSwap is a ZK-Rollup-based solution, but it has made a compromise in data availability. All data interacting with layer-1 is on-chain, and layer-2 data is stored off-chain, and only data summary is uploaded on-chain. With this compromise, ZKSwap’s Gas cost is 1/10 of a pure ZK-Rollup solution, and the scalability of the system is greatly enhanced.
The ZK-Rollup system developed by ZKSwap is the zero-knowledge proof system currently deployed on the largest server cluster and with the fastest TPS. Based on the team’s deep optimization of the ZK-Rollup Plonk Scheme, ZKSwap’s TPS can be over 100. It means the entire ZKSwap system can handle nearly 10 million transfers and swap transactions every day. Subject to the computation speed of SNARKs and the native chain TPS, the TPS of most other layer2 solutions is lower than 10.
ZKSwap has done in-depth research in layer2 and has made many engineering implementation innovations, including the GPU optimization of the Plonk algorithm, aggregating transactions, and system scalability, which we believe will have a great impact on the whole industry. ZKSwap’s launch on Ethereum mainnet will mark the new phase of DeFi and lead the growth of DeFi on layer2.
ChainNews: Liquidity is crucial for DEXes. With the AMM model, liquidity providers can obtain stable profits from market-making. How does ZKSwap plan to attract liquidity and trading volume?
ZKSwap: Trading volume is significant to ZKSwap, which essentially depends on user sizes. ZKSwap aspires to attract users with smooth user experiences. Also, ZKSwap will host a large-scale airdrop to Uniswap, Sushi, and possibly more Dex users after it goes live to encourage existing DeFi users to try DeFi on layer2. On top of that, ZKSwap will host multiple community mining activities after the mainnet launch, aiming to attract and retain users.
ChainNews: ZKSwap is estimated to launch on Ethereum mainnet soon. How to ensure the security of the mainnet? What functions will be available when the mainnet is online?
ZKSwap: At present, the team is still doing the final test. The launch date will base on our test results. The ZKSwap system's security mainly includes the security of the layer1 smart contract and the circuit security of the layer2. At present, the team is working closely with three cybersecurity teams for the security audit. The feedback from the audit team gives us the green light to go live on the mainnet.
After launching on the mainnet, ZKSwap will support the real-time free transfer and swap of ETH and ERC20 tokens on layer2, and the system TPS can reach 100. And layer2 token transfer and swap cost 0 gas fee. ZKSwap will support transfer and swap for 30 tokens in the first batch and soon support more than 100 tokens. Token listings and liquidity pools will eventually be open to community voting.
ChainNews: What is the mid-term and long-term plan for ZKSwap?
ZKSwap: our mid-term plan is to cooperate with more exchanges and wallet service providers to use ZKSwap’s layer-2 standard; to support free transfer for all ERC20 tokens, including stablecoins, and to support private transfer and swaps. Our long-term plan is to abstract the technology of ZKSwap and builds a layer-2 protocol; to support more DeFi projects, and use ZKSwap technology to build future DeFi on Layer 2.
ChainNews: One layer-2 solution rules them all or multiple layer-2 solutions? What about layer-2 composability?
ZKSwap: We think there will be multiple layer-2 solutions coexisting in the future, and the market size of Layer 2 will be at least 20%-30% of Ethereum because eventually, all users will use layer-2 solutions. The process of user migration from layer-1 to layer-2 is the process of layer-2 value discovery.
There are two solutions for layer-2 composability. One is that all transactions return to Layer1 first and then interacts. For example, ZKSwap supports layer-2 LP token withdrawal to Layer1; then its composability is the same as defi products on layer-1.
Another solution is that projects using the same layer-2 standard will be composable. At present, there are already several projects willing to use the ZKSwap solution; these projects can interact with each other. With the programmability of layer-2 (supporting virtual machines or common modules), the composability and interactivity of layer-2 solutions will also be greatly improved.
ZKSwap is a layer2 dex based on ZK-Rollups technology and using the AMM model.
You can find us here🥰:
ZKSwap Official Website: https://zks.org/en
ZKSwap APP: https://zkswap.app
ZKSwap Twitter: https://twitter.com/ZKSwapOfficial
ZKSwap Official Telegram group: https://t.me/zkswapofficial
ZKSwap Medium Publication: https://medium.com/zkswap
ZKSwap Discord: https://discord.gg/ZRxS8fYTDv
ZKSwap Github page: https://github.com/l2labs