Slides: https://docs.google.com/presentation/d/1Pbugs53RuXZUQEFrF89Zw04wLhDccqC6M_xWp6mD-DQ/edit?usp=sharing
Ethereum is one of the most widely-used blockchains in the world; as such, it constantly faces scaling challenges. One of the leading paradigms that targets scaling is L2 rollups, which are protocols that are built on top of the base Ethereum (L1) chain by aggregating and compressing transactions, executing them on a virtual machine on a different layer.
Abstractly, an L2 protocol's implementation involves operators who operate the L2 protocol and interfaces with L1. Even without L2, L1 operation on Ethereum (or any other blockchain) requires some sort of market to incentivize the creation and transcription of user transactions. Each L2 protocol typically needs to have:
In our work, we will look at different designs of L2 services and pricing models. After some preliminaries on L2 concepts, we analyze these designs through abstracted versions of popular existing L2 protocols and comment on the tradeoffs of different decisions. While we primarily work with L2 rollups as the guiding protocols, our insights should be applicable to fairly general classes of L2 protocols and to even non-L2 protocols that have similar incentive structures, such as Flashbots.
At the most fundamental level, a blockchain is a state machine where different users can submit state updates called transactions. Transactions can do many things (add users, define abstract registers, run smart contracts (informally, "software" saved on the blockchain that can be executed later), but the most common transactions are simple transactions [1], which are transfers of ETH from one user to another with low structural overhead.
Typically, users send transactions they want into a common mempool with different fees (user-supplied tips), and having miners collect and publish transactions into blocks (bundles of transactions) with some sort of greedy algorithm where the minors collect the transactions with the highest fees. We can consider the protocol that governs block creation the layer-1 (L1) protocol.
A layer-2 (L2) protocol is simply a set of rules for a system designed to take some of the load of the L1 blockchain (aggregating transactions into blocks, computing state changes, etc.) "off" of the L1-chain. Typically, a L2 protocol is implemented as a smart contract (one for simplicity; thought it could be several interlinked smart contracts in practice) on the L1 network. The users running the L2 protocol are called operators, who play a similar role as L1 miners, though the L2 protocol are themselves users of L1. We use "operators" as a catch-all term, as different designs might call them different names, such as "operator," "node," "sequencer," "aggregator," etc. or have several different typers of operators in the same protocol. Typically, a smart contract the protocol places on L1 establishes an address as the operator of the L2 or allows the protocol users to link themselves to their L2 identity as operators.
The operator(s) are incentivized to follow protocol in two ways, very similar to how (L1) blockchains work in general:
Blockchain technology is affected by massive limitations in scalability[2]. Increasing the transactional throughput of blockchains is the primary focus of blockchain research today [3]. While the general definition of "L2 protocol" contain many different types of goals and implementations, we will primarily be focused on rollups [4], which are L2 protocols where transactions are executed outside L1 and then the transaction data are included in L1 blocks. Loosely speaking, L2 rollups "roll up" many L1 transactions into more compressed forms.
Roughly speaking, there are 2 families of rollups [3:1]:
In (most implementations of) both rollups, the efficiency comes from the transaction data being written to Ethereum as calldata [6]. We "black box" this and other implementation details in our work. Our main requirement is simply that the rollups offer savings of gas, which we now review.
As we study pricing models, it is important to understand the pricing models of the user/miner market on L1. Like Bitcoin, Ethereum started with the following simple design:
In light of the L2 analysis to come, one can think of this as a market where the miners play the role of "operators", who are competing with each other to put down blocks to be accepted by the main protocol.
In August 2021, the Ethereum Improvement Proposal 1559 (EIP-1559) introduced a new system. This system's main intention was to create a fixed fee for each block while allowing the block sizes to be able to flucuate appropriately to deal with the network's congestion dynamically. [7] The above design is then changed into the following:
The target amount of gas per block (\(g_t\)) is 15 million gas, where the maximum block size is 30 million gas. Notice the maximum block size is double the target block size, this means we can think of EIP-1559 as automatically adjusting based on the demand of the gas resource, with a "slack parameter" (\(\frac{maximum}{target}\)) of 2x.
In our work, when relevant, we will consider the consequences of EIP-1559 on our pricing models (typically in the context of having a L1 base fee that an operator would have to pay to put some transactions on L1). While we put less emphasis on it being a work-in-progress, we will also consider the ramifications of multi-dimensional EIP-1559 (to be discussed later) when possible.
Recall that the two main roles involved in an L2 protocol are users, who send transactions to the operators, and operators, who take these transactions and interface with L1. Operators need some incentive to participate, especially because they are going to be responsible for paying L1 fees to get their user transactions included. This question motivates us to study different pricing models (an explicit calculation of how much money the operator should charge, usually implemented as parameters of the L2 protocol).
In this section, we start the basic analysis of the pricing model of these protocols. Our main guiding principles are:
Our approach is to provide a parametrized model of the revenue to the operator and then discuss how the parameters would be specified given different tradeoffs. We will then compare and contrast our claims with the pricing models in existing L2 protocols.
First, we need to pick a parametrized family of protocols before giving a price model. We start with a basic design that we believe captures the essentials of rollups:
The above is a representative toy model / abstraction meant to focus on only the aspects of protocols relevant to pricing:
Given such a protocol, studying the pricing model requires studying the following interrelated concepts for the operator:
Suppose the operator creates a batch \(B\) of transactions. Our main revenue model is:
\[ R_O = \sum_{X \in B} F(X).\]
A couple of considerations:
Our (operator) cost model is
\[C_O = G(B) * f_C. \]
In this equation:
Our profit model is then
\[P_O = \left(\sum_{X \in B}^n F(X)\right) - G(B) * f_C.\]
Variable | Meaning | Given By |
---|---|---|
\(F(X)\) | user fee | the users, at transaction submission time |
\(G(B)\) | (compressed) gas usage | protocol design, as a function of \(B\) |
\(f_C\) | L1 inclusion fee | the L1 market, at L1 inclusion time |
Our basic model can be generalized:
However, our goal is to make the simplest model possible that captures most of the important considerations, so we do not include these features right now. (as an example of the expressiveness of the simple model, we can already do something like the inclusion-award by just having \(F(X)\) incorporate a per-transaction flat tip, which in effect does the same thing for the operator)
We are now ready to give a price model. Recall this is equivalent to producting a price function that can be computed by the user as a default price for what their actual fees \(F(X)\) should be. In practice, even if we provide a "flat price", \(F(X)\) is influenced by the market demand (for example, the users may compete with each other), but our first step is to assume that we are good at hitting some sort of base price, as how EIP-1559 is designed to keep gas costs near the basefee under most situations that don't involve rapidly-increasing demand. Our ideal, such as with EIP-1559 as analyzed by Roughgarden [8], is to have a posted-price ("take-it-or-leave-it") mechanism.
To start, we want to break down \(G(B)\) and \(f_C\) and compare them to other numbers we can control. As a first approximation, we assume that
\[G(B) \approx \sum_{X \in B} G(X).\]
In other words, we assume that \(G(B)\) equals the sum of some "per-transaction" gas usage \(G(X).\) This, while intuitively true, is only an approximation. For one, we can include our batch \(B\) as one or many transactions. This will affect the overhead cost differently. Also, gas costs depend on ordering at batch-time. As a simple example, maybe two transactions are "identical" in that they both have a user depleting some finite resource (say a token). Then the first chronological transaction will succeed while the second transaction will fail ("revert") and thus use a different amount of gas, and the opposite would happen if we switched the order.
The big picture here is that while we want to (and people in practice do) think of gas usage as a function of the transaction \(X\) "in isolation", in reality gas usage is a much more complicated joint function of the transaction and the state of the blockchain, including which transactions were included before \(X\) in the same block that \(X\) is introduced. This is why in Ethereum L1 transactions users give a gas limit as opposed to an exact computation of gas [9]. To keep things simple, we assume that we are in a setting where this approximation is good enough.
Now, it is clearly important to use the current L1 basefee as an input to the pricing model, so let's define \(f_b\) to be the current L1 basefee. In particular, \(f_C\) (the cost the operator pays to get included in L1) really "should" just be around \(f_b\). However, we should probably overcharge a bit, because there is potential for the basefee to increase (specifically, between the time that a user transaction is sent to the operator and the time the transaction is included in L1) and we want to shield the operator from that risk. One way to implment this is to introduce a "premium" for the variance of the basefee in our price model.
With this setup, the following is a natural "first draft" of our price model:
\[ \text{suggested } F(X) = G(X) * k * (f_b + f_t),\] where
Example. Let us start with a simple case where all the transactions are identical (say a simple transaction) and inclusion into L1 is stable.
Under these assumptions,
It remains to show from the user perspective that they should actually use the L2 from a pure cost perspective (not taking into account other potential reasons such as privacy etc.).
We can conclude that, at least in this example, such a scheme is quite incentive-compatible.
If we plug our basic price model into our profit model, we get
\[ P_O = \sum_{X \in B} \left[ k * G(X) * (f_b + f_t) - G(X) * f_C\right].\]
We can think of this as a sum over the profit "per transaction \(X\)" of
\[ P_O(X) = k * G(X) * (f_b + f_t) - G(X) * f_C = G(X) \left[ k(f_b + f_t) - f_C\right].\]
The parameters the operators can control are \(f_t\) and \(k\). Thinking of \(f_b\) as the primary input given to us by the state of the blockchain, we can think of this situation as choosing a linear function of \(f_b\) so that the above quantity is almost always positive, but not to be too positive (read: greedy) so that the users are also incentivized to participate.
Recall \(f_C\) is what the operator pays to the L1 miner. This means \(f_C = f_{b'} + f_{tm'}\), where
This motivates us to (especially considering \(f_b \approx f_{b'}\)) also break down \(f_t\) into two parts:
The reason we absorb the coefficient is to stress that \(f_{to}\) is a flexible choice that might not depend on \(G(X)\) directly, whereas for \(f_b + f_{tm}\) it makes structural sense to bundle them with a coefficient of \(k*G(X)\) as \(G(X)\) would be the estimated L1 gas. The two really play quite different roles. Putting this together , we have rewritten our per-transaction price model as
\[ \text{suggested } F(X) = k * G(X) * (f_b + f_{tm}) + f_{to}\]
and profit model as
\[ P_O(X) = k * G(X) * (f_b + f_{tm}) + f_{to} - G(X) * (f_{b'} + f_{tm'}). \]
With our second draft, we have broken down the parameters we have control over into some fairly independent parts with clearer meanings:
We now discuss these parameters separately.
On first glance, it seems that \(k\) can be arbitrarily set, but there is one concern we have not touched yet, which is the incentive of the user.
For every \(X\), we define \(g(X)\) to be how much gas \(X\) would cost as a user's "secondary option." This is a necessary notion for us since we need to know what the upper bound price would be for a user to prefer not using the rollup at all (else we would get into the situations of the L2 rollups charging arbitrarily high rates). In a non-competitive market, we can think of this as the gas cost if \(X\) were encoded as L1 transactions instead. For simplicity, we make this assumption going forward as a useful boundary case (in a competitive market, with lots of rollups around, this might asymptote to be close to \(G(X)\)). We write the relationship between \(G(X)\) and \(g(X)\) as \[ G(X) = c(X) g(X),\] where we call \(c(X)\) the (gas) compression rate for \(X\), which we can assume to be at most \(1\).
From the user's perspective, the counterfactual is to pay \(g(X) f_C\), which is how much it takes for the user to get the computation into L1 as their secondary option (one could argue that maybe the operator is better than the user at finding \(f_C\) so we shouldn't be using the same value, but this is a good enough first-order approximation). Thus, we can estimate that the user is incentivized to use our L2 protocol instead if \(G(X) * k < g(X),\) or if \(k < \frac{1}{c(X)}.\) Combining the operator's and the user's incentives gives
\[ 1 < k < \frac{1}{c(X)}.\]
On one extreme, the "best estimate" price to the user would be to set \(k = 1\) and \(f_{to} = 0,\) but this would be unfair to the operator who is now not incentivized to participate, since they are shouldering the costs for the variance of \(f_C\). In fact, what we have is a type of bias-variance tradeoff where the operator should pick up some extra expected value in return for the variance.
Overall, it helps to think of \(k\) as a choice of how much of the total "gains from gas compression" to keep for the protocol in a positive-sum game. In some sense, the users and the operators are splitting a cake created by each transaction created from the compression with total value roughly \[(k-1) G(X) * f_C,\] and we want to give both of them enough of the cake to make them happy.
Recall that our price model is \(k * G(X) * (f_b + f_{tm}) + f_{to}\), and our \(f_b\) and \(f_{tm}\) correspond to the part of the user fee that "pays for inclusion in L1". The remaining term, \(f_{to}\), can be thought of as a flexible number that can mean many things depending on our interests and intentions:
Thus, we see that dealing with \(f_{to}\) is somewhat orthogonal from \(f_b + f_{tm}\) and has a lot of flexibility. Like \(k\), as long as it isn't too high to make this L2 obviously worse than other alternatives (like L1) this will not be a big issue in terms of incentives.
We offer a specific example of how to approach \(f_{to}\) that has a nice "recursive" nature and fits with the existing practices, which is to price \(f_{to}\) itself as a basefee. Thinking of the L2 rollup as its own blockchain, the natural way to price \(f_{to}\) in a manner analogous to EIP-1559 would be:
This would create price models of the form
\[ \text{suggested } F(X) = k * G(X) * (f_b + f_{tm}) + G_2(X) * f_{b2} + f_{to'}.\]
The profits models would need to be adjusted if \(f_{b2}\) is to be burned, for the same reasons \(f_{b}\) would be burned in standard EIP-1559. The analysis here is similar to Roughgarden[7:2].
Recall this final part corresponds to \(f_C = f_{b'} = f_{tm'}\), which is the fee that the operator pays to the L1 miner at time of inclusion. Thus, we can treat this problem as an estimation problem for \(f_C\). The most obvious way to proceed is to use some predictive model based on the history of transactions (notice we can use information from both the L1 chain and the L2 chain!) over some time period.
In our figure above, some predictive model uses the historical fee data to predict the future basefee (and/or the tip required to be included into L1). As in Etherscan[12], where a dashboard renews the gas fee information every 15 seconds, we can think of the L2 protocol as providing a "basefee plus tip oracle" that updates at some rate, and changes the suggested/required \(F(X)\) for the L2 user using the oracle for the value \(f_b + f_{tm}\).
There are many approaches to the predictive model. We give a very non-exhaustive list:
It is worth mentioning that we may want to do more than just predict \(f_C\) with the same predictive setup. Not only do we have L1 data, we also have L2 data (keeping track of users' \(F(X)\) that weren't included, etc.) that can give a better idea of what \(F(X)\) to specify (or even to account for special cases, such as NFT drops, etc.). The key point is that the process for which we suggest \(F(X)\) to users is not an on-chain operation, so it can involve arbitrarily complex operations as long as it becomes a simple oracle for the L2 users to use.
We now give a natural variation of our basic model to cover another family of approaches to pricing. In the model we have so far, users are paying at transaction submission time, since they are given estimates of \(F(X)\) and their user cost function is exactly \(F(X)\). However, another natural approach is for them to supply some estimated upper bound instead, but be charged only at transaction inclusion time (specifically, when the batch \(B\) is included in L1).
Specifically,
A natural way to extend this approach is to provide more resolution on exactly how much gas is saved at inclusion-time, and divide the savings between the different users who submitted transactions. This seems to be a tricky problem and may be hard to make incentive-compatbile [14], which is another reason we stick to our simple model where we just consider heuristic compressions \(c(X)\).
The main benefit to this appraoch is that it may attract more users as the protocol can now claim very enticing offers, such as promising that the users will only pay the base fee at the time of L1 inclusion, and no more (not even a tip). In other words, this implementation has "zero L1 price slippage."
The main problem with this proposal is a dichotomy of two difficulties:
if we consider the tip to the miner at the time of inclusion (so this would include both the approaches of using \(f_C\) and \(f_C + t\) above), this sets up an off-chain agreement between the operator and the L1 miner: the operator can propose to set a very high \(f_{t'}\) for the miner and e.g. split the high fee between the miner and the operator. Then the user will be charged an arbitrarily high fee (possibly protected by \(L\), but the point is that the operator is not disincentivized to increase this number). Thus, it is not incentive compatible to have \(f_{tm'}\) be charged at the time of inclusion. Two nuances:
The above analysis effectively dictates that the price should only depend on the basefee \(f_{b'}\). So that remains us to consider just something like recalculatingthe suggested \(F(X)\) with \((f_b + f_t)\) replaced by \(f_{b'}\), the basefee \(f_{b'}\) at the time of the inclusion. By default, this would mean the operator is losing the tip they pay to the L1 miners. What this means is the protocol really needs to incentivize the operator with higher \(k\) and \(f_{to}\). In the limit that \(k\) approaches \(1\), without very high \(f_{to}\) this rollup would not be incentivized to survive. It is also important to keep in mind that if we were going to do this, there is no obious benefit over the similarly generous submission-time pricing of just charging \(f_b\).
Our preliminary conclusion: inclusion-time pricing is more complex and trickier to get right, with locally-solvable OCA problems. We do not recommend it unless we obtain some obvious big benefit over submission-time pricing.
To see how our price model desgin compares to the practical price models in the market, we researched three leading L2 networks: Optimism, Arbitrum, and zkSync. The first two are optimistic rollups and ZkSync is a zk-rollup. First, we will briefly sketch the differences between the protocols. Then, we will compare their price models in light of our framework.
A preliminary comparison between the protocols follows:
Arbitrum | Optimism | ZkSycn | |
---|---|---|---|
Type | Optimistic Rollup | Optimistic Rollup | ZK Rollup |
Proof | Fraud Proof; Multi-round proofs | Fraud Proof;Single-round proof | zero knowledge proof |
Validation Time | At least 7 days | 7 days | ~10 minutes[16] |
Virtual Machine | AVM | OVM [17] | Some don't have EVM support |
Reduction of Gas Cost | 50x to 270x | up to 10x | ~100-200x[18] |
Gas Price | L2 gas price is set by the operator (aggregator), L1 gas price is estimated. The network charges 15% on top of the fee | L1 and L2 gas prices at that time (If the L1 gas price spikes, Optimism pays the new cost). [19] | ~ 1/100th L1 cost. It might just cost a few cents if the number of users are big enough[20] |
The operator roles between the protocols are also different. Remember that in our framework, "operator" is a catch-all term for the entire protocol. In the comparison below, we contrast how the primary operating role works between the three protocols.
Arbitrum[21] | Optimism[22] | ZkSync[16:1] | |
---|---|---|---|
Responsibility | Wrap txs and send them to L1 smart contract | Verify txs and compute state pubilished by the aggregators. | Roll up txs in a block and submit the root hash of new state along with a SNARK to L1 smart contract |
Operator Role | User sends a deposit to the on-chain smart contract | Anyone who posts their own bond and challenge the assertion | At this point, the operator is the server |
Punishment | Deposit will be slashed | Deposit will be slashed (*) | N/A |
For the punishment structure for Optimism rollup, if fraud is successfully proven, a X% of deposit gets burned and the remaining (1-X)% gets distributed proportionally to every user that provided data for the fraud proof [23].
As in our price model, the compensation for all 3 protocols come from user payments included in their transactions. In summary:
In this section, we write these protocols' price models in our language for easy comparison.
Our abstract "operator" in Arbitrum can be thought of as a combination of the Arbitrum network itself and its aggregators (users who want payment by providing services to other users). Users can choose to submit their transactions through an aggregator or Arbitrum network. The price model given below [21:1]:
\[F(X)=1.15*G_A(X)*f_{b_2} + G(X)*1.15 * f_{C'}\] where:
In the above model, \(1.15*G_A (X) *f_{b_2}\) is called L2 fee, which helps the aggregator cover the cost of servicing a transaction X. \(G(X) *1.15*f_{C'}\) is called L1 calldata. It is the fee per units of L1 calldata directly attributable to the transaction. Currently each non-zero byte of calldata is 16 units, and each zero byte of calldata is 4 units. Besides the L1 and L2 fee, users using Arbitrum also need to pay for storage fee, a fee per location of EVM contract storage, based on the change in EVM storage usage due to the transaction. For the simplicity of this section, we do not cover the storage fee.
Our "operator" in Optimism would refer to a single party called the sequencer. Below is the price model that Optimism is using[22:1]:
\[F_O(X)=G_O(X)*f_{b_2} + k*[G(X)+d]*f_b\]
where \(G_O(X) * f_{b_2}\) is called the L2 fee and \(G(X) *k* f_b\) is called the L1 fee. We look at each layer's fee separately:
Therefore, given there is no congestion and the fixed overhead cost as well as the dynamic overhead cost is still 2100 and 1.24, the price model of Optimism can be written as:
\[F_O(X)=0.001G_O(X) + 1.24*[G(X)+2100]*f_b.\]
Optimism's price model is also very similar to what we have. A small difference here is that Optimism puts a shift on the fixed overhead cost (\(d = 2100\)). While it is easy to manipulate the variables to force it into our framework (for example, we can just say there's an additional \(2100f_b\) going into \(f_{to}\), it is different enough that we find it worht mentioning. Morally, it plays the same role as \(k\) or \(f_t\), providing insurance against the changing of basefee.
Unlike the other two, ZkSync has only one operator/server and users cannot become the operator. Its price model has an "off-chain" and an "on-chian" component[16:2]. That is:
\[F_Z(X)= F_{off}(X) + F_{on}(X)\]
where:
Now, we can rewrite ZkSync's price model as below:
\[F_Z (X) = F_{off}(X) + (k*G(X)+0.4K)*f_b\]
The table below is a summary of our research on the top three leading rollups:
Revenue | |
---|---|
Arbitrum | \(1.15*G(X) * (f_b + f_{tm}) + 1.15G_A(X)*f_{b_2}\) |
Optimism | \(1.24[G(X)+2100]*f_b + 0.001*G_O(X)\) |
ZkSync | \(F_{off}(X) + (k*G(X)+0.4K)*f_b\) |
Basic price model | \[F(X)=G(X)*k*(f_b+f_{tm}) + f_{to}\] |
Basic price model (w/ L2 fee) | \[F(X)=G(X)*k*(f_b+f_{tm}) + G_2(X)f_{b_2} + f_{to}\] |
It is clear that the price models of the three leading rollups are very similar to the basic price model.
Summary:
We have considered the most basic type of "service" that an L2 operator provides, which is to try to include transactions into L1. Slightly more concretely, we define services to be offers of specific outcomes involving the process of including the transaction on L2 and/or how it will be recorded on L1. These services all require tweaks to the basic pricing model.
We classify the space of possibilities for different types of services, also examining those that are already implemented in practice. Furthermore, we look specifically at how lazy evaluation might be brought to ethereum L2's in this light.
We find it useful to differentiate the types of L2 protocols in terms of their accountability design and data availability. We define these notions below:
We loosely define acountability of a service as the degree that we can enforce rational operators to abide to the terms of the service. The two primary methods of enforcement are fraud proofs and validity proofs, mirroring the dichotomy of optimistic rollups and zk-rollups:
Examples in the real world: an immediate cash transaction is accountable[left], a queue is not[right](that is the vendor may not do anything if some one cuts).
Operators are held accountable usually through one of the following two mechanisms.
Both styles of proof serve to establish a basis for trusting the operator. When a user puts money into an L2 that doesnt have any method of ensuring the rules are followed then they are essentially back to a reputation based system, which distributed ledgers are fundamentally trying to get away from. However, lack of accountability alone is not necessarily a deal breaker; the most basic service we outlined in Section 2 is not accountable, and it might still be a robust service to exist in the real world – maybe operators are incentivized to participate to make money, and if they don't include transactions they start losing this source of revenue.
We define data availability as follows:
The following table gives representative families/implementations of real-life rollups that correspond to the \(4\) quadrants created by our two axes:
Data available | Data off-chain | |
---|---|---|
Fraud proofs | Optimistic rollups | PLASMAs |
Validity proof | Zero-Knowledge rollups | Validium |
Currently, most L2's with off-chain data and validity proofs are primarily based off of simple transactions (including token transfers). However recently Scroll published progress to a full Zero-Knowledge EVM so that limitation is more development limited than structural[17:2].
new:
We consider data availability a service which aids in liveliness and reduced dependancy on distribution. The offer of this service is why we focus on rollups.
Recall that when an L2 design chooses a paradigm of proof (fraud or validity), this forces a specific L1 smart contract design. We are looking at services for which an operator can be held accountable within a design.
The following tables considers different additions to the rules of an L2 that would add explicit support for more complex behavior on an L2. For the first table, we show extensions of the main idea of "including a transaction into a block," starting with our most basic service of simple transaction inclusion:
Services being developed on some L2 are denoted with [x].
Name | Service | Details | Target Audience / Existing Implementations |
---|---|---|---|
Simple Inclusion | User sends a single transaction to be included. | none | everyone |
Sequenced | User sends a sequence of transactions, and the transactions must be included in order (although skipping transactions is okay) | More complex for operator to verify several transactions in single batch. | A game or a highly order-dependent type of software written on blockchain. Can aid in reducing the impact of L1 reorgs on L2 data structures |
Atomic | User sends a sequence of transactions. All the transactions must be included in the same batch, if any are to be included. | (similar as above) | Paying out a contract / game / mempool to many people at once. [x] [27] |
Grouped | User sends a sequence of transactions. The transactions, if included, must be atomic and executed in a contiguous sequence. | can be a modest overhead based on number of tx, sequencer can to some extent just treat them like one large tx with 1 gas value and 1 price. most of the cost would be opportunity | A user trying to deny arbitrageurs MEV. A user trying to execute more complex order-depedent logic that might fail if other transactions intersperses with this one (e.g. some sort of logic involving a smart contract with global state that other users can influence). |
Ordering | User can specify a position or sequence of desired transactions | Creates an explicit place to value transaction order. Extends transaction headers or needs secondary market. Adds to the batch packing knapsack problem with some orderings being parallel and some competing. | MEV, more complicated L2 apps. This exists as a service on L1 in flashbots [x] |
Contingency | A user submits a transaction with a list of observalbe requirements, the batch/L2 state must fulfill these or not include the transaction | Generates possibility of significant overhead as the operator must have full node access to the enitre history as well as simulate the state changes of other transactions in the same batch. | Enables complex transactions, both enabling MEV and aiding in avoiding MEV. Can be used to create cross chain or cross L2 bridges for ease of exchange. Can be used to create instantaneuous escrow.[28][29] zkopru and hermez working on implementation.[8:1] [x] |
We now present another table on types of features "orthogonal from inclusion" that can be mixed and matched with the previous type of services and/or each other:
Name | Service | Notes | Target Audience / Existing Implementations |
---|---|---|---|
Anonymization | Varying degrees, simplist is only recording tx record not details on L1 | implementation dependent some degree given by zk, also methods that don’t store data on L1 | high value tx, tx with possibility of being front run, non simple tx [x] [29:1] |
L2 confirmation | Generates a message on/off chain to an address when the sequencer does an attempt at including the tx in a batch | message after L1 posting returned to users | urgent tx that may be canceled, cautious userscurrently indirect via sequencer feed(can move to accountable if feed is commited too)[x] |
L2 confirmed to user | Sequencer generates a token that is sent to the user with signed a batch #. If the tx is not recorded in L2 and appearing on L1 the user can submit the token on L1 and recieve a slashing reward | Generating the token and returning it are overhead to the sequencer and requires user monitoring. | any user wanting tracking, commerce, high value tx that want to be sure things occur |
Escape hatch | L1 smart contracts running L2 support user generated proof of some L2 ownership that allows L2=>L1 fund transfer | requires some increased complexity for zk rollups, more so for optimistic, increases cost of setting up initial L2 smart contracts on L1 but need not increase tx overhead | safety concious users, users interested in riskier/newer L2s, used by many zk rollups and some optimistic, if L1 is truly agnostic this is a strong guarantee [x][30] |
Recurring tx | The sequencer accepts a set of transaction where the transaction is repeated is succesive blocks as user selects | adds off chain storage cost to sequencer depending on size and time constraints, can be verified after the fact that something is in sequential batches. Risky the longer time period is offered if strict guarantee. Increased tx size so that inclusion of all batched tx is verifiable. similar would be delayed or slow below | Support of anonymizing protocols, running smart contracts, proof of liveliness |
Slow tx/lower cost | Somewhat a default behavior, this allows explicit binning for user and sequencer. | Adds offchain storage cost to sequencer but may allow them to profit off the priority fee difference over the time period. User is trading paying the storage cost for letting the sequencer place it freely but in a bounded batch#.(so distinct in that the user is getting a guarantee it will be by some batch number.) So the sequencer is also required to do some predictive work | non urgent users, cost concious users, large numbers of unordered simple tx. |
Delayed tx | User defines a time or batch number after which they want the next batch to include their tx. Longer times require price increases or better prediction | Adds offchain storage cost, risk of L1 priority fee increases, cost of generating a token for the user(for strong guarantee). opportunity cost of inclusion at the later block for other tx.[alternatively just allow users to specify batch # for tx w/o guarantee of inclusion] | more complicated trading/MEV, L2 apps(games or automated payments like billpay) |
The L1 smart contract contains an escape hatch allowing the direct withdrawl from L2 by a user interacting with L1.
Some remarks:
Here is a compact version of the types of overhead associated with each transaction:
Adding most additional transaction types will include some one-time implementation cost. Some computational storage or communication overhead. Furthermore the L2 will become less efficient as the abillity to compress transaction data decreases the more unique calls that are made in a batch. Therefore L2's may be better off selecting transaction types that support only the feature set they are trying to promote. An example of this is existing L2's that only support simple transactions tend to have higher compression ratios. One question is how much of the advantages in compression for ZKP systems is the reduced scope and corresponding compression advantages; vs the validty proof structural advantage.
The services offered would impact the price model primarily in \(G(X)\) where the interactions with other transaction types would be reflected and the additional computation would be captured. Some of the transaction type services can offer reduced prices from interacting with \(C\) as having well structured data increases the compression ratio.
Data avalability as a service allows a larger compression ratio, by going past the lossless limit. Using this allows the price for inclusion to drop. Further service pricing is influenced by the increased difficulty of ensuring liveliness. This difficulty arises from the possibility of a centralized operator ceasing to post to L1[31]. This is problematic as it locks the funds on L2. Unless there are redundancy mechanisms such as escape hatches. These difficulties also serve to reduce the price that can be charged but are of smaller magnitude than the compression savings.
The category we describe first, transaction specific services are those that are most likely to be directly priced by \(G(X)\). This is because most of them have a measurable cost in execution that is assigned to the operator. The support of certain transaction types can draw users to the L2, and enable development of dependent features that would be more costly or unaccountable in other systems.
When considering the pricing for environmental services both \(k\) and \(G(X)\) are relevant however \(k\) is more the focus. This is because \(k\) captures the effiency and long term costs of the transaction. This could alternatively be in a basefee. In both cases the environmental cost to the operator are in implementing and maintaining the features security with respect to the funds stored on L1. By offering these features an L2 operator can distinguish themselves from other operators.
See that L2 prices may compete with other operators instead of L1.
L2 operators with some of the environmental services are also able to mitigate some of the risks associated with depositing on an L2. For instance a user requires a lower degree of trust of an operator with a solid escape hatch. Similarly considering the immediacy of finality and distributedness for liveliness are impacted by the type of proof offered and the availabilty of the data. Others have made similar observations such as Patrick McCorry[31:1]. The generality of Ethereum's mainnet is its strength, but also gives opportunities for L2 operators to create service niches.
The intention of multidimensional EIP-1559 is to shift from pricing a one dimensionally priced resource (gas) with a basefee to one where different resources are dynamically allocated simultaneously, each with their own basefees. This aims to more accurately price different resources used by the EVM.
One of the takeaways of EIP-1559 is that it can be thought of as a mechanism that automatically prices many types of resources, most dominantly EVM computation, as a single resource of gas. This concept can be generalized. As an example, real-life computer computations can use different resources (space, time, registers of one type versus another, etc.). Even a specific resource such as time can be split into sub-resources; for example, maybe all computation of a theoretical computer is done in terms of additions and multiplications, which are optimized differently; then it makes sense to split up "computation" into "number of additions" and "number of computations." In summary, we can look at resources that transactions use under higher resolution than just "gas", such as:
Parameter | Ethereum | Rollup |
---|---|---|
Nonce | ~3 | 0 |
Gasprice | ~8 | 0-0.5 |
Gas | 3 | 0-0.5 |
To | 21 | 4 |
Value | ~9 | ~3 |
Signature | ~68 (2 + 33 + 33) | ~0.5 |
From | 0 (recovered from sig) | 4 |
Total | ~112 | ~12 |
Figure 1: Data usage on mainnet by parameter [32]
The main idea of the proposed multi-dimensional EIP-1559 [33] design is the following: One can argue that these resources, which are all abstractly currently combined into "gas", all possibly have different limits on their burst (over a short term horizon, such as over one block) and sustained (over a long-term horizon, such as over a year) capacities. Multidimensional EIP-1559 proposes that each of the resources of the Ethereum Virtual Machine be priced seperately. The idea is then, the blockchain might be able to better handle situations with different types of demand. The multi-dimensional fee market is expected to have much rarer boundary cases of block sizes compared to the current fee market.[33:1]
The client code for the user would need to update nontrivially. Whereas before there was only one key resource (the basefee) to keep track of, now there are \(R\) resources. There are a few consequences that make the understanding of the market more complicated:
We wrote some preliminary simulations to study multidimentional EIP-1559:
Figure: the top image shows a regular basefee oscillating under a normal EIP-1559 model under some randomly-generated transactions and models of demand. The lower-left image shows multidimensional EIP-1559 with 2 resources that are completely corrleated (scaled 7:3) using the same sequence of transactions and demand as the top image, which gives identical graphs. The lower-right image shows multidimensional EIP-1559 with anticorrelated resources (again with the same sequence of transactions). Note that the unequal proportions of the two resources are "discovered" by the invisible hand of multidimensional EIP-1559.
We now extend the pricing model from Section 2. In the standard (EIP-1559) case, it is the users benefit to post transactions with a "low" basefee, as the user pays less in fees to get the same transaction across (assuming the priority fee was not significant). [34] While this concept is easy for users to understand when we only have one dimension (gas), in the muldimensional fee market, this concept gets much more complicated.
Here are the things that change for the protocol with \(R\) resources:
Remark. It is also possible to consider decoupling the \(f(X)\). In other words, have the transaction supply one max fee \(f_i(X)\) for each of the resources, and the cost of including a transaction is now \(\sum_{i=1}^R G_i(X)f_i(X)\) while the revenue is now \(\sum_{i=1}^R G_i(X) (f_i(X) - b_i).\) It's interesting to note that the(L1) user can give a negative tip in a resource, as long as the overall tipping is positive it will be incentive-compatible for a miner to take it! In some sense these two approaches are mathematically equivalent, but can be conceptually quite different.
Recall that our pricing model in the single-dimensional case was
\[ \text{suggested } F(X) = k * G(X) * (f_b + f_t).\]
The natural extension of this is
\[ \text{suggested } F(X) = \sum_{i=1}^R k_i G_i(X) * (f_{b, i} + f_{t, i}),\]
where we now have \(R\) copies of each variable corresponding to the \(k\) different resources. While most of these are self-explanatory given Section 2, we make some brief remarks on certain parameters:
Profit Model:
\[P_O = \left(\sum_{X \in B} F(X)\right) - \sum_{i=1}^RG_i(B) * f_{C,i}.\]
The main idea is that our basic price model extends easily to multi-dimensional EIP-1559. There is much room for future work to work out nuances (for example, what to do if we have an interaction of known correlations and anti-correlations between the different resources).
Our pricing model in Section 2 is a basic but also flexible framework for L2 rollups that can generalize to broader L2 services. The basic model fits many different types of rollups while allowing nuances specific to the implementations to be added. We provide some examples of these nuances, generalizations, and potential extensions, and also performed preliminary incentive-compatibility analysis.
As we look forward into the future of Ethereum and L2 services, understanding L2 services beyond simple transactions becomes important as an ecosystem of L2 (and also other services that do not quite fit inside L2, such as Flashbots, that provide related functionality) emerges. Our Section 3 is a preliminary attempt to categorize and understand the complexity of that space. We hope that our flexible pricing model can adjust accordingly for these additions. In doing so, we would need to account the more complex types of desires the users have (MEV, privacy, etc.) to do more serious analysis.
Besides the growth of service complexity, new paradigms and EIPs to Ethereum would be the most obvious place to perform extended research growing out of our work.
https://ethereum-magicians.org/t/some-medium-term-dust-cleanup-ideas/6287 Buterin, Vitalik. "Some medium-term dust cleanup ideas" May 2021. ↩︎
https://pdfs.semanticscholar.org/cf12/16d4421a4e4225fffd96505ec679376f6758.pdf Nowiński, Witold, and Miklós Kozma. "How can blockchain technology disrupt the existing business models?." Entrepreneurial Business and Economics Review 5.3 (2017): 173-188. ↩︎
http://reader.elsevier.com/reader/sd/pii/S209672092100026 Bruschi, Francesco, et al. "A scalable decentralized system for fair token distribution and seamless users onboarding." Blockchain: Research and Applications 3.1 (2022): 100031. ↩︎ ↩︎
https://ethereum.org/en/developers/docs/scaling/ : Ethereum Development Docs, "Scaling." Last modified April 2022 ↩︎
https://hop.exchange/whitepaper.pdf Whinfrey, Chris. "Hop: Send tokens across rollups." 2021. ↩︎ ↩︎
https://ethereum.org/en/developers/docs/scaling/optimistic-rollups/ Smith, Corwin, and Richards, Sam. "Optimistic Rollups." Ethereum docs 2022. ↩︎
http://eips.ethereum.org/EIPS/eip-1559 Vitalik Buterin, Eric Conner, Rick Dudley, Matthew Slipper, Ian Norden, Abdelhamid Bakhta, EIP-1559: Fee market change for ETH 1.0 Chain, 2019. ↩︎ ↩︎ ↩︎
https://arxiv.org/pdf/2012.00854.pdf
Roughgarden, Tim. "Transaction fee mechanism design for the Ethereum blockchain: An economic analysis of EIP-1559." arXiv preprint arXiv:2012.00854 (2020). ↩︎ ↩︎
http://inf.news/en/tech/bc8c0fa2ea6e0e2f3fe8963205cc8a36.html Inf news. "How much cheaper are Arbitrum and Optimism than L1?."2022. ↩︎
https://medium.com/huobi-research/an-in-depth-look-at-rollups-tech-application-and-data-eb8f91bf369b Huobi Research. "An in-depth look at Rollup’s tech, application, and data" Aug 2021. ↩︎
http://ethereum.org/en/layer-2/ “Layer 2.” ethereum.org (2022). ↩︎
https://etherscan.io/gastracker Etherscan. "Ethereum Gas Tracker." 2022. ↩︎
https://ieeexplore.ieee.org/document/9529485 Mars, Rawya, et al. "A machine learning approach for gas price prediction in ethereum blockchain." 2021 IEEE 45th Annual Computers, Software, and Applications Conference (COMPSAC). IEEE, (2021). ↩︎
https://www.youtube.com/watch?v=JfaxBythV4Q : Felten, Ed. "Fair and sustainable fees for L2." ETHconomics @ Devconnect, 2022. ↩︎
https://blog.matter-labs.io/optimistic-vs-zk-rollup-deep-dive-ea141e71e075 Gluchowski, Alex. "Optimistic vs. ZK Rollup: Deep Dive." 2019. ↩︎
https://docs.zksync.io/userdocs/ zkSync. “Welcome to Zksync.” zkSync Documentation (2022). ↩︎ ↩︎ ↩︎
https://medium.com/ethereum-optimism/fancy-numbers-how-we-lowered-fees-for-optimism-users-a3bb80cbc65f “The Road to Sub-Dollar Transactions Part 1: Slashing Fees by 30%.” Medium. Optimism PBC Blog,2022. ↩︎ ↩︎ ↩︎
https://docs.zksync.io/userdocs/tech/#zk-rollup-architecture zkSync. “Technology.” zkSync Documentation (2022). ↩︎
https://medium.com/ethereum-optimism/ovm-deep-dive-a300d1085f52 Ethereum Optimism. "Ethereum optimism ovm deep dive."2020. ↩︎ ↩︎ ↩︎ ↩︎
https://learn.bybit.com/blockchain/zk-rollups-eth-scalability/ "ZK-Rollups Guide: ETH Scalability — and Why It’s the Next Big Narrative."(2022). ↩︎
https://developer.offchainlabs.com/docs/inside_arbitrum#gas-and-fees “Inside Arbitrum · Offchain Labs Dev Center.”Offchain Labs Dev Center (2022). ↩︎ ↩︎
https://community.optimism.io/docs/how-optimism-works/ Optimism team. “How Optimism Works.” Optimism Docs (2022). ↩︎ ↩︎
https://hackernoon.com/comparing-3-promising-layer-2-solutions-based-on-optimistic-rollups-6r5h245j "Comparing 3 Promising Layer 2 Solutions Based on Optimistic Rollups."2021. ↩︎
https://developer.offchainlabs.com/docs/inside_arbitrum#fees “Inside Arbitrum-Offchain Labs Dev Center.” Offchain Labs Dev Center (2022). ↩︎
https://medium.com/fcats-blockchain-incubator/how-zk-rollups-work-8ac4d7155b0e Brown, Simon. "How Zk-Rollups Work" Jul 6, 2021. ↩︎ ↩︎
https://public-grafana.optimism.io/d/9hkhMxn7z/public-dashboard Optimism. "Public Dashboard." 2022. ↩︎
https://hackernoon.com/layer2-interoperability-starkex-vs-loopring-vs-hermez-vs-connext-5y1p37vs Sin7y. "Layer2 Interoperability: StarkEx Vs. Loopring Vs. Hermez Vs. Connext" hackernoon. July 2021. ↩︎
https://medium.com/starkware/conditional-transfers-the-key-to-interoperability-2e1de044fb65 StarkWare. "Conditional Transfers — The Key to Interoperability" 2021. ↩︎
https://dydx.exchange/blog/alpha dydx. "L2 roadmap" 2022. ↩︎ ↩︎
https://support.deversifi.com/en/article/deversifi-withdrawing-tokens-1vo38bg/ DeversiFi. "Withdrawing Tokens From DeversiFi" March 2022. ↩︎
https://mirror.xyz/0xaFaBa30769374EA0F971300dE79c62Bf94B464d5/k8Fr68ELdjIwJpGPpag_dnUarnypD5IUahpp6wT0qmk McCorry, Patrick(0xaFaB). "Mental models for L1 and L2" 2022. ↩︎ ↩︎
http://vitalik.ca/general/2021/01/05/rollup.html Buterin, Vitalik. An Incomplete Guide to Rollups. 5 Jan. 2021 ↩︎
http://ethresear.ch/t/multidimensional-eip-1559 Buterin, Vitalik. Multidimensional EIP 1559. 5 Jan. 2022 ↩︎ ↩︎
https://help.optimism.io/hc/en-us/articles/4416677738907-What-happens-if-the-L1-gas-price-spikes-while-a-transaction-is-in-process Optimism. "What happens if the L1 gas price spikes while a transaction is in process."2022. ↩︎
http://ethresear.ch/t/proposer-block-builder-separation-friendly-fee-market-designs Buterin, Vitalik. "Proposer/block builder separation-friendly fee market designs". June 2021. ↩︎