MT Profile picture
MT
Forever long but forever skeptical

Sep 29, 2022, 25 tweets

With @arbitrum Nitro going live last month and @zksync's zkEVM is expected next month, #Ethereum #L222s are getting better, faster, cheaper!

Which begs the question(s)...
How low can tx fees go?
And what are the actual points in a rollup tx that incur a cost?

thread time...

We'll discuss:
-What actually incurs a cost?
- What steps in a L2 tx cost the most?
- Does it vary for ORS vs ZKRs?
- What costs are fixed vs variable?
- Who's doing it best?
@ryanberckmans

So what ARE we paying for? And what steps?

One portion is the transaction execution (L2 fees): executing and batching transactions together, as a Sequencer does, costs compute power and real resources.

So, add it to the bill of rollup tx!
@iam_preethi

@iam_preethi 2nd is settlement/state transitions: the cost associated with settlement (i.e., updating account balances across all nodes when Alice sends 1 ETH to Bob)

3rd is Data availability (DA): Ensures all relevant transactional data is available to anyone. Super impt!

DA is critical because it lets anyone verify the data for themselves.

Additionally, as long as all of the execution data is made available on the mainnet, the chain doesn’t require every node to execute every tx to validate txs and reach consensus.
@CannnGurel

Because rollups can cryptographically guarantee (via a proof) that the transactions are valid, these transactions can now be executed by just a single node and posted to the L1 where it can be cross-checked by L1 nodes.

@ChainstackHQ

Additionally, the data within a batch is highly compressed prior to being submitted to the L1, further decreasing the resource burden.

This is how rollups help trustlessly scale a blockchain without requiring an increase in node resources.
@azcoinnews

However, a rollup’s TPS is dependent on the data capacity of their L1 for throughput.

Once an L1 runs out of data capacity for the rollup, no additional txs can be processed.

The more DA on L1, the higher the (theoretical) throughput for rollups.

As @apolynya illustrates, L1 data fees (data availability costs) make up the majority of the current cost. However, EIP-4844 offers a solution and could bring this cost down by 10-50x!

ORs vs ZKRs?

First, gas cost to L1:
With Optimistic rollups, no computation is actually done, so it costs less than ZKRs.

ZKRs are more expensive (10-100x). When ZKRs submit a new batch, the validity proof must be verified, a computationally expensive process.

However, from a scalability perspective, ZKRs are more performant than ORs because they compress data more efficiently, meaning they have a smaller “batch size” when submitting to L1.

Second, Frequency:

ORs posts all tx data to the Ethereum L1 for every tx. This is the price they pay for the benefit of optimistically assuming txs are valid.

Image: tasks a single party can perform on an OR : either a computation of transaction data or a dispute

However, (some) ZKRs only post the state differences to L1.

ZKRs can do this because the state difference in combination with the validity proof is sufficient to validate the batch.

Because of this approach, ZKRs interact with L1 only ~20% as much as Optimism = Savings!

Therefore, on a gas cost/transaction basis, ORs are more expensive, thanks to the requirement of posting all the data to L1 for every transaction.

A lot of data and steps are needed in a frad proof scenario as @paradigm illustartes

SO, now, fixed vs. variable

What costs can't we avoid, and what can be improved?

Fixed costs are the rollup costs that must be paid, independent of how many txs are included in the batch.

Variable costs are the marginal costs that accumulate with each additional tx.

Fixed costs include:

State commitments
Validity proofs (ZKRs)
ZKRs have a larger fixed cost (10x) than ORs due to the validity proof.

What’s not fixed is the cost of the validity proof, which is determined by whether it uses a SNARK or STARK.

ETH SNARKS vs STARKS

SNARKs are cheaper, requiring ~500K – 1 million gas in the EVM, whereas STARKs cost ~1 million – 5 million gas depending on proof size.

Because ORs only require proofs in the event of a dispute, they aren’t subject to this cost.

@skatensurf_

Variable

Reducing the frequency of L1 interactions is one cost-saving method, but so, too, is batching more transactions into one block (the denominator in the image) to “socialize” the L1 calldata cost.

Maximizing the no. of txs in a block can cut tx fees by 70-90%!

As activity increases, the variable cost of tx data becomes the primary factor influencing rollup tx costs.

The rollup submits tx data to #ETH in the form of calldata, which costs 16 gas per byte.

However, the price per unit of gas varies based on the demand for block space.

This is because the marginal cost of adding additional txs to the batch is smaller than the average tx cost.

Note that the marginal cost consists solely of variable expenses, principally tx data, as fixed costs are shared across the entire batch and are paid regardless.

Rollups are the first type of blockchain that might incur positive network effects in terms of transaction costs (more tx, LESS cost per user??)

As it stands in Q3 2022—the early days of ZKR adoption—ZKRs have minimal activity when compared to their future ambitions.

Therefore, their ability to amortize the costs across many different users is limited.

Despite being extremely nascent, rollups are already significantly reducing fees for many Ethereum users.

@l2beat

But as we know, there's always room for improvement! Like @0xPolygon's zKEVM.

Learn about how #Polygon is working to make ZKRs just as seamless to use and build on as #Ethereum and its #EVM

cryptoeq.io/articles/polyg…

Or @fuellabs_ and their unique approach to maximum decentralization and parallel transaction exuection!

cryptoeq.io/articles/fuel

@fuellabs_ That's a wrap!

If you enjoyed this thread:

1. Follow me @mt_1466 for more of these
2. RT the tweet below to share this thread with your audience

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling