Singapore-based ZKSwap (ZKS) is a pioneering decentralized exchange with the option of seamless token transfer between Ethereum’s Layer 1 and Layer 2. This unparalleled opportunity is possible due to zk-rollups, a cutting edge Ethereum (ETH) scaling practice that rolls up multiple transactions into a single one and broadcasts them to Ethereum’s (ETH) mainnet, saving on gas and bandwidth.
In early Q3, 2021, ZKSwap (ZKS) unveiled the second iteration of its technical whitepaper. It covers plenty of new functions added in ZKSwap (ZKS) v2 and provides a detailed explanation of all available instruments.
ZKSwap (ZKS) releases updated whitepaper: What’s new in v2?
ZKSwap v2 is expanding on its V1, which is among the top mainstream DeFi platforms on the Layer 2 basis. At the same time, ZKSwap v2 has a number of crucial additions compared to its previous iteration:
- Unlimited token listing, i.e., users’ ability to add new tokens to the trading suite;
- Optimized circuit efficiency: logics of balances and accounts are reconsidered;
- Optimized withdrawal process, i.e., simplified and advanced design of the interaction between Layer 1 and Layer 2;
- Multi-chain support: ZKSwap will have its architecture deployed to all mainstream EVM-compatible public blockchains: Binance Smart Chain (BSC), Huobi ECO Chain (HECO), OKEx Chain and so on.
ZKSWap v2 (ZKS) design basics: accounts, commands, tokens
Different types of tokens, accounts and in-app commands represent the backbone elements of ZKSwap v2’s (ZKS) innovative technical design.
First of all, the new whitepaper introduces different types of tokens involved in ZKSwap v2 (ZKS) design: fee tokens, user tokens and liquidity providers’ tokens (LP tokens).
Fee tokens can be added by the “Governor,” a team’s smart-contract-based instrument that allows them to introduce crucial changes to the protocol. Ethers (ETH), Wrapped Bitcoins (WBTC), U.S. Dollar Tethers (USDT) and ZKS, core native assets of ZKSwap v2, are utilized as fee tokens as of Q3, 2021. Fee tokens should be considered an internal payment method in ZKSwap v2: users can designate one of them as the preferred fee token.
The user token is essential for a brand-new function, “Unlimited Token Listing.” Every user can deploy his own ERC-20 token to ZKSwap v2. The listing procedure is user-friendly and charges a reasonable flat fee.
Liquidity providers’ tokens are released on ZKSwap v2 automatically once a new user token is added by a client.
In total, ZKSwap v2 (ZKS) is capable of supporting 2^28 accounts. Account “Zero” is appointed as the Validator account.
“Governor” is a specific account authorized to conduct some extra functions. Namely, it can set the fee rates and modify the creation of trading (liquidity-providing) pairs.
In its “Architecture Optimization” section, ZKSwap v2 (ZKS) has specified 12 types of commands supported by the system (“OP” types). Namely, these are: “Noop,” “Deposit,” “TransferToNew,” “Withdraw,” “Close,” “Transfer,” “FullExit,” “ChangePubKey,” “CreatePair,” “AddLiquidity,” “RemoveLiquidity” and “Swap” OPs.
Transfers, withdrawals and the addition/removal of liquidity are charged with fee tokens, while swaps are also charged with an extra 0.25% fee from the liquidity taker.
Fees collected from transfers, withdrawals and liquidity operations are sent to the validator, while fees from swap operations are partially distributed between liquidity providers - just like on SushiSwap (SUSHI) and Uniswap (UNI) on-chain DEXes.
ZKSwap v2 instruments: “Who’s who” in ZKSwap
All transactions on ZKSwap V2, including token transfers between Layer 1 and Layer 2 infrastructures, are broadcast as “Pub Data” to Layer 1, with a chunk the size of 11 bytes to ensure maximum resource-efficiency.
The “Noop” command allows for the sending of empty transactions to Layer 2 blocks. With its one byte size, this is the smallest possible command on ZKSwap v2.
The “Deposit” command refers to a process of depositing assets from Ethereum’s Layer 1 (mainnet) to ZKSwap v2 smart contract infrastructure. The system transfers tokens from Layer 1 to Layer 2 automatically.
In this step, Layer 2 account identification data (account ID) is not verified by Layer 1. The “Pub Data” of the transaction includes account ID, token address, token amount and target address. In total, it consists of four chunks of 43 bytes.
The “Transfer” command is responsible for moving assets across ZKSwap v2 Layer 2 accounts. Compared to previous “Deposit” steps, this command also considers the amount of fees and the type of token they are paid with. “Pub Data” for this transaction includes two chunks, or 19 bytes in total.
The “TransferToNew” command is interesting: it allows token transfer on Layer 2 with no need for the recipient to create his/her account in advance. This command broadcasts four chunks as “Pub Data,” which is equal to 39 bytes.
The “Withdraw” command is of paramount importance for systems like ZKSwap v2, as it is responsible for the interaction between L1 and L2, i.e., the core “killing feature” of such platforms. With “Withdraw,” a user can move his/her assets out of ZKSwap v2 to Layer 1 contracts of Ethereum (ETH) or EVM-compatible blockchains. This command broadcasts five chunks of data, or 46 bytes in total.
The “FullExit” command allows the withdrawal of assets directly from the Layer 1 segment of ZKSwap v2 (ZKS). This operation, in turn, needs to be verified by Layer 2 mechanisms. The authorization of this operation takes four chunks (43 bytes net).
With the “ChangePubKey” option, a user can withdraw his/her assets from Layer 1 to Layer 2 of ZKSwap v2 (ZKS). This is the largest operation in ZKSwap’s design: it takes five chunks of 43 bytes due to the fact that it utilizes a public key hash of 20 bytes in length.
The “CreatePair” command is designed to allow users to create their own transactional (liquidity) pools. With this command, pools are created once the corresponding smart contract (associated with the LP token) goes live on Layer 1. This operation is 32 bytes long and consists of three chunks.
The “AddLiquidity” and “RemoveLiquidity” commands are responsible for manipulations of liquidity in transactional (liquidity) pools. As the interaction between the two layers is optimized with ZKSwap v2 (ZKS) design, liquidity operations on Layer 2 do not need authorization on Layer 1. The addition and removal of liquidity include three chunks, each taking 31 and 32 bytes of memory, respectively.
Finally, the “Swap” command is attributed to the decentralized on-chain peer-to-peer exchange of ERC-20 assets. It takes two chunks of data with a net volume of 22 bytes.
ZKSwap v2 optimizes L1/L2 interaction
In ZKSwap v2 (ZKS), a number of improvements were implemented in the sphere of interaction between the two layers of Ethereum-based smart contracts architecture.
To start with, in v2, the fee token balance and the user token balance are applied to a single account. It makes all operations with automated market makers far more resource efficient as the data size transferred to the blockchain is reduced significantly.
Also, ZKSwap v2 engineers optimized the process of token withdrawal from Layer 2. Previously, all such operations were verified from Layer 1 infrastructure. Once the transaction is verified by Layer 1, the updated hash tree is confirmed within the next block. As such, the procedure of token withdrawal was really bumpy: the number of withdrawals per block was limited to four operations.
In the new iteration of ZKSwap v2 (ZKS), withdrawal and verification operations are separated from each other. Once the block is verified, pending withdrawals are created and completed via the “CheckWithdrawls” and “CompleteWithdrawals” functions. Therefore, block verification is optimized for multi-block aggregation. In the second iteration of ZKSwap (ZKS), the maximum number of withdrawals per block spiked to 174.
New use cases for ZKSwap v2
With all these optimizations, ZKSwap v2 Layer 1/Layer 2 infrastructure is opened up for a number of completely novel use cases previously unexplored by the system. ZKSwap v2 engineers from veteran Ethereum-focused studio L2 Labs are seasoned advocates of the "Layer 2 for all" multi-chain ecosystem strategy.
Within this strategy, any token of any EVM-compatible chain (ERC-20 for Ethereum blockchain, BEP tokens for Binance Smart Chain and so on) can be included into ZKSwap’s liquidity architecture.
Also, ZKSwap v2 is laser-focused on addressing another red-hot segment of Ethereum’s metaverse: non-fungible tokens (digital collectibles or NFTs). ZKSwap teases the launch of an Ethereum Layer 2 NFT protocol that will significantly improve the user experience and the cost-efficiency of NFT operations on Ethereum. Thus, NFT-centric instruments will coexist with AMM functionality: such a concept will be game-changing for the entire Ethereum economy.
ZKSwap v2 (ZKS), a pioneering Ethereum-based decentralized cryptocurrencies exchange powered by an automated market making engine and ZK-rollups Layer 2 solutions, has released its second whitepaper.
In this document, its engineers specified the basics of ZKSwap v2’s technical design, such as account structure, command types, supported tokens and so on.
In particular, the second whitepaper of ZKSwap (ZKS) emphasized the improvements in its freshest version; namely, unlimited token listing, reshaped cost-efficient interaction between Layer 1 and Layer 2, etc.
Finally, ZKSwap (ZKS) indicated a number of new use cases for its updated structure, including an AMM-powered NFT protocol on Ethereum’s second-layer platforms. This combination of the DeFi and NFT concepts will open up a new avenue for innovative business schemes on Ethereum (ETH) and related blockchains.