0xArmin 🌊 Profile picture
Aug 13 20 tweets 6 min read
Optimistic rollups. zk rollups. While we wait for the merge, rollups are quite the rage.

So how do rollups work? What's the scalability gain we can get from them? And how do they compare with each other?

This is part 6 of #multichainfuture. Let's get rolling. 🧵 1/n
In the previous issue of #multichainfuture, you learnt about sharding.

The key idea was splitting verification of a block across many validators. Why?

There are too many transactions to be verified by all validators.

Rollups take a different approach. 😉 2/n
Instead of trying to process all the data/computations on the @ethereum network, rollups ask- do we even need to do that?

In fact, can we shift some of those computation/data publication to other platforms? 3/n
Let's distinguish between computation and data.

Computation of transactions gives the state transition. E.g. how much do you have after paying for that NFT. 🖼

Remember why we need data availability? (We talked about it in our last thread!) 4/n
Data availability is important as it allows @ethereum's participants to check validity of computation.

Keep this framework in mind- it'll help you as we design our very own rollups!

Let's go into the structure of rollups. 5/n
We know that rollups serve a separate platform to execute computations/save data. So how do rollups exist on the L1 chain?

On the main @ethereum chain, the rollup has a smart contract that maintains the state root.

Uh state root? 6/n
Just think of state root as a pointer to important information within the rollup- account balances, contract code etc.

An analogy- a state root is like a bullet journal. You use different bullet journals, and you point to a specific one to access your thoughts then.

Next. 7/n
If you want to move assets into and out of the rollup, the rollup's smart contract also acts as a "bridge".

Here's a diagram to aid your understanding! 8/n Image
When there are sufficient new transactions occurring in the rollup, someone will publish a *batch*.

A batch is just an update of the information in the smart contract- the pre and post state roots + transactions.

Let's go back to our analogy. 9/n
When you use up your current notebook, you change to a new one. Your old notebook is then the pre state root, while your current one is the post state root.

Easy yea?

We've talked about having "someone" to publish the batch. But who will that be? 10/n
This is where we need you to design rollups for us! No worries, I'll guide you along. 😁

Let's assume that anyone can publish a batch for the rollup. Why will you want this though? 11/n
Allowing anyone to publish the batch gives maximum decentralisation- no one is censored.

But this gives a clear problem- anyone can try to update a batch with wrongly executed transactions. This allows them to "give" some ETH to themselves.

How will you solve this? 12/n
Let's go through this- if you allow anyone to publish a batch, you need to allow people to challenge the update too!

And if deposits/withdrawals via the rollups are instantly finalised, people can "escape" with wrong balances!

What's the solution? 13/n
We implement a time window before finalising a batch update.

This allows people to challenge the batch.

More specifically, the challenger wants to prove there's at least a state transition that's wrongly computed.

Do we get the L1 to re-compute the whole transition? 14/n
Well, it'll be very expensive! In fact, doing so renders the rollup useless.

The challenger pinpoints the exact instruction- e.g. which is wrong?

Alice: 50-20=30
Bob: 10+20=40

Answers in the next tweet. ✅ 15/n
It's clearly the instruction to update Bob's balance that's wrong, so the L1 will re-execute that exact step.

If the challenger is right, he will get part of the malicious proposer's bond.

Wait- you've actually come up with one type of rollup! 16/n
This model is known as optimistic rollup- assume transactions are correct, and only compute on main chain when someone challenges.

Examples of optimistic rollups are @optimismPBC and @arbitrum.

Let's go through their pros and cons using the computation & data framework. 17/n
Pros:
1) Because the update is just a change in state root, the gas cost per batch is low
2) It is easier to implement optimistic rollups (no advanced tech)
3) Lower computation for off-chain transactions

Now try and guess the cons! 18/n
We've talked about how we need a delay for challengers, and that's exactly it!

1) Optimistic rollups suffer from long withdrawal period of a week.
2) To aid challenges, data for transactions have to be published on-chain.

You guessed it- here's where zk rollups come in. 19/n
This is it for today! I hope you've found this thread helpful.

Follow me @0x_armin. I'll be diving into zk rollups next, including how they work and their pros and cons vs optimistic rollups.

Like/RT the first tweet below to help your friend understand rollups 🍱:

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 0xArmin 🌊

0xArmin 🌊 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @0x_armin

Jul 30
High gas fees. Environmental concerns. Network congestion.

These are problems that plague @ethereum. Then there's the merge. But what exactly is it?

Understand the merge, and its impact on performance & price.

This is part 4 of #multichainfuture. Let's dive in. 🧵 1/n
A/ What the merge is
You've probably heard of terms like 'the merge', 'sharding', 'L2s'. But you may be unclear what upgrades the merge entails.

The merge actually involves only one core technological change- 2/n
A transition to proof of stake from proof of work. That's it. Nothing to do with 'sharding', 'L2s' etc.

To be clear, this change paves the way for further upgrades. But when the merge drops, the only difference is that @ethereum will use PoS.

Now for those key questions: 3/n
Read 35 tweets
Jun 18
The largest decentralised stablecoin. The OG dapp on @ethereum.

@MakerDAO and DAI are one of the most successful #DeFi stories, but how do they work?

Understand Maker Protocol, assess DAI risk & alphas for you.

This is part 4 of #stablecoinwar series. Let's dive in. 🧵 1/n
@ethereum @MakerDAO A/ Mechanics of @MakerDAO

A quick refresher on types of #stablecoins- there are
1) fiat-backed
2) crypto-backed
3) algorithmic

DAI is a crypto-backed stablecoin, which means that all of its assets live on the blockchain! How do we make that happen? 2/n
@ethereum @MakerDAO At its core, we have Maker Protocol. It is essentially a set of smart contracts that provide all the rules for this financial system.

This may sound confusing, so let's use a simple analogy! 3/n
Read 32 tweets
Jun 11
USDC- safe alternative to USDT. Most people think so.

Wait, there's more. I believe #USDC is the McDonald's of #stablecoins.

My thesis on why USDC is a sleeping giant, risk assessment, and possible alphas.

This is part 3 of the #stablecoinwar series. Let's dive in. 🧶 1/n
I'm going to get to what I mean by McDonald's of stablecoins. Ngl, I was blown away while reading @centre_io's whitepaper.

So let us run through how #USDC works, and I'll tell you about Centre's audacious vision. 2/n
@centre_io Similar to #USDT, USDC is a fiat-backed stablecoin. I've gone through the 3C framework and USDT in previous threads, so I won't go into detail here. (No worries, I'll link them at the end of this thread.)

Remember how USDT is backed by a confusing list of financial assets? 3/n
Read 28 tweets
May 18
.@a16z released their annual #crypto report.

I've read the 56 slides so you don't have to. 🙃

A summary of the actual use cases, trends, and what's next. 🧶 1/n
A) Actual use cases

A common criticism of #web3 is the lack of actual use cases. Let's see if that's true. 2/n
#Crypto has increased the financial freedom of the average consumer.

This applies for both poorer and richer nations.

Time to check some numbers. 3/n
Read 16 tweets
May 17
.@stablekwon has proposed to fork #Terra_Luna blockchain. This is a momentous decision.

Before voting on it, let's first look at 2 notable blockchain forks. Why we needed those forks, who proposed them, and how it ended.

Let's dive in. 👇 1/n
1. The infamous DAO hack.

In 2016, a group of @ethereum users launched a DAO- an investment fund that allowed members to vote on and fund future Ethereum-related projects. They raised more than $160 million worth of #ETH from about 11k investors.

Then came the hackers. 🥲 2/n
They found a bug in the smart contract and siphoned 3.6mil ether from the fund.

Think of smart contracts as vending machines. Pop in a dollar, pick the drink and it should dispense it. A vulnerability is akin to getting a free drink without paying.

The community responded. 3/n
Read 14 tweets
May 11
#UST depeg explained. What started it, why the safety mechanisms failed and where we are rn.

Nuff said, let's dive in. 👇1/n
#UST is an algorithmic stablecoin. In other words, it is not meant to be backed by reserves. Instead, it uses an algorithm to maintain the peg.

We have talked about this mechanism in this thread.



Extra precautionary steps were also taken. 2/n
In April 2022, @stablekwon bought ~1.5B #BTC and 200 million worth of #AVAX as reserves.

The idea?

bloomberg.com/news/newslette…
3/n
Read 23 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(