What is a Rollup? (Optimistic vs ZKSnarks Explained)

whiteboard crypto logo
Published by:
Whiteboard Crypto
on

Imagine if you wanted to send your family in Alaska a letter. You have your uncle, your aunt, your two cousins, and their dog. If you were crazy, what you would do is write each of them separate letters, put them in separate cards, and then pay the shipping for 5 different letters.

If you were smart, you would write them a bunch of letters and try to put them all into one big envelope, then ship that single envelope. This way it is more affordable and you aren’t wasting a bunch of extra paper.

This example is a bit confusing, but we’ll come back to it later when we explain how Rollups work to scale Ethereum. 

A rollup is a scaling solution for blockchains where a large group of transactions are “rolled up” into a single transaction to save energy and space.

In this article, we are going to explain how rollups work, what the difference between an Optimistic rollup and a ZK-Snark rollup are, and hopefully by the end you’ll understand the benefits of this crazy, difficult-to-understand technology. 

Let’s dig in. 

What is a Rollup? 

Rollups

I’d love to explain that in simple terms, but even the ethereum.org definition is complicated.

In fact, we couldn’t find one Youtube video that explained it where we didn’t yawn or have to look at code, and that’s not what this channel is about. So for you to understand how Rollups work, we have to explain some other things first. 

Transactions and Data

Transactions as Data

On the Ethereum network, there are two things that can be posted on the blockchain: transactions and data.

Transactions are when you send ether from one address to another. This mimics exactly how Bitcoin works. 

What makes Ethereum special is that you can also store data on the Ethereum network. This data can be anything you like. You can store “Will you marry me?” or you can write a whole program in code to be run. When you write a program to be run, that specific data is called a smart contract.

According to the Ethereum.org website, a rollup is “solutions that perform transaction execution outside the main Ethereum chain, but post final transaction data on the main chain.”

Oh yeah, if you don’t know what layer 2 scaling solutions are for, or even what that term means, definitely check out our page on the whole topic for a brief overview. This page is more about the specifics of rollups. 

So get this, first we need to know that Ethereum blocks can only hold so much data.

For the purposes of this article, let’s say they can only do 100 transactions. This means if there are 100,000 people who want to make transactions, Ethereum will pick the top 100 transactions that included the highest fee and include those, otherwise they will have to wait.

These fees can be expensive, so each transaction must be important. Remember how I said we could also write data to the blockchain? 

Can Data Contain Transactions?

So one of those 100 transactions could also be data, instead of a transaction. In that data, we could just write a whole bunch of other transactions.

In a sense, if one data entry in the block could be 10 transactions, we have now effectively scaled to 1000 transactions per block by using the data portion instead of the transaction portion. 

Rollups are literally rolling up a bunch of transactions and turning them into one piece of data to submit to the blockchain, instead of a bunch of singular entries—which saves a bunch of space.

Think back to the intro where I mentioned cramming a bunch of letters that were going to the same place into one big envelope—that is exactly what a rollup is. Instead of having the mail carrier do the work five times, we have them do it once, and this is what allows Ethereum to scale. 

Right now there are two approved ways of doing this: ZK-snarks and Optimistic Rollups were words we heard over and over when researching layer 2 scaling solutions but we had absolutely no idea what they were.

Now we do, and for the rest of this page, we are going to explain how each works. 

ZKSnark Rollups Explained

zksnark rollup

ZKSnark rollups, one type of Zero Knowledge Rollup, run a computation off-chain and submit what is called a “validity proof” to the layer 1 blockchain.

ZKSnark actually stands for “Zero Knowledge Succinct Non-Interactive Argument of Knowledge” which means absolutely nothing if you’re the target audience of this article. Let’s break down what it’s purpose is, and how it works. 

Validity proof basically means someone went through all the transactions in a specific rollup, did some work (very similar to proof-of-work) to find out they were safe and not fraudulent, then submitted their list of transactions and proof to the true Ethereum layer 1 blockchain.

They are basically proof-of-working and proving that the transactions they are submitting are true and good off-chain. In a sense, Ethereum has offloaded some of it’s work to this ZKSnark checker—which is exactly what a layer 2 scaling solution does.

If you break it down, ZKSnark is an acronym:

  • Zero Knowledge means they don’t actually have to see all the transaction data
  • Succinct means short
  • Non-interactive means they don’t need to deal with people who verify their work
  • Argument of Knowledge, this is the proof they provided that these transactions are good

Some calculations have said that with a little technological tweaks that we don’t have time to mention here, ZK Rollups can hit a scale that is similar to Visa Transactions, which is a huge milestone. 

Optimistic Rollups Explained

optimistic rollup

Optimistic Rollups will actually assume transactions are valid by default (they are “optimistic”) and approve them all to submit to the main Ethereum chain. Instead of using a validity proof, they use a “fraud proof,” but only when they are challenged. 

In short, the optimistic rollups assume everyone is telling the truth. They don’t fact-check and do the work like ZKSnarks do.

However, what they post is fact-checkable by other people. Since ETH involves people’s money, we can assume there will always be people checking, that is why this works.

If someone goes “hey, that transaction looks fishy,” and then proves it was fraudulent, the transaction is reverted and the block validator is actually slashed.

“Slashed” is a technical term which means whoever validated that block will lose some of the stake they initially put up. 

One big thing about optimistic rollups is that they can also do smart contracts and transactions involving tokens other than the Ethereum coin transactions.

A downside of optimistic rollups is that Vitalik himself has said “Optimistic Rollups should know they aren’t going to be optimistic rollups forever,” which is his way of saying better alternatives may become available, but we don’t have them yet. 

Conclusion

As we end this article, we want to make it clear that this was still a pretty high-level overview of how these concepts work.

Looking at the code and doing your own research will greatly improve your own understanding, but we hope that our video taught you at least something, if not made you have more questions that you can ask in the comments below that we would love to answer, and even research if we can’t answer.

Thanks for reading, we hope you learned something, and we really hope you enjoyed it.

whiteboard crypto logo

WhiteboardCrypto is the #1 online resource for crypto education that explains topics of the cryptocurrency world using analogies, stories, and examples so that anyone can easily understand them. Growing to over 870,000 Youtube subscribers, the content has been shared around the world, played in public conferences and universities, and even in Congress.