what are rollups?
- scaling solution
- executes txns outside of L1
- batches and posts txn and data back on L1
use case:
- allows the network to scale while deriving the security of ethereum
rollup txns and how they work
rollup txns are executed on a seperate chain which run a rollup specific version of the EVM. the rollup then batches them together and post them to L1.
executes txn → compresses it → rolls it up to main chain in a single batch
how does ethereum know that the posted data is valid and not by a bad actor?
- rollups deploy smart contracts which verifies the deposits, withdrawals and proofs
2 types of proofs:
optimistic proofs and zk proofs
optimistic rollups use fraud proofs zk rollups use validity proofs
optimistic rollups
optimistic rollups post data assuming it’s correct
if it’s valid, then cool nothing else to do! no work done in an optimistic scenario!
BUT, in case of an invalid txn, it needs to identify, recover the correct state and penalize the party
optimistic rollups’ solution: they implement a dispute resolution system which verifies fraud proofs to
- detect fraudulent txns
- de-incentivize bad actors from submitting fraud proofs
workflow of fraud proofs:
in optimistic rollups
batch submitters have to provide a bond ( in form of eth ) any network participant can submit a fraud proof if they spot an incorrect txn ( they too sign a bond)
after a fraud proof is submitted, system enters dispute resolution mode.
in this mode, the suspicious txn is executed onchain, if execution proves it was fraudulent - the batch submitter is punished by having their bonded eth slashed.
works the other way too where the network participants have to submit bonds too with eth and might get slashed if they framed the batcher.
optimistic rollups have to implement a system that is able to replay a txn with the exact state when the txn was originally executed on the rollup chain ^^ is v complex ( obv )
- achieved by creating a seperate manager contract that replaces certain function calls with the state from the rollup
- can work as expected even if there’s 1 honest party that monitors the rollup and submit fraud proofs if needed
- bcoz of correct incentives within the rollup system, entering the dispute resolution process should be an exceptional situation and not something common.
ZK rollups
- needs no dispute resolution
- leverages zkps
- every batch posted on L1 includes a ZK snark which can be quickly verified by the L1 contract
- invalid batches can be rejected straight away
- extremely high level but inside is a bunch of cryptography and math to make this “verification” possible
TODO: learn about ZK, ZK proofs, ZK snarks
differences
- optimistic rollups have to give enough time to submit fraud proofs before finalizing the txn on L1
- usually quite long so that even in the worst case scenario fraudulent txns can be detected
- causes withdrawals from optimistic rollups is quite long as the users have to wait as much as a week or two to get back to L1
- fast liquidity exits projects do exist which offer instant withdrawals to/from L1 to L2s
- hop protocol and connext
so far it looks like zk is an obvious winner
but, due to the complexity of the technology it’s much harder to create an EVM compatible zk rollup which makes it more difficult to scale generate purpose application without having to rewrite the application logic
- but zksync is building on this and they might launch an evm compatible rollup soon
- fast forward to like a year, there’s polygon with it’s zk-evm, zksync has launched and a bunch more zk rollups otw by other projects <3
- crypto evolves fast
from 15-45 TPS → 1000-4000 TPS
but eth2 will make this better by increasing block space for more txns due to the implementation of shards
shards can store more
therefore, eth2 + rollups is how layer 1 scaling works
challenges
- composability
- in order to compose a txn that uses multiple protocols all of them need to be deployed on the same rollup
- fractured liquidity
- without new money coming into eth as a whole
- existing liquidity in the ecosystem will be shared btwn multiple L2s which mean low liquidity and higher slippage and low trade executions
threat to sidechains? nope
txn costs on L2 will be lower than L1, it will still be high enough to price out certain types of applications which would then prefer sidechains ( high volume games etc )
- sharding might solve this but if sidechains gain enough network effect by then, they’ll probably survive longterm