DeepChain Finance: ZKSwap, a Leading Layer 2 DEX
Translated from a Chinese article written by Wutiao and published on DeepChain Finance
Most of the AMM-type DEXs on the Ethereum Layer 1 have low transaction efficiency and high costs, the underpinning problem hinders the growth of the Ethereum ecosystem. Layer 2 scalability solutions have seen great progress and brought more possibility to Ethereum.
Among Layer 2 solutions, ZK-Rollup stands out, with Vitalik commenting ZK-Rollups as the best Layer 2 solution for swap and payment and best scaling solution in the mid and long term.
ZKSwap was one of the pioneers in adopting ZK-Rollups as the AMM DEX, which has a very positive impact on the industry.
“The advantages of ZK-Rollups solution in Layer 2 ”
Ethereum has been around for a while. Everyone in the Ethereum community is both idealistic, visionary but bound by reality at the same time.
Ethereum introduced smart contracts and dAPPs to crypto and opened the era where “everyone was issuing tokens”. In the previous cycle, Ethereum became the main battlefield for crypto projects. It was also the public chain with the most assets and liquidity, which laid the foundation for the later exponential growth of DeFi.
A recent buzzword about Ethereum is the EIP1559, a new gas fee mechanism that will be brought to production in the London HF, which hopefully can somewhat alleviate the high cost of onchain transactions.
That said, the mismatch between Ethereum’s processing power and the exponential growth of its ecosystem is a long-term problem. The actual TPS of Ethereum has always been around 15–20, while the TVL of the Ethereum DeFi protocol has grown exponentially, which also means that the number of transactions on Ethereum has also shown exponential growth. Transaction congestion and high gas fees have caused many developers and users to flee to other platforms.
Scaling on Layer1 or Layer2
To solve the bottleneck, the only is through scalability solutions. There have been two different approaches in general, one is to scale Ethereum on the base layer (Etehreum) through sharding. ETH2.0 is an ongoing process of scaling Ethereum on layer1. ETH2.0 is making steady progress but it is not an immediate solution.
Another route is to scale Ethereum at Layer2, which essentially is to build a “sidechain” like the second layer on top of Ethereum. Layer2 scalability solutions are ready to use and can provide low gas fees and high transaction throughput. Among all layer2 solutions, there are state channels, Plasma, Validium, side chains, ZKRollups and Optimistic Rollup. Each has its own formula. At this moment, ZKRollups, Optimistic Rollups, and Validium are more commonly used.
In general, with Layer 2, calculations are executed off-chain with unlimited scalability. The differences lie in where data is stored. For ZkRollups and Optimistic Rollups, all data are stored onchain, while Validium and Plasma store data off-chain.
With data stored off-chain, Validium and Plasma are exposed to more centralized drawbacks such as single points of failure. If their centralized servers were shut down, users can not retrieve data to reconstruct transactions. ZK-Rollups and Optimistic Rollup are more decentralized, with better data availability.
Validity Proof vs Fraud Proof
From the perspective of the transaction finality, i.e. how to prove that the transaction is valid, ZK-Rollups and Validium rely on cryptography guaranteed Validity Proof, but Optimistic Rollups and Plasma use Fraud Proof, which requires a much longer time.
From this point of view, if users transfer assets to Layer 2, ZK-Rollups and Validium can allow users to withdraw their assets in a short period of time, and Optimistic Rollups require fraud proofs for verification, and the cycle is 7 days. That is to say, for Optimistic Rollups, withdrawing to layer1 takes 7 days.
Optimistic Rollups currently supports EVM virtual machines, which are more friendly for developers to migrate dAPPs to layer2, but the support for real-time trading Dapps is still not ideal. ZK-Rollups does not currently support smart contracts, but it’s in the roadmap of a few major ZK-Rollup projects. Compared with Optimistic Rollups, ZK-Rollups has more advantages in interoperability across Layer 1 and Layer 2.
ZK-Rollups uses zero-knowledge proof technology to put the calculation proof ofLayer 2 on-chain in real-time, achieving the same level of security as Ethereum Layer 1. Compared with Optimistic Rollups technology, ZK-Rollups has better finality of transactions and a much shorter withdrawal time by several orders of magnitude. Based on this, ZK-Rollups is a better solution for layer2 DEX. ZKSwap is one of the few ZK-Rollup-based Layer2 DEXes that are using the AMM model.
“ZKSwap, a pioneer of ZK-Rollup based DEX”
ZKSwap is one of the few ZK-Rollup-based layer2 DEXes.
ZKSwap uses the Automated Market Maker model, the same as Uniswap or SushiSwap.
At present, ZKSwap can provide users with traditional AMM mode DEX functionalities like swap and liquidity mining.
100% ZK-Rollup Based
First of all, ZKSwap shows considerable advantages in terms of transaction efficiency and transaction costs. In terms of security, ZKSwap will aggregate and data on-chain( ZKSwap has upgraded to 100% ZK-Rollups on March 22), and use zero-knowledge proofs to ensure the consistency of the state of Layer 1 and Layer 2 to ensure the Same security as Layer 1.
ZKSwap’s zero-knowledge proof system adopts a distributed architecture and uses the latest zero-knowledge proof algorithm PLONK to generate proofs. The ZK-PLONK global trusted setup only needs to be generated once, and the circuit scale can be reused within a certain range of applications, which greatly lowered the threshold for the use of zero-knowledge proof.
CPU ==> GPU
Ethereum TPS is about 15–20. Since for ZKSwap, all computation happens off-chain, theoretically, unlimited scalability can be obtained by continuously expanding the number of high-end servers. Currently, Layer 2 requires a lot of computation to maintain a relatively high TPS. ZKSwap uses a CPU zero-knowledge proof, and has deployed more than 100 high-end servers, ZKSwap can process 100 transactions in 15 seconds.
ZKSwap plans to roll out a GPU version in the future, which will greatly improve efficiency and have the opportunity to achieve hundreds or even thousands of TPS.
The ZKSwap mainnet was officially launched on February 14, 2021, and has been running smoothly for more than two months. At present, the number of Layer 2 accounts has reached 86,316, the total TVL has reached 1.386 billion U.S. dollars (up about 4 times compared with the beginning of April), the 24-hour transaction volume is 28.66M U.S. dollars, and the liquidity is 844 million U.S. dollars. ZKSwap has attracted and retained many seasoned DEX users.
Although layer2 has been frequently seen on headlines, there are still only a handful of layer2 products that are actually up and running.
Loopring and ZKSwap are both layer2 DEXes based on ZK-Rollups. Loopring uses Groth16’s zero-knowledge-proof algorithm, and the circuit needs to be reset every time a trading pair goes online. ZKSwap is based on the newer Plonk zero-knowledge proof algorithm, which is more efficient and can update trusted settings without needing to update the circuit every time.
That said, a lot more defi projects like SushiSwap, Balancer, etc are all expanding to layer2. With its technical innovation and actual running experience, as one of the first movers, ZKSwap can be a great reference.
ZKSwap Incentive Program and Vision
After ZKSwap went live on Ethereum in February, its overall performance has been quite strong.
In March, ZKSwap launched series of liquidity mining and staking campaigns. A recent liquidity mining campaign is ongoing. Any interested traders can go to ZKSwap.app to try it out.
At present, the ZKSwap product has been fully launched and is running smoothly. In terms of transaction data, especially TVL, ZKSwap has attracted a large number of users, and as the ZKSwap ecosystem continues to enrich, it’ll need to continually increase system throughput.
According to ZKSwap’s latest announcement, the ZKSwap V2 version is expected to be officially launched in early June. At that time, the new version will support users’ independent unlimited listing. Users can independently add their own ERC20 tokens to ZKSwap’s Layer 2 payment network and exchange network.
On the basis of V1, the ZKSwap V2 version will provide liquidity and transaction support for more tokens. At the same time, ZKSwap mainly focuses on UX optimization, such as improving the throughput and transaction efficiency of ZKSwap.
In addition, ZKSwap officially released the community governance plan on April 22. The community governance token gZKS is generated by a 360-day ZKS staking contract. Users who participate in the staking can obtain gZKS tokens at a ratio of up to 1:1 based on the actual lock-up time.
Users who hold gZKS can participate in community governance, including proposals and voting. Users who hold more than 50,000 gZKS can initiate proposals. There is no threshold for participation in voting. At least one gZKS can be voted at a time. Governance includes currency listing, airdrop, liquidity mining, economic model and technical route adjustment, etc.
As we all know, ZKSwap currently uses the CPU to calculate zero-knowledge proofs. It uses more than 100 high-end servers and can send 100 transactions in 15 seconds. In terms of providing computing power, GPU is obviously more advantageous. ZKSwap also indicated in the roadmap that it will introduce GPU to accelerate off-chain computing power. After the layout, the throughput of ZKSwap is expected to reach thousands of TPS.
ZKSwap implements its zero-knowledge proof through the Plonk zero-knowledge proof circuit, and this proof method reduces the zero-knowledge proof threshold. In Q2 2021, ZKSwap will also optimize the Plonk zero-knowledge-proof system circuit to improve the system efficiency of ZKSwap.
General Purposed EVM on ZKSwap
At present, ZK-Rollups is difficult to deploy smart contracts, which has also become the threshold for many DeFi protocols to migrate to Layer 2 using the ZK-Rollups model. In the long term, ZKSwap will build a general purposed EVM on ZK-Rollup by construing circuits based on the EVM instruction set, which will further lower the threshold for migrating other DeFi protocols to ZK-Rollups.
Traders are a major stakeholder in the cryptocurrency world. High efficiency and low cost will fundamentally improve the trading on DEXes. ZKSwap has already made a great start.
ZK-Rollups solution has a good balance in terms of scalability, security, data availability, finality, and performance. As one of the first Layer 2 AMM DEXes with ZK-Rollups, ZKSwap has seen fast growth and can be great guidance and reference to other defi projects aiming to migrate to layer2.
ZKSwap is a layer2 dex based on the ZK-Rollup technology and using the AMM model. And 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 Discord: https://discord.gg/NfZBKNJuAX
ZKSwap Medium: https://zkswapofficial.medium.com/
ZKSwap Github page: https://github.com/l2labs
ZKSwap Reddit: https://www.reddit.com/r/ZKSwap_Official