TL;DR: A series of Tezos protocol proposals in 2022 will focus on paving the way for further adoption, high-throughput use cases and expanded smart contract functionality.
In case you haven’t heard: 2022 is the year of scaling for Tezos.
The new Tenderbake consensus mechanism enables lower block times, which will improve latency and finality – how quickly a transaction is included and made irreversible by the network. For the user it means faster transactions and smoother running dapps.
But Tenderbake doesn’t significantly change how many transactions can be processed per second, throughput. And that is the essence of scaling: enabling more people to do more on the network at the same time.
As increased adoption brings more projects, companies, and institutions into the Tezos ecosystem, it’s time to prepare the network for more activity and high-throughput applications.
However, there are natural limits to how much we can increase throughput on the main chain, Layer 1. We are pursuing every possible avenue to push the limits but going beyond them has a cost. Any blockchain doing so sacrifices either decentralization, latency, stability, security, censorship resistance, or a mix of these.
If we want to avoid this for Tezos, we need a different approach. To support very high-throughput use cases and prepare Tezos for long-term growth, we therefore turn to optimistic rollups, a Layer 2 solution.
It’s a solution that can be implemented now to fulfill Tezos’ short-term scaling needs. We expect optimistic rollups to initially offer a 10-100x increase in throughput. And with further upgrades already in the making, it’s a step towards scaling on a whole new level.
Scaling fundamentally comes in two flavors.
You can use more powerful computers able to process and store more transactions, vertical scaling, or you can split the workload across a higher number of computers, horizontal scaling. Both have benefits and drawbacks for blockchains.
Pure vertical scaling – requiring powerful hardware to participate on the main chain – is a straightforward solution, but it means fewer people are able to participate. The security and censorship resistance of the main chain depends on an honest majority of block producers along with other nodes validating the chain, so it’s important to have low barriers for participation.
Some degree of vertical scaling can be achieved through software optimizations, allowing more throughput with the same hardware. This is a constant focus for Tezos development and has already resulted in significant performance improvements on the main chain – for example by refining the gas model, optimizing the Michelson interpreter, and introducing a cache for smart contracts.
Horizontal scaling of blockchains is mostly done by splitting up the main chain workload across clusters of nodes, known as sharding. It preserves decentralization, but it’s a complex solution and interaction between clusters adds latency – something we have just sought to minimize on the main chain with Tenderbake.
Optimistic rollups are a way to take elements from both approaches and apply them where it makes the most sense.
Large batches of transactions are moved from the main chain to rollup-specific nodes, a form of horizontal scaling. These transactions can then be processed using more powerful hardware, achieving vertical scaling.
Meanwhile, the security of the main chain acts as a backstop in case of foul play.
The technical details of optimistic rollups on Tezos will be covered in upcoming blog posts, but the fundamental principle is this:
A rollup is an entity on the main chain, with its own address, that compactly represents off-chain transaction execution and state updates. Assets can be deposited to the rollup – and withdrawn – by accounts, smart contracts and other rollups.
Transactions using the rollup are still sent to an inbox on the main chain, but are left unprocessed by the main chain nodes. Instead they are collected by specialized rollup operators.
The operators, who store and maintain the state of a rollup, process the transactions and update the state to reflect the changes. This all happens off-chain, on Layer 2. The operator only posts a receipt back to the main chain, summarizing the new state of the rollup as a cryptographic hash. A commitment.
This process of continuously “rolling up” transactions into commitments is where the name comes from. Collect, update, commit, repeat. The cycle is executed as fast as possible by the rollup operators, using powerful hardware if needed.
By contrast, main chain nodes simply store incoming rollup transaction data and the commitments. They are relieved of the computationally expensive task of validating the transactions, which lets them produce and validate main chain blocks at a higher rate.
The system is optimistic because a commitment is treated as being correct unless someone disputes it. If no dispute happens within a given time period, assets can be withdrawn back to the main chain.
To incentivize honest behavior by the rollup operators, there are economic penalties for posting incorrect commitments. Should a dispute happen, the main chain serves as a court.
This doesn’t just make incorrect commitments costly for the operator: any incorrect commitment is ultimately neutralized. As long as there is just a single honest node checking commitments, and the main chain is censorship resistant, posting incorrect commitments is futile.
Optimistic rollups are implemented in line with the general Tezos approach: gradual evolution through incremental upgrades.
The development is a joint effort by teams at Nomadic Labs, Marigold, Oxhead Alpha, Functori, Tarides, DaiLambda, and TriliTech.
The roll-out will differentiate between transaction rollups and smart contract rollups.
Both are implemented as protocol upgrades rather than deployed as smart contracts, which allows for more gas- and storage-efficient implementations. They are also permissionless. Anyone will be able to launch a rollup or be an operator for any rollup.
Transaction rollups are expected to be part of the upcoming “J” upgrade proposal. They can handle account-to-account transactions of assets, but won’t be able to run smart contracts. This allows for a simpler design and faster implementation.
Smart contract rollups are targeted for later this year. The chosen approach is inspired by proven designs for rollups, but tailored to Tezos. They are designed with a generic structure that is not limited to Michelson smart contracts, but can be adapted to support environments like WebAssembly or EVM, the Ethereum Virtual Machine.
While optimistic rollups are a good scaling solution for Tezos, they do currently have limitations.
One issue is that all transaction data for the rollup inbox must be included in blocks on the main chain, but there is a limit to how much data can be stored in each block.
Therefore, avenues for further scaling are being researched and developed.
While sharding all main chain functionality isn’t an approach we’re currently pursuing for Tezos, sharding can be used to increase the size of the inbox for rollups.
The approach is called data-availability sharding, and has the major benefit of further increasing rollup throughput as more bakers join the network. Horizontal scaling at work.
Instead of having every main chain node download and store all incoming rollup transaction data, the data is spread among the network nodes, and among bakers in proportion to their stake. Essentially making bakers data providers for rollup nodes.
This increases the total bandwidth and capacity, which improves throughput for rollups significantly. If rollups alone offer a 10-100x increase in throughput, the increase is 1,000-10,000x when combined with data-availability sharding.
Another issue is the time period needed for commitments to be checked and potential disputes resolved.
Sending assets to a rollup and transacting inside it has the same finality as the main chain. But to withdraw assets back to the main chain, you must wait for the dispute period to pass. On Arbitrum, a popular rollup system on Ethereum, the period is currently seven days.
In parallel to the work of implementing optimistic rollups, we are therefore also exploring zero-knowledge rollups, or zk-rollups.
The principle of moving transactions off-chain and posting commitments to the main chain is the same as with optimistic rollups, but zk-rollups attach a cryptographic proof of correctness with the commitment. No need for a waiting period for withdrawals.
This is possible because zk-proofs are very small and can be checked by main chain nodes in a fraction of a second, regardless of the amount of transactions or smart contract operations involved.
The downside is that zk-proofs are currently highly time consuming to generate. It requires a disproportionate amount of computing power, especially when dealing with smart contracts. The zero-knowledge team at Nomadic Labs is however working on improving this.
We look forward to updating the community, as the work on data-availability sharding and zk-rollups progresses.
In the meantime, let’s get ready to roll.