Published in


Layer2 Security and Efficiency A Technical Overview of Different Layer2 Scalability Solutions

High gas fees and low TPS have brought the Layer2 scaling debate on Ethereum into focus. ZKSpeed, the Layer2 scaling solution launched by the ZKSwap team, has a technical lead over other scaling solutions in the market, resulting in a better product experience.

This article will compare the similarities and differences between the ZKSwap and other scaling solutions from a technical perspective, based on the existing products in the market. Before going into details, we will briefly introduce the status of Layer2 scaling technology.

What is L2 Scaling?

Ethereum Layer 2 is a market not to be overlooked with continuous technical innovations and various products emerging. The Layer2 solutions can be generalized into three approaches:

1) State Channel: where users transact with one another directly “off-chain” with instant finality and high throughput. However, setting up the channel takes time and requires funds lockup and routine monitoring on the channel status.

2) Sidechain: is a standalone blockchain with an independent consensus mechanism that doesn’t synchronize with the Layer1 consensus, which is considered a disadvantage.

3) Rollup: It can be regarded as an advanced non-custodial sidechain. It puts computation off-chain, with transaction data and the latest world state on-chain, ensuring the on-chain data availability.

Compared with the other two solutions, Rollup does not require token lockup or setting its own consensus mechanism; and it guarantees the same level of security as Layer1. As Layer2 technology continues to evolve, Rollup solutions have become diverse. Depending on the location of the transaction data storage and the proof method used, Rollup technology can be subdivided into the following four categories.

1. ZK-Rollup: Layer1 + Validity proofs, where data is stored on-chain, and zero-knowledge proofs are used to ensure the validity of state transitions.

2. Optimistic Rollup: Layer1 + Fraud proofs, where data is stored on-chain, and fraud proofs are used to verify the validity of state transitions.

3. Validium: Layer2 + Validity proofs, where data is stored off-chain, and zero-knowledge proofs are used to guarantee the validity of state transitions, and a “data availability committee” is established to ensure the availability of data off-chain.

4. Plasma: Layer2 + Fraud proofs, where data is stored off-chain and users provide fraud proofs to verify the validity of state transitions.

When designing a Rollup based network, the development team often needs to make a trade-off between efficiency and data availability based on different business scenarios. Each product has its trade-offs between efficiency and absolute security.

Most of the products in the current market would fall into ZK-Rollup, Optimistic Rollup, Validium. Plasma was the earliest solution proposal with relatively fewer thoughts put into security settings.

Which Rollup Solution Does ZKSwap Stand?

ZKSpeed is a Layer2 scaling solution developed by the ZKSwap team. It’s a solution that draws on the merits of all existing Rollup solutions that can achieve 0 gas fees on Layer2 use cases with high TPS.

This article selects four leading solutions, including StarkNet by StarkWare, Unipig by Uniswap, Loopring, and ZKSpeed by ZKSwap, and compares each solution.

As shown in the following table:

Analysis Table of Layer2 Scaling Options

Image caption: crs corresponds to the zkp algorithm that requires multiple trusted setups; srs corresponds to the zkp algorithm that requires only one trusted setup;

The table has shown:


Loopring’s Layer2 scaling scheme is based on ZK-Rollup, and also supports the Validium scheme, which means there are multiple options for on-chain data availability. The zero-knowledge proof algorithm used in this scheme is the zk-SNARKs algorithm, which requires a third party to generate the trusted setup.

Pros: the algorithm proof size is of constant size (e.g., Groth16 algorithm).

Cons: The trusted setup is not universal and requires a separate trusted setup for each transaction type. This setup would require the transaction type in each block remain the same type for proof efficiency. In cases where there are fewer transaction types of a specific type, there would be a delay in getting such transactions on-chain. Like carpooling, transaction data has to wait for the transaction size to reach a certain level before the block can be packaged. The recently upgraded 3.6v Loopring protocol has lifted this same transaction type restriction, which will lead to a better transaction experience.


The scaling protocol StarkEX developed by StarkWare supports two solutions — Validium and ZK-Rollup. The validity of state updates is guaranteed by a zero-knowledge-proof algorithm, the zk-STARKs algorithm.

Pros: unlike the commonly used zk-SNARKs algorithm, the zk-STARKs algorithm does not require a third-party trusted setup, and its algorithm itself does not rely on mathematical puzzle assumptions and is somewhat quantum resistant.

Cons: the proof size is much larger than other zkp algorithms, and proof generation requires significant computational resources and storage space. Meanwhile, the StarkWare team has developed a STARK-based open license ZK-Rollup product, which supports general-purpose computing based on the Cairo language. Click Here for starkNet details.


Unipig of Uniswap was designed based on Optimistic Rollup. Users can challenge invalid transactions and provide proof of fraud to verify whether the validators are honest or malicious.

Pros: The solution is EVM compatible, and the transaction data is stored on-chain, which ensures security.

Cons: Due to potential fraud proofs, the on-chain transaction processing is delayed. And the cost for fraud challenges is high, hence makes it somewhat ineffective.


ZKSpeed is a Layer2 scaling solution developed by the ZKSwap team. It’s a solution that draws on the merits of ZK-Rollup, Validium, and Optimistic Rollup.

All data for transactions interacting with Layer1 are stored on-chain (ZK-Rollup), and data for pure Layer2 transactions are stored off-chain (Validium), and transaction hash data are stored on-chain. ZKSpeed will also provide a fully on-chain version, allowing higher security and ensuring the validity of state transitions via zero-knowledge proofs.

Differences between ZKSpeed and the other Three Scaling Solutions:

1. ZKSpeed adopts the PLONK zero-knowledge algorithm, where all transaction types share a common trusted setup, thus eliminating the need for packaging blocks by transaction type.

2. ZKSpeed uses a GPU-implemented PLONK algorithm which runs three times faster than the ordinary CPU-implemented version. In addition, with top-notch hardware equipment, the solution significantly shortens proof generation time and improves system throughput.

3. After thorough research, the ZKSwap team adopted the Aggregation proof for ZKSpeed, which was the first to implement it in an AMM model DEX. (The Aggregation proof was first proposed by Matter Labs and was used in simpler applications). Aggregation proof gathers proofs of multiple blocks and aggregates them into a single proof, making it possible to validate multiple blocks on-chain at once. Thus, it significantly reduces the average cost of one transaction.

Aggregation Solution

Processing transactions in batches is a prominent feature for Rollup solutions. It generates proof of validity for all transactions in one block, and the main contract on-chain verifies the validation for the proof. This solution vastly increases the throughput and reduces transaction costs compared to processing individual transactions in sequence.

However, the ZKSwap team found that the number of transactions that could be processed in bulk within one block was limited by the elliptic curve parameters of the zero-knowledge proof algorithm. The cost for one on-chain validation is up to 500,000 gas. As a result, the cost per single transaction is not as low as expected. Therefore, the ZKSwap team continued research for further breakthroughs and decided to use Aggregation proof.

The idea of the aggregated proof is simple: A proof of every block is an input. Each on-chain verification process is a proof circuit for proof validity. The form of verification is a bilinear pairing so that multiple proofs can be linearly combined. A single bilinear pairing would be enough to complete the validity verification for all proofs.

With this method, multiple proofs would only need validation once for all, and the cost of validation would be significantly cheaper. The actual amount of cost would depend on the extent of block aggregation, i.e., the number of blocks aggregated at one time.

ZKSpeed currently supports aggregation of 5, 10, or 20 blocks, adjustable at different situations. To further reduce transaction costs, the ZKSwap team also aggregates on-chain commits, i.e., submit multiple blocks on-chain with one commit. This way reduces the fixed cost and transaction cost at the same time. As a result, a single transaction cost can be reduced to 1,400 gas, much lower than other similar products.


Though the ZKSwap solution is currently not EVM compatible, the ZKSwap team’s vision is to build a Rollup based scaling solution that supports general-purpose EVM, allowing applications to migrate quickly without having to rewrite smart contracts. The ZKSwap team has already started researching and made some progress in this regard. In addition, StarkWare and Matter Labs have developed Layer2 scaling solutions StarkNet and zinc respectively, which require proof logic to be written in a newly designed DSL language. In the future, the ZKSwap team is open to collaboration with other teams to collectively contribute to the Ethereum Layer2 ecosystem.

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/ZRxS8fYTDv

ZKSwap Medium: https://zkswapofficial.medium.com/

ZKSwap Github page: https://github.com/l2labs

ZKSwap Reddit: https://www.reddit.com/r/ZKSwap_Official




ZKSpace is an all-in-one layer2 platform, featuring ZKSwap, ZKSea, and ZKSquare.

Recommended from Medium

Octopus Network at ETHDenver 2022

The Instant Distribution Agreement

Binance joins Seascape Network to take DeFi Gaming to the Next Level

Pixelflowswap X Binance Smart Chain

KardiaChain and Tokoin Sign MOU to Strengthen Technical and Strategic Scope

The Marriage of Artificial Intelligence (AI) and Blockchain Deepens with Birth of Chinese Fintech…

Club Goods, Digital Infrastructure, and Blockchains

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


ZKSpace (https://zks.org) is an all-in-one layer2 platform, featuring ZKSwap, ZKSea, and ZKSquare.

More from Medium

ZKSpace Weekly Dev & Operations Report (2.7–2.11)

On-Chain Privacy: By Default, For All, On Cosmos

Figment is Supporting Crucial Blockchain Infrastructure on Evmos

Zecrey Wallet Release 0.2.0 — Layer 1 Mainnet Launch