Rollups for Haqq Blockchain

Salih Hussainar
6 min readDec 2, 2022

--

All things about rollups and how we can build roll-up for Haqq

Overview

In this article, we are going through rollups and what are the benefits, pros, cons, etc. We are also walking through examples of some rollups, how we can build rollups for the Haqq blockchain, and many more!

Why do we need rollups?

Rollups create a general-purpose solution while still having the security of the main chain of the blockchain like the Haqq blockchain and work well for a specific set of applications, organizations, or countries. It helps in reducing fees and blockchain adoption by increasing participation. One of the great features of the rollups are they speed things up: the rollup is very quick to perform and the Main blockchain needs only to process a single transaction rather than many. there are numerous applications of rollups that you can integrate into your own decentralized app

What are rollups

Rollups are one of the EVM blockchain scaling solutions to increase transaction speed and throughput without compromising the decentralized nature of the blockchain.

Before diving more into rollups we need some understanding of 2 scaling solutions for EVM chains

On-chain Scaling

On-chain or Layer 1 scaling solutions refer to increasing the capacity of the core blockchain layer, usually by increasing the number of transactions that can be fit in a block. In Haqq’s case, on-chain scaling would mean changing the Haqq Mainnet protocol. It increases the hardware requirements to run a node. It can limit the number of nodes and may affect decentralization

Examples are polygon, Algorand, Binance, etc.

Off-chain Scaling

Off-chain scaling is the way in which we are indirectly scaling the main blockchain by adding more layers to process the transaction without using the actual core blockchain. Off-chain scaling uses the main layer of the blockchain as a trust and arbitration layer. These solutions further require additional hardware or complex software to be built. Layer 2 solutions derive their security from Ethereum and can be custom-built/run by an individual, organization, or community based on the use cases.

Examples are rollups like Arbitrum, Optimisim, zkSync etc.

Rollups

Rollups are layer 2 solutions such as channels that are fully secured by EVM chains like Haqq security but work well for a specific set of applications, organizations or countries. Rollups settle the transactions outside of the Haqq network but post the transaction data back to the Haqq network and still derive its security from the Haqq network. Each rollup has its specific contracts deployed on the Haqq network. Rollups execute the transaction off the chain (out of the main chain ) mainly on a rollup-specific chain and then batch the transaction data, compress it, and sends it to the main Haqq chain

Types Rollups

Now we are tackling the big question. we know rollups execute transactions outside of the main network and then send batched and compressed data to the main network. but in this case, we need to make sure that transaction data posted on the main network by rollups are valid or not.

Different rollups handle this differently. These 2 rollups are based on this. Optimistic rollups and ZK rollups

Optimistic Rollups

Optimistic rollups as the name suggests at first, assume that the transaction data submitted to the Ethereum network is correct and valid. whenever there is transaction is invalid it should have dispute resolution. A party submits a batch of transaction data to the Haqq blockchain, and whenever someone detects a fraudulent transaction, they can offer fraud-proof against that transaction. Here both the parties, the one submitting the transaction data batch and the one submitting the fraud-proof, have their ISLM staked. This means that any misconduct from either party would result in the loss of their ISLM. Whenever a fraud-proof is submitted, the suspicious transaction is executed again, this time on the main Haqq network. To make sure the transaction is replayed with the exact state when it was originally performed on the rollup chain, a management contract is created that replaces certain function calls with a state from the rollup.

Benefits: Optmisitic Rollups

  • Optimistic rollups were the only ones capable of executing smart contracts among all rollup solutions.
  • Porting smart contracts from Haqq network is very easy than other rollups
  • Massive improvements in scalability without sacrificing security or trustlessness
  • Trustless liveness. anyone can force the chain to advance by executing transactions and posting assertions

Drawbacks: Optmisitic Rollups

  • Bridging between Haqq network and rollup chain delays due to potential fraud challenge
  • Users must wait for the one-week challenge period to expire before withdrawing funds back to Haqq
  • This rollups post all transaction data on the Haqq blockchain. which can increase the cost
  • Centralized rollup operators (sequencers) can influence transaction ordering.

Examples of some ethereum rollups are Optimism, Arbitrum.

ZK-Rollups

ZK-rollups or Zero-Knowledge rollups, unlike Optimistic rollups, don’t have any dispute resolution mechanism. It uses a clever piece of cryptography Zero-Knowledge proofs. n this model, every batch of transactions submitted to Haqq includes a cryptographic proof called a SNARK ( Succinct Non-Interactive Argument of Knowledge ) verified by a contract that is deployed on the Haqq network. This contract maintains the state of all transfers on the rollups chain, and this state can be updated only with validity proof. This means that only the validity proof needs to be stored on the main Ethereum network instead of bulky transaction data, thus making zk-rollups quicker and cheaper comparatively

Benefits: ZK-Rollups

  • There is greater capital efficiency for the users because bridging of Crypto between Haqq manner and zk-rollups is faster
  • ZK-rollups employ trustless cryptographic setups to ensure their security. trustless crypto mechanisms are a safer bet than honest validator setup in optimistic rollups
  • Lower fees for users because only validity proof is stored on the Haqq blockchain
  • No need for extra validation technique to protect their assets because it doesn’t depend on assumptions
  • The use of validity proof prevents operators from making incorrect changes to Ethereum’s state

Drawbacks: ZK-Rollups

  • The cost of building zero-knowledge rollups compatible with EVM is high.
  • Zero-knowledge technology is complex
  • Computation and validity proof verification costs are high and can increase fees for rollup users
  • The ZK-proof system usually requires a trusted setup. If a trusted setup is mishandled it will compromise the rollup’s security significantly

Example rollups in Ethereum are Loopring, STARKWARE, zkSync.

Optimistic Rollups vs ZK-rollups

Both rollups differ in a range of aspects in the modes of operation. The key difference between them is that optimistic rollups rely on fraud proofs, while zk-rollups rely on zero-knowledge proofs to verify changes to the main chain.

Scalability

Optimistic rollups provide significantly higher scalability than their zero-knowledge counterparts. Since they do not require computation work to submit transactions on-chain, optimistic rollups can improve scalability far more than ZK-rollups, which do computation work before updating state changes

However, when it comes to withdrawing funds from rollups to the Layer-1 chain, optimistic rollups seriously lag behind their zero-knowledge counterparts. This is because the withdrawal of funds is subject to a delay to allow anyone to challenge an exit transaction with a fraud-proof

Costs

ZK costs more due to the creation of validity proof on counterparts optimistic rollups do not perform any extra computation off the chain so fewer costs for that kind of computation

privacy

Optimistic rollups can only provide privacy solutions available on base layer blockchain networks since optimistic transactions post all transaction data on-chain.

On the flip side, zero-knowledge rollups have some measure of privacy in their makeup. This happens primarily because transaction data is not posted on the base layer individually but only as validity proof.

Risks of rollups

Many rollups also continue to rely on centralized “sequencers” to efficiently coordinate transactions on the layer 2 chain. A sequencer can’t spoof or alter transactions, but it could technically censor or re-order them to extract some benefit for itself.

For one thing, a rollup’s smart contracts can contain bugs — not unlike any other program built on Ethereum. While fail-safes and audits should help prevent exploits, relying on an external program to handle transactions will always carry some added risk.

Both types of rollups are also still in their infancy, and as such the networks on which they operate are often somewhat centralized. In some cases, the developing team behind a rollup maintains partial control over the network, and can theoretically pause or switch it off wherever they like.

Conclusion

Rollups are a major part of efforts to scale Haqq using layer 2 architecture. rollups build on Haqq’s security and decentralization while offering cheaper fees and faster transactions. and we can create new highly secure isolated rollup chains for different purposes, organizations and countries

--

--