👉WUT THA HELL IS A ROLLUP?👈
A delicious dried fruit snack....duh.
OK, just kidding. Let's talk about #rollups in the context of #blockchain technology, shall we?
🧵/1
But first...what exactly is a rollup anyway?
Well, in simple terms, it is a scaling solution.
Scaling solutions have been born to address the slow and expensive finality of transactions on many proof of work blockchains (primarily #Bitcoin and #Ethereum).
🧵/3
Basically, Ethereum is mad slow and mad expensive because there's a ton of traffic and transactions being processed.
If we could rollup a bunch of those txns outside of the Eth chain, compress that data, and then send it in as a single txn, it'd be way faster and cheaper.
🧵/4
Rollups settle a portion of the txns on a separate (i.e. faster) chain (L2) then rolls them up to communicate necessary txn data to the main chain
This is a smart contract that pushes computation & state storage (bulk of the work in a txn) to L2 then submits txn data to L1
🧵/5
So, to recap:
Rollup moves computation & state storage off chain. Txn data is sent to mainnet as calldata (lower cost of storage).
Txns are batched and sent in one txn to reduce fees & speed.
🧵/6
TADA! That's a rollup baby.
OK, so now that we understand that...wtf is an Optimistic rollup, or a ZK rollup?
Well...those are two of the most prevalent rollup technologies, here's what they do:
🧵/7
Optimistic Rollups -
Optimistic rollups assume all the txns in the rollup that is sent to the main chain are valid and not fraudulent. They are essentially automatically trusted.
Hence the name Optimistic.
But...wait...so how do you prevent fraud?
🧵/8
If all the txns are trusted as valid without proof, couldn't anyone just send fake txns into the rollup?
This is why there is a "challenge period" which is a period of time in which network participants can challenge txns by submitting a "fraud proof"
🧵/9
Within the challenge period of typically a week to two weeks, network members (i.e. nodes) can submit a fraud proof to prove a txn is not valid.
In that period, and before any challenge period is over, the txn data is NOT finalized on the main chain.
🧵/10
Optimistic rollups use a sequencer to compress data and submit it as a batch to main chain
Sequencer sends pre-state root & post-state root where contract verifies post-state root matches current state
Txns are final after they go through challenge period uncontested.
🧵/11
How the fraud proof works –
Node initiates challenge with their version of the post-state root. The txn is replayed in a sandbox. If the results match the challenger’s state root, then it’s proven the sequencer published an invalid state transition.
🧵/12
Fraud prevention on Optimistic rollups relies on economic incentives. Everyone involved has tokens staked. If a sequencer (who submits the rollup to the main chain) is found to have submitted invalid txns, the sequencer's stake is slashed.
🧵/13
The same penalty exists for challengers as well, to prevent submitting invalid fraud proofs.
This incentivizes honest behavior.
🧵/14
The major advantage to Optimistic rollups is that they are EVM compatible. This means any smart contract code written to run on Ethereum doesn't have to be modified. It can just be copied onto the rollup chain
Also Optimistic rollups can deploy smart contracts on Ethereum
🧵/15
The major disadvantage to Optimistic Rollups is obviously the challenge period. Having to wait a period of a week to as much as two weeks (if no challenge is submitted) for txns to clear can be not ideal.
🧵/16
ZK Rollups -
ZK stands for zero knowledge, and ZK Rollups do not optimistically assume all txns are valid. Rather, they implement a cryptographic verification process that determines the validity of the txns.
Then a validity proof is submitted to the main chain.
🧵/17
The ZK smart contract uses public numbers strings to conclude if someone's txn is valid. A cryptographic process determines, based on these strings, whether the txn submitter is acting honestly.
Once the txn is verified it's added to the rollup.
🧵/18
Then the rollup is submitted to the main chain as a validity proof.
The chain excepts this txn data immediately as their validity has already been proven. That means there is no challenge period.
For this reason ZK Rollups offer more TPS.
🧵/19
Further, data compression in ZK's are greater than Optimistic rollups because all state data doesn't need to be included in a validity proof.
However, ZK Rollups are exceedingly complex which poses challenges for developers as well as cost-savings.
🧵/20
Until recently, ZK's were also not EVM compatible, meaning code between a ZK chain and main chain had to be altered (however zkEVM is a recent development).
For this reason, ZK Rollups were considered superior for token transactions only.
🧵/21
Optimism was preferred for general purpose EVM computation.
zkEVM will give ZKP's more use-cases, however, leading to what many think will be the inevitable future domination of zero knowledge proofs over rollups.
🧵/22
Ok, that's awesome, but when the #Ethereum merge happens, and ETH moves from POW to POS, will scaling solutions like rollups even be necessary?
The Merge actually won't impact scaling solutions at all. It's SHARDING that will.
🧵/23
However, sharding is likely to merely grow in tandem with side-chains, rollups, and other scaling solutions.
Further, as crypto gains mass adoption and other L1's experience congestion, scaling solutions will prove useful on other chains.
🧵/24