Ethereum layers 2 are currently all the attention in the cryptocurrency market. The layers 2 Arbitrum, Optimism or zkSync use rollup technology to increase the layer 1 scalability and offer networks adapted to specific applications. It is therefore necessary to understand this technology which could also contribute to the success of the Kadena network.
What is a rollup?
There are two ways to scale a blockchain. Either we improve the blockchain capacity, for example with the use of sharding or Kadena's chainweb, or we put some of the activity outside the blockchain. A smart-contract located on the blockchain will have the function of linking the blockchain and off-chain activity by managing deposits, withdrawals and validating off-chain activity.
The rollups will develop this second solution by compressing the data whenever possible. More precisely, the data is replaced by a calculation. This compression is important because it greatly reduces gas costs; the fees can thus be 100 times lower than those of layer 1. The transactions are then sent in batches on the blockchain in order to be validated.
Concretely, a rollup works with a Merkle tree. The smart-contract present on the blockchain contains a state root, the Merkle root of the rollup state (the balance of the accounts, the code of the contract which is inside the rollup). It is possible to recalculate the whole tree from the root.
The next batch will contain both the new state root and the previous state root. The contract then checks that this last root matches its current state root. In this case, it is replaced by the new state root.
However, this solution can cause problems when a malicious actor comes along and releases a fraudulent state root. It is in the verification process that the optimistic and the zk rollups differ.
What is the difference between optimistic and zk rollups?
Optimistic rollups use two types of actors to release and package transactions: issuers and aggregators. Issuers publish their transaction on the network. Aggregators gather transactions and release the state change to the main chain. However, there is no cryptographic proof in this state root. It is therefore necessary to wait 7 days for the batch to be validated on the blockchain.
If someone disputes the new state, they can challenge the aggregator to come up with the valid root and recover some of the collateral pledged by the dishonest aggregator. This technology is said to be optimistic because the batch is initially considered to be valid, but withdrawals from layer 2 to layer 1 can only be made after 7 days
zk rollups want to increase network security and decrease withdrawal time by providing cryptographic proof. Aggregators are replaced by relayers. The relayers must also deposit funds as collateral on the rollup smart contract. They will collect the transactions, assemble them and calculate a cryptographic proof that guarantees the transactions validity. This is a SNARK proof that represents the difference between the current state and the previous state of the rollup without having to disclose the transactions. Security is then increased and the withdrawal time from layer 2 to layer 1 is reduced. This is why many see zk rollups as one of the most effective solutions to the scalability problem.
By working on the zk rollups technology, the Kadena team therefore aims to use all possible means to make possible the mass adoption of web3. If the architecture of the ChainWeb already creates an infinitely scalable data availability layer on Kadena, the zk rollups addition will give the architecture for the specific needs of the future applications.