Everything you need to know about Optimistic Rollups
14 min read

Everything you need to know about Optimistic Rollups

Everything you need to know about Optimistic Rollups

Summary:

Low latency and high throughput under resource limits are two of the most challenging difficulties in the Ethereum ecosystem (e.g., CPU, bandwidth, memory, disc space). The ability of the weakest node in the network to check the system's rules determines the system's decentralization. Scalable refers to a high-performance protocol that can run on low-resource hardware.Sidechain or off-chain transactions are bundled (or "roll-ups") into a single transaction subsequently committed to L1. A cryptographic proof is constructed from the bundle to secure all of these bundled transactions and make them individually verifiable. The key difference between the two techniques is how they generate fraud-proof. There are also differences in how they work with the Ethereum Virtual Machine (EVM) and Ethereum tools.

Pros:

  • Computational flexibility is Turing-complete and can be used with the EVM.
  • Scalability will go up from 10 tps to 200 to 2000 transactions-per-second (tps) on Ethereum layer 1, & 200 to 2000 on layer 2.
  • There is a lot of data on the chain (no need to trust off-chain data providers)
  • Better User Experience (UX)

Cons:

  • Compared to other Layer 2 solutions, this one has less throughput (Plasma, ZK Rollups, etc.)
  • Some more security issues have been brought up.

Rollups require some Ethereum-compatible independent blockchain to handle signature verification, contract execution, and other tasks with a reduced number of nodes or additional high-performance features. This post will explain what optimistic rollups are, how they work, why they matter, and whether or not they are secure. Don't forget to check out our dApp at saddle.exchange (including trading on Arbitrum and Optimism) for all your pegged asset swap and liquidity provision needs!

Learn more about Saddle

Use the dApp

Join the community and earn SDL


What is a rollup?

Rollups perform transaction execution outside the main Ethereum chain (layer 1) but post transaction data on layer 1.

To compare different layer two solutions based on rollups, we must first take a brief detour to learn about optimistic rollups. Sidechain or off-chain transactions are bundled (or "roll-ups") into a single transaction subsequently committed to L1. A cryptographic proof is constructed from the bundle to secure all of these bundled transactions and make them individually verifiable.

Rollups require some Ethereum-compatible independent blockchain to handle signature verification, contract execution, and other tasks with a reduced number of nodes or additional high-performance features.

As a result, the independent blockchain may verify the legitimacy of transactions before they're bundled and committed to the main Ethereum chain. Verification and contract execution are handled by L2 rollup sidechains, whereas the L1 keeps immutable transaction data.

Rollups come in two distinct flavors

Zero-Knowledge Rollups

Also known as ZK-Rollups, it performs computations off-chain and then proves validity to the chain. Transaction data is not required for ZK-Rollups. As a result, block validation is faster and less expensive.

Optimistic Rollups

Optimistic Rollups assume that transactions are valid by default and run computation only in the case of a challenge by utilizing fraud-proof. Computation is slow in this situation.

What is Optimistic Rollup?

Optimistic Rollups (ORs) is a layer 2 architecture that runs on top of Ethereum's base layer rather than on it. This allows intelligent contracts to be run at scale while protected by Ethereum. These structures are similar to Plasma. Instead of running Plasma, they run an EVM-compatible Virtual Machine called OVM (Optimistic Virtual Machine), allowing ORs to execute whatever Ethereum can.

The solution's name, Optimistic Rollups, comes from how it works. 'Optimistic' is used since aggregators publish the bare minimum information required with no proof, presuming that the aggregators do not conduct fraud and only provide proof in the case of fraud. Because the on-chain transaction is committed to the main chain in a bundle, the term 'rollups' is employed (that is, they are rolled-up).

Basic Overview

As with most Layer-2 solutions, the funds used on Optimistic Rollups are stored in a smart contract on Ethereum. This is where users deposit money, aggregators sign up, and fraud proofs are put together. There are a lot of ways you can interact with these solutions:

  1. Users send off-chain transactions of smart contracts to an aggregator (a block producer in this construction)
  2. An aggregator locally runs the transaction that makes the new smart contract.
  3. Those aggregators figure out the new state root (aka a Merkle root)
  4. That aggregator makes an Ethereum transaction that includes the state root that was found in step 3.
  5. Anyone who sees an aggregator using an invalid state root (a state root made up of invalid transactions) can challenge that aggregator by posting the valid state root and the Merkle proofs needed to prove it, slashing the bond and the aggregator that committed such fraud, and taking the rewards that come with them. This is called "slashing."
  6. It is possible to roll back the chain in layer 2 after an invalid block has been committed and a fraud-proof has been completed. The chain can start again from the previous non-fraudulent block in layer 2.

Anyone can become an aggregator as long as they sign a bond in the smart contract. This means that anyone can become an aggregator.

Note: There are many ways to solve the front-running problem in step 5. For example, you can send submarine sends.

Examples of Top Optimistic Rollup Projects

The optimistic rollup space is currently shaping up to be a struggle between two key rivals – Optimism and Arbitrum. Both ventures have already had some early triumphs, so the competition between them is now heating up.

The key difference between the two techniques is how they generate fraud-proof. There are also differences in how they work with the Ethereum Virtual Machine (EVM) and Ethereum tools.

Optimism

Optimism was the first rollup protocol in the blockchain space to have a mainnet launch. It was also the first to get a lot of attention. However, Arbitrum could get to market first because it was supposed to launch in March. However, the project still got a lot of attention and even got $25 million in funding from the investment firm Andreessen Horowitz.

This is how Optimism does rollups: A smart contract sends transaction data from the main Ethereum chain to a Layer 2 network, where a sequencer can bundle multiple transactions together and then send that batch back to the main chain in a single transaction. Sequencers assume that all transactions are legitimate when they do these jobs. There is a one-week window in which that assumption can be challenged in the system.

If there are any mistakes in the rollup, it shows that someone tried to do something bad. On Layer 1, the whole transaction for Layer 2 is done. This way, proof can be made. This is good because it allows for a very quick proof generation.

Optimistic people try to stay as close to the Ethereum ecosystem as possible, but it's not always easy. GETH has been changed for its Layer 2 node. It also has a compiler for Solidity. However, Solidity is the only EMV language that it can read.

Currently, the protocol doesn't have its token and uses ETH to pay for things.

Arbitrum

Following the delay of Optimism's launch, the Arbitrum project took the lead in the rollup race. During the week of May 28, Arbitrum came out.

As we said before, Arbitrum and Optimism are very similar projects. The main difference between the two is how they make fraud-proof, which makes them different. Unlike Optimism, Arbitrum doesn't run the whole Layer 2 transaction. Instead, it runs small parts of the transaction until it finds a mistake. This method allows for more transactions to be made. It can take up to two weeks to get fraud-proof this way, which is a lot longer than the method used by Optimism.

On the compatibility side, Arbitrum can speak all of the EMV languages, like YUL, Vyper, and Solidity. However, it has a special L2 node. Like Optimism, Arbitrum uses ETH to pay for things.

Arbitrum

Pros & Cons in the Optimistic Rollup

Pros:

  • Computational flexibility is Turing-complete and can be used with the EVM.
  • Scalability will go up from 10 tps to 200 to 2000 transactions-per-second (tps) on Ethereum layer 1 to 200 to 2000 on layer 2.
  • There is a lot of data on the chain (no need to trust off-chain data providers)
  • Better User Experience (UX)

Cons:

  • Compared to other Layer 2 solutions, this one has less throughput (Plasma, ZK Rollups, etc.)
  • Some more security issues have been brought up.

What are ZK rollups?

ZK-Rollups are one of the options being worked on for layer 2. They make the system more scalable by putting a lot of work into a single transaction. Plasma creates one transaction for each transfer. ZK-Rollups combine hundreds of transfers into a single transaction, making them easier to process. The smart contract will break down and check all transfers made in a single transaction.

A "zero-knowledge proof" method is used to show and show that the block on the Ethereum blockchain is real. Validating a block with ZK doesn't use much computing or storage power because it doesn't need to know all of the data in a transaction.

Basic Overview

There are two types of people who use the ZK-Rollup scheme. They are transactors and relayers. Create your transfer, then broadcast it to the network so other people can see it. There is a "to" and "from" address, a value to send, the network fee, and a nonce in the transfer data.

A 3 byte indexed version of the addresses cuts down on the processing resources needed. The value of the transaction must be greater than or less than zero for it to be a deposit or a withdrawal. There are two Merkle Trees in the smart contract that store the data. One Merkle Tree stores the addresses, and the other stores the amount of money sent.

Relayers put together a lot of transfers to make a rollup. It is the relayer's job to come up with the proof of the SNARKs, not you. The SNARK proof is a hash that shows how the blockchain has changed. State refers to "being in." Checks to see how much money was in each wallet before and after the transfers. It then sends a hash of that hash to the mainnet to check that it is correct.

Relayers can be anyone as long as they have put the required bond in the smart contract. This is important to note because anyone can become one. This encourages the relayer not to mess with or hold back a rollup.

Examples of Top ZK-Rollup Projects

There are a lot of good projects in the ZK rollup area of the Ethereum ecosystem right now. Here are some of the best ones:

Hermez

We start with Hermez because there was a big news story about her this month. It was announced on August 13 that the two companies, Hermez and Polygon, will merge in a deal worth $250 million. ZK rollups will now be available for Polygon, one of the most popular scaling projects for Ethereum. Polygon is a sidechain, so it isn't part of Layer 2. In the future, we'll go into more detail about Polygon.

So, what is Hermez? I mean, it's a ZK rollup that makes cryptographic proofs called SNARKs, which is what it does (succinct non-interactive argument of knowledge). It is made by Iden3, the same group that made the Circom and SnarkJS libraries. Iden3 says that Hermez can speed up Ethereum to make 2,000 transactions a second.

People who work for the Hermez Network help process batches into the Hermez rollup and create proofs of their validity. Members of the network can bid to become the next coordinator in an auction-style process, and the winner is chosen. The auction winner gets to process as many batches as they can during a "slot" that lasts 40 Ethereum blocks, which is about 10 minutes. They can process as many batches as they want.

Currently, bids are paid for with Hermez's currency, HEZ. However, after the deal with Polygon, HEZ will no longer be around and replaced by Polygon's token, Matic, which will be used to pay for things in the game. In the future, Hermez plans to release a smart contract that will let people who own HEZ tokens exchange them for Matic tokens at a rate of 3.5 Matic per HEZ. This means that people who own HEZ tokens will exchange them for Matic tokens at that rate.

Recently, Hermez also added an atomic transaction feature, which makes it easy to swap tokens on the network for cheap. Also, recently, the Hermez team said that they are working on a zero-knowledge Ethereum Virtual Machine (ZKEMV) that they hope will be able to run all opcodes. More specifically, Polygon Hermez will be able to run smart contracts. This means that this will happen.

ZKSync

Here is another SNARK-based rollup. There is a team behind ZKSync called Matter Labs, and they call their project a "scaling and privacy engine." This means that low-gas transfers of Ether and ERC-20 tokens can be made in the Ethereum network. As of now, there is only one validator processing batches and generating validity proofs. ZKSync's motto, "rely on math, not on validators," seems to be a good one.

ZKSync also allows you to swap tokens and make NFT (non-fungible tokens). Before this year, the platform released its ZKEVM, which lets it run smart contracts. ZkSync can run most of the opcodes in Ethereum.

This is a big part of the vision for ZKSync 2.0. It is called ZK Porter. In ZKSync 2.0, there is a rollup feature called "ZKSync 2.0." This means that rollup contracts and accounts will interact with ZKPorter accounts and vice versa. These "guardians," who hold ZKSync tokens and sign blocks, will ensure that ZKPorter users can access their data off-chain.

They will also make sure that the data is safe. They want to make sure that there are no data availability problems because they have a lot of money on the line. Matter Labs says that the ZKSync's proof of stake is much more secure than the proof of stake in other scaling solutions, like sidechains, because guardians can't get their hands on money.

Pros & Cons of zk-Rollups

Pros:

  • Reduced fees for each user who sends
  • Faster than Optimistic Rollup and Plasma Blocks will be computed to encourage decentralization.
  • Each transaction has less data, making layer 2 faster and more scalable.
  • It can't be used like an Optimistic Rollup fraud game that can delay withdrawals for two weeks, which is why it doesn't.

Cons:

  • Computers are hard to work with zero-knowledge proof will need data optimization to get the most throughput.
  • The way ZK-Rollups are set up at the start encourages a central plan (see Security Considerations)
  • In the security scheme, some level of trust can't be proven.
  • Quantum computing could make it hard to hack the blockchain.

So now that we've looked at the building blocks of an Optimistic Rollup let's look at and talk about some of the most common complaints about it.

Long periods of withdrawal or disagreement are bad for adoption and compatibility.

As we said before, a long dispute period is good for safety. There seems to be a trade-off: a long dispute period is bad for users because they have to wait a long time to get their money. The dispute period is concise, but you will have to risk being scammed.

We don't think this is a big deal. In the event of long withdrawal times, we think that markets people are going to quickly come up with ways to get money out more quickly. This is possible because people who check their level 2 status can tell if a withdrawal is fraudulent and buy their services at a lower price. In this case,

Participants:

  • On the second layer, there are 5 ETH.
  • "Automated Market maker": There are 4.95 ETH on the first layer, and a validator runs on the second layer.

Step:

  • Alice told Bob that she wanted to get her money "fast" and pay him a fee of 0.05 ETH.
  • Alice wants to withdraw Bob's "market maker" smart contract money.

At this time, two things can happen:

  • Bob checks to see if the withdrawal is valid on his tier 2 validator and lets quick withdrawal go through. This will send 4.95 ETH to Alice's layer 1 address right away. If Bob waits until the withdrawal period is over, these 5 ETHs will be his. He will get them and make money, too.
  • Bob's verifier tells him that the transaction doesn't work. Bob doesn't like the change in the state caused by the transaction, so he cancels the transaction and gets his bonds because the sorter lets bad transactions happen.

It doesn't matter if Alice is honest and takes the money out right away or dishonest and will get in trouble. We hope that the fees paid to market makers will become more and less over time. If there is a lot of demand for this service, people will start to forget about this process.

The most important thing about this is that it can be combined with the first-level contract without waiting for a full dispute period.

It's important to note that this method was used first in an article about "Simple Fast Withdrawals" (quick and easy cash withdrawals).

Miners can use bribery to check cash withdrawals and make Optimistic Rollup less safe.

The post "Optimistic Rollup's Near-Zero Cost Attack Scenario" says that some people think that the incentives for miners are too high, which will make sorters work together with Ethereum miners and not review transactions that aren't theirs to look at. So, of course, this is bad for any Optimistic system because the security is tied to how well disputes are settled.

We don't agree with the point of this article. A good person is always willing to pay off miners and has more money than a bad person. In addition, there are more costs every time miners act dishonestly because they help bad people win. This will make Ethereum less valuable, which will make it more expensive for miners to do this.

Academic research has shown that "the threat of counterattack induces a perfect equilibrium in subgames where no attack takes place," which means that this situation has been looked into.

The verifier's dilemma makes running the verifier hard and makes Optimistic Rollup unusable

Ed Felten came up with a great analysis and solution to the verifier's problem.

  • If the system's rewards work out the way they should, no one will try to cheat.
  • In this case, there is no point in running a verification program because you can't make money from running it.
  • Because no one runs the validator, there is a chance that the sorter will one day cheat and sort things in the wrong way.
  • Somebody tried to get around the system, and now it doesn't work the way you expect.

This sounds important, but it also sounds a little weird. The more validators there are, the less likely it is that a single validator will get a reward. In addition, with more verifiers, the amount of cake that can be given out seems to get smaller, and less fraud happens, which makes the problem even worse. Felten also came up with a way to solve the verifier's problem in a later analysis.

I want to be on the other side of this. In my opinion, it doesn't matter as much as some people say. In real life, there is a non-monetary reason to be a validator. Among other things, you could build a big app on an aggregation platform, or you could keep tokens. You won't be able to use your application, or your tokens will get less valuable. As we saw in the previous section, the need for quick withdrawals makes market maker verifiers important, which is not harmed by fraud. Bitcoin doesn't pay you to store the entire blockchain history or give your local data to your peers, but people still do it because they want to help each other.

Because running a validator in a vacuum does not meet the incentive mechanism, it can still keep the system safe, which is the most important thing for the people who put money into the system. We think that in the second layer of the Optimistic system, there is no need to come up with a way to get around the verifier's dilemma.

Closing Remarks

In this blog post, we’ve explained optimistic rollups and how optimistic rollups work. Unlike ZK rollups, Optimistic Rollups do not require heavy-duty computations, making them much more practical and useful than ZK rollups.

Optimistic rollups are expected to scale roughly 100 times better than the layer 1 Ethereum chain. If this scaling solution is widely used, it will go a long way toward alleviating some of the congestion on the Ethereum network today.

We’ve also discussed the security measures to ensure that fraudulent transaction is not executed.

As always, if you have any questions or would like more information, don’t hesitate to reach out to us. We hope this article was helpful!

Thank you guys so much for reading this article. We hope that you enjoyed it. If you liked this article please consider subscribing to our newsletter and most of all, we hope you will check out the Saddle dApp and enjoy our low slippage platform 🤠

Learn more about Saddle

Use the dApp

Join the community and earn SDL