Introduction of layer2 and Cartesi Rollup
What is layer2?
Layer2 usually refers to the expansion of the layer1 network, relying on the security of the layer1 network to solve the problem of layer1 throughput and the increase in gas fees caused by network congestion. Layer2 design principle: The transaction is executed outside layer1, the transaction execution result is stored on layer1, and the data on layer1 can be used to verify the result of layer2.
There are currently two types of layer2 solutions, 1) optimistic rollup, representative projects are Cartesi, Arbitrum, Plasma, 2) zero-knowledge rollup, representative projects are ZK-Sync, StarkNet.
Optimistic Rollup
The new state root hash is rolled up by operators without verification, and the state information is submitted to the layer1 network. At the same time, users or other operators are allowed to challenge any transaction in the layer2 network during the challenge period. Once an invalid transaction is found, the invalid transaction will be rolled back and malicious operators will be punished. So there will be a delay of several days when deposits in layer2 are redeemed back to layer1.
ZK-Rollup
A layer2 network validator collects thousands of transactions and aggregates them into a block, submitting a commitment (its root hash) and a SNARK proof to the mainnet. Every transaction on layer2 can be refactored and validated by anyone at any time, and its gas cost on layer2 is only a small part of the gas cost of calldata on mainnet.
What is Cartesi Rollup?
Like the Optimistic Rollup mentioned earlier, during the challenge period, on-chain adjudication of transactions containing fraud proofs can be made. Cartesi team implements an interactive dispute resolution solution. Unlike Optimistic Rollup, Cartesi Rollup divides the entire epoch of assets from layer2 to layer1 into three stages, accumulation slot, processing slot, and settlement slot. The accumulation slot is the minimum delay imposed on on-chain finality determination to reduce the frequent claims sent to the first layer and reduce the cost on layer1, this time is determined by the developer to balance finality and safety. The processing slot is process transitions on layer2. The settlement slot is for a challenge period, with or without disputes. At the same time, Cartesi rollup implements sharding on layer2. Each Cartesi machine verifies a single contract, and promotes the state transition of layer2, and validators decide whether to guarantee the withdrawal. If so, the corresponding bytecodes are output and the layer1 contract will execute the bytecodes.
Cartesi Rollup also allows to develop in any language/library/software in Linux OS. DApps run on off-chain Linux OS instead of on-chain virtual machines. By running Cartesi Machine, the full state of the virtual machine is merklized, and state updates do not require evidence to accompany them.
Cartesi machine has developed a virtual machine based on RISC-V, which defines the processor, RAM, ROM, flash drive, and other devices, and it can simulate a complete set of Linux systems. Look at the Cartesi machine from the perspective of the chain, the Cartesi machine is independent and reproducible, the results of off-chain calculations performed by honest users will be agreed on-chain, and dishonest users will be punished and rewarded to honest users.
You can deploy smart contracts off-chain and return the results to the chain for verification. The Cartesi node provides a reproducible Cartesi machine for DApp developers to run large-scale and scalable verification calculations. The Cartesi node allows you to use all programming languages, tools, and libraries, and even the project source code, without the need to develop DApps based on Solidity like Ethereum, so you can implement complex business logic.
Rollup Solutions Comparison
ZK-Rollup requires a lot of hardware computing resources because it needs to generate SNARK proofs, but its finality confirmation only takes ten minutes. The Optimistic Rollup fraud proof does not require a lot of hardware, but its finality confirmation takes 1 to 2 weeks. Both zk-Rollup and Optimistic Rollup only support solidity or other limited development languages for contract development, while Cartesi inherits the advantages of Optimistic Rollup and can also use different development languages and module libraries.
Summary
The Cartesi team has implemented the RISC-V virtual machine, so more complex logic than EVM can be implemented off-chain, and the choice of development language is more flexible than solidity, and the security can also be guaranteed by layer1. Cartesi Rollup can store all states of a virtual machine, including input, output, and the current Cartesi Machine state.
About HashQuark
HashQuark, member of HashKey Group, is a leading Asian professional staking+ service provider to ecologically promote and offer secure, transparent and efficient services to PoS and DPoS projects. With experiences running nodes for over 40 blockchain projects, it has partnered with the world’s leading crypto wallets, exchanges, and capital firms.