How to scale your dApp with the power of zkRollups?

in zkrollups •  10 months ago 

image.png

Leveling blockchains as  the next big technology revolution with the innate capability of adding trust, transparency  and security for enterprise applications wouldn’t be an understatement. But to make this possible, we may need to come out of the monolithic architecture of blockchains and create separate layers for execution, data availability and consensus for some of the applications, matching the privacy and scalability demands of production-grade dApps, without losing the security and cost efficiency. 

Zk-Roll Ups can help us achieve this. . In this article, we shall dive deep to understand Zk-Rollups that use both Zero-knowledge and Rollups technology to help scale Decentralized applications.  

What are Zero Knowledge Roll-Ups?

Zero Knowledge roll-ups introduce a noble solution where the base layer or L1’s need not have to compute transactions in entirety. On the contrary, they can push them on the L2’s, where the required computations can be executed and supporting proofs can be published on the L1 layers as call-data for verification through off-chain VMs. In this way, instead of the L1s choking because of extensive network usage, they can ease the network activity to host a whole new lot of use-cases on top of their ecosystem. 

Benefits of Zero Knowledge Roll-ups for dApps

Low Gas Cost: Since ZKPs post very minimal data to validate a transaction, they occupy very less space on the block. As a result, instead of just a few transcations fitting in a block space, ZKPs accommodate more transcations in the space. Hence, lowering the gas fees by a significant margin. 

Higher Throughput: ZKPs allow the blockchain structure to break into layers as a standalone computation ecosystem. Owing to such a remarkable solution, they completely ease the base layer congestion by only allowing the necessary information to be validated on-chain, while the remaining of the computations can be moved to the L2 layer. 

Privacy: ZKPs ensure privacy by providing only the necessary proof of information instead of providing the complete information. In this way, the user can be sure of protecting their privacy while using the ZKP systems. 

Security: Rollups are much more secure because they inherit the validator security of the underlying base chain. The most important aspect is, users can always bring their assets back to the Layer1 if they are not convinced with the L2 security. 

Faster Transaction finality: zkRollups has faster transaction finality. As soon as the proofs are sent to the base chain,  the state is immediately updated. But it may take some time to accumulate a batch of transactions before they are submitted to L1. Though the zkRollups sequencers give soft confirmations on the transaction status on L2, and that can be useful for many user applications. 

How Do Zk-Rollups Work?

Image description

When a transaction is submitted to a zkRollup, it basically goes to the sequencers, the nodes that are in-charge of ordering the transactions, executing them, batching them together and then submitting to the L1 contract. Though most of the sequencers are centralized at the moment, there are works going on where shared sequencers and direct decentralized sequences could be used in a modular setup.

Anyways, so the work of zkRollups are then, lowering the transaction size from every separate data representing one transaction to a bundled-up transactions rolled into batches with a verifiable Merkle Tree hash-proofs to be posted as validity proofs. .

As you can see from the image, a group of transcations are bundled as one and pushed to the L2’s. The L2’s, which is the ZKP environment, computes the transcations and provide a validity proof to be posted on L1. 

On the L1, there is a smart contract that maintains the rollup state. 

Types of ZK Rollups

Zk-Snark 

ZK-SNARK or also known as Zero-Knowledge Succinct Non-interactive Argument of Knowledge enables applications to scale in significant proportion  in comparison to L1s because they move the computation off-chain and post very little data. 

As a result, they have the capability of reducing the blockchain size in an unprecedented manner. MINA protocol has already been using the SNARK protocols which has reduced the size of its blockchains from GBs to KBs because SNARKs perform computation off-chain and only post minimal information on the  mainchain as validity proofs. 

Zk-STARKs

Zk-STARKs or  Zero-Knowledge Scalable Transparent Argument of Knowledge uses a single off-chain STARK verifier for data  and an on-chain STARK proving system makes them not depend on a trusted set-up but the process of the verification is long enough to make them more gas- intensive in comparison to SNARKS. Along with this, SNARKs came much earlier than STARKs which give them an adoption age over SNARKs. 

So, despite the efficacy they bring with respect to scaling Dapps with very little security threats, STARKs have a long way to go until they do everything that SNARKS do with the same cost efficiency but less dependency on a trusted set-up. Such a technology innovation could help STARKs win an edge over SNARKs in adoption in the age of the ZKPs

PLONKs 

PLONK or Permutations over Lagrange-based for Oecumenical Non Interactive arguments of Knowledge could be summed as a perfect fusion of both ZK-Snark and Zk-Starks inheriting their advantages and building on top of their drawbacks. For example, unlike SNARKs that require a trusted set-up, PLONKs need a universal, upgradable trusted set-up that can be changed as per the use-cases of the project. So, it would not simply put a cap on the verifiers to be of a certain proportion; rather, they can join the system and validate based on the project requirements without other verifiers having any knowledge of the same. 

The LagRange based permutation combinations which boast fancy cryptography using Polynomial commitments will make PLONKs even Quantum Resistant using the Lattice Based Cryptography. How’d that happen? The Kate Commitments which use a trusted Setup and Elliptic Curve Pairings would demand the compromise of the system through a public based information as evident through a secret message. But since Lattices will be in place, it makes the system completely resilient to sabotage or compromise through a joint nexus of verifiers. 

Difference Between Different Zk-Rollup Solutions: A TL,DR

Basis SNARK STARK PLONK 
Algorithmic Complexity O{(N*Log (N)}O(N * poly-log(N))O(μ log d
Communication Complexity Size ~O(1)O(poly-log(N))O(µ)
Size Estimate 1 TXTx: 200 bytes, Kev: 50 MB45 KB Less than 10kb
EVM Verification Gas Cost ~600k (Groth16)~2.5M (estimate, no impl.)1 million To The Cost of ETH Gas Cost 
Trusted Setup YesNoHybrid 
Post Quantum Secure NoYesYes
Crypto Assumptions Strong Collision Resistant hashes Group of Unknown Order 

Implementing Zk-Rollup solutions for Scaling Dapps 

While integrating the ZK-rollup solution in your application architecture, you need to be mindful of compatibility, low cost intensive proof systems but it is equally important to acknowledge some drawbacks nonetheless. In this regard, a few ZK-Roll Up solutions have left their trails; 

Zk-Sync Era 

ZK-Sync Era developed by Matter LABS as an EVM compatible roll-up solution prioritizes data availability by posting only minimal information on-chain. As a result, it could compress data by a significant proportion to take down the transaction cost; meanwhile increase the TPS by leaps and bounds. At the time of writing, ZK Sync Era became the first ZkEVM to hit mainnet which has already hosted the NFT project named ZkApes. In the upcoming days, we might also see TOFU going live on Zk-Sync Era. 

zkSync Hyperchains 

In the world of Dapps, walled gardens might allow you to have full control over your sovereignty but it doesn’t guarantee one unified system for all. That’s why the need of the hour is to provide a better stack based infrastructure that can give you the trade off of decentralization while ensuring scalability and security. Hyperchains, as a ZkSync powered ecosystem has  achieved that for the world of dapps. Through the use of hyper chains, Dapps  can enjoy the same scalability experience similar to the Internet despite using decentralized networks..  

You can think of your own application like Uniswap launching its own sequencers and tech infra using the Hyper Chains to scale its ecosystem. The technology stack has been designed in such a way that it can introduce recursive scaling which shall batch transactions in ZKPs and these transcations  will be further batched into a single proof to ensure even greater compression and scalability.   

Polygon ZkEVM 

Polygon ZkEVMs allow Dapps to create optimized Ethereum instances through a recursive STARK based tech infrastructure which amplifies decentralization, flexibility, scalability and even interoperability. In addition to this, Polygon ZkEVM also introduces EVM Equivalence ecosystem which allows multiple Dapps to interoperate among each other without compromising the scalability and liquidity. While the Zk Proofs have enabled transaction validity, the use of ETH as the base L1 layer guarantees security that dapps need for adoption and scalability happening in tandem. 

Polygon CDK

Polygon CDK provides scalability, robust data availability, LXLY bridges and unified liquidity to supercharge your Dapps. Building on top of the Polygon CDK could help you optimize your project as per the user-centric approach that can determine its success . Polygon CDK also boasts a DAC which could be pivotal for scaling your DAPPs because developers will get the flexibility to choose the Validium framework that can complement their Dapp needs. As a result, applications built on top of the Polygon CDK experience the same impact as L1s or separate chains but with a trade off of experiencing a near infinite scalability because they can break the execution layer, settlement layer and data availability layer as per the use case requirement. Hence allowing business logic customization as per the evolution of the project. 

Launch your dApp on a zkRollup with Zeeve

If you have already convinced on the value adds of ZKPs for your dApps, the next step is to choose the right zkScaling solution. As we discussed above, there are public zkRollup chains (zkSync Era, Polygon zkEVM) offering the ZK capabilities and there are solutions like Hyperchain and Polygon CDK that lets you create your own application-specific zkRollup blockchains. Which one is best for you depends on your scalability, customization and modularity requirements. But whichever solution is preferred for your application, Zeeve provides access to that with nodes and complete network infrastructure. 

You can get access to the Polygon zkEVM and zkSync Era public mainnet nodes and also can get 1-click sandbox access to Polygon CDK and zkSync Era’s Hyperchain through an automated no-code deployment dashboard. The additional infrastructures for your zkRollup chains, like block explorers, faucets, data indexers can also be set up using Zeeve platform easily using our Rollups-as-a-service(RaaS). And all these comes with an 99.9% uptime guarantee and Enterprise SLA. 

If you have any further doubt regarding choosing the right ZK scaling solution for your dApp, get in touch with our Zeeve experts. Schedule a call today and see how Zeeve can simplify your zkRollup deployment experience. 

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!