Thread
Ok, we are all very excited by the recent introduction of Smart Optimistic Rollups in #tezos. But do we really understand what they do and why we need them? Yesterday i spent some time reading about them and i thought it would be good to summarize what i learned in a thread.
Why are they called Smart Optimistic Rollups?
They are Smart because they are like smart contracts. They are programs that interact with the blockchain. They can receive inputs (messages) from the tezos blockchain and return outputs that could be executed in the main chain.
They are Optimistic because their outputs are not automatically verified. We are optimistic and assume that the people in charge of the rollup are good guys and will never manipulate the program outputs. Is that realistic?No. But i will explain later how we can fight the bad guys
And they are called rollups because they can process many input transactions, but their outputs to the blockchain are compressed (rolled up) in a single transaction, which saves a lot of computing time to the main chain and also saves a lot in gas.
Rollups are like smart contracts with superpowers. Normal smart contracts run on the main (Layer 1) chain, and because of that they are limited in size and in the things they can do.
You cannot create Smart Contracts with tens of thousands of lines, and you cannot do complex operations that take a lot of computing. This is because Smart contracts are stored in the blockchain and need to be executed by the tezos nodes.
In tezos you can run a node with a very basic computer. Some people run them on a raspberry pi! This is done to incentivize decentralization. Anyone can run a node if they want. You don't need to be a big company with lots of $ to do it.
For rollups is different. You can create long and complex programs that can only be run in powerful machines. The rollups code is executed in the rollups nodes and not in the tezos L1 nodes.
Another superpower of rollups is that they don't have to be written in Michelson. They just need to compile to WebAssembly, and most of the top level programming languages do it in a way.

In priciple you could write your rollup in python, using numerical libraries like numpy and compile it to WebAssembly. That of course increases quite a lot the number of applications that one can build in tezos.
We talked about the bad guys. How do we make sure that rollups do what they say they do if they can only be run on big computers? To discourage bad guys, everyone that wants to run a rollup needs to put 10k tez in a deposit.
If they cheat with their rollup they will loose that money. But how do we check that they cheated? Any person with a big computer can run the rollup code and check that the output is correct.
If it's not, a refutation process will start that will involve at some moment the L1. At the end of it, the good guys will get 5k from the bad guys deposit, and the other 5k tez will be burnt.
To give time to the good guys to find the tricks from the bad guys, the rollups outputs are not processed by the main tezos blockchain immediately. There is a period of 2 weeks to give time to confirm that the outputs are correct.
That's one of the main weaknesses of Optimistic Rollups. Their results are not immediately visible on the tezos blockchain. You need to wait 2 week to confirm them.
You can communicate with the rollups sending messages to the global rollups inbox. This is a kind of a mail box, whose letters are passed to the rollups regularly.
Normally, after the period of 2 weeks has passed, you will get your reply in the rollup outbox. This reply will normally be some calls to L1 smart contracts that everyone can execute.
And that's all for today. I probably said a lot of things that are not totally true, so please correct me in the comments if i'm wrong. If you want to go deeper into what rollups can do, you can check the tezos documentation
tezos.gitlab.io/active/smart_rollups.html
I forgot to mention yesterday one of the rollup superpowers! Rollups can request data at will, and that data does not need to be stored first in L1. Data is one of the limitations of L1 smart contracts. This is not the case for rollups.
If you want to create a smart contract where a user can claim an NFT at their birthday, you need to upload to the blockchain the date when the user was born. That will be stored in a big map, and if you have 100k users, it could cost you a lot of time and tez to do it.
Tezos Smart Optimistic Rollups have a reveal data channel where they can request data from the outside world. Adding your users birthday or their twitter accounts will be much easier and it will cost you pennies.
tezos.gitlab.io/active/smart_rollups.html
Of course, this is just an example. You don't have to upload all the user birthdays to L1. You could build a Merkle tree and just upload the root to the smart contract. But that adds an extra layer of complication to the smart contract and the UI
en.wikipedia.org/wiki/Merkle_tree
Mentions
See All