May 16, 2024 · Reading Time: 6 minutes

Understanding L2 Fees: What They Are and Why They Matter

Share this post:


Layer 2 (L2) blockchains are like bustling metropolises, alive with activity and energy, where transactions fly at lightning speed, enabling dApps to handle the multitude of transactions with unprecedented efficiency. Yet, amidst the seamless flow of data and transactions lies a reality often overlooked: the intricate workings and associated costs of this digital infrastructure.

It’s easy to take the benefits of Layer 2 blockchains for granted, enjoying the speed and scalability without fully understanding the inner mechanisms at play. But as the age-old adage goes, nothing comes for free in this world. Similarly, Layer 2 networks come with their own price tag, albeit a very low one, manifested in the form of transaction fees.

In this post, we’ll shed light on the different types of fees that exist on layer two blockchains, what they are used for, and how Starknet, for one, is working to reduce them even further so that blockchain technology can take a step closer to mass adoption.

What are L2 fees?

In short, L2 fees are the payments required to execute your transaction on an L2. These fees are lower than those on the main blockchain because transactions are processed off the main chain, which reduces congestion and speeds up processing times. 

To illustrate, picture the L1 blockchain as a busy highway congested with vehicles. Each transaction (vehicle) competes for a limited number of blocks (road lanes), leading to high transaction fees (gas) and slow processing times (traffic jams). 

L2 solutions act as bypass lanes, processing transactions off-chain before periodically batching them for settlement on the main blockchain. This significantly reduces congestion and facilitates faster, cheaper transactions.

However, while L2s alleviate the burden, and much of the costs, of Layer 1, they still incur fees to function. After all, being able to process transactions faster than you can say “gas fees,” comes at a cost, even if much reduced.

Why do we need L2 fees?

As with L1 chains, L2 fees serve three purposes for the network:
1) Incentivising security
2) Promoting sustainability
3) Enabling scalability

Let’s take a brief look at each of these elements in turn.

Incentivizing network security

L2 fees act as a reward for validators who secure the network. Just like those who verify and process transactions on Ethereum receive fees in return for staking their Ether and verifying blocks, L2 validators also need an economic incentive to process transactions and ensure the network’s smooth operation. 

Without fees, there would be less motivation to participate, potentially compromising the network’s security by making it more centralized (fewer participants). Fees also deter malicious actors from flooding the network with insignificant transactions.

Promoting sustainability

L2 fees contribute to the long-term sustainability of the network. These fees are used to cover operational costs, such as development and maintenance. Additionally, they help prevent frivolous or malicious transactions by creating a barrier to entry. By imposing a cost for each transaction, Layer 2 network fees incentivize users to prioritize legitimate transactions, ultimately contributing to the long-term sustainability and health of the network.

Enabling network scalability

By imposing a cost for each transaction, Layer 2 fees incentivize users to optimize their use of network resources, reducing the likelihood of congestion and allowing for smoother transaction processing. 

Furthermore, Layer 2 fees can be dynamically adjusted based on network demand, allowing for flexible fee structures that adapt to changing conditions and fluctuations in transaction volume. Overall, by incentivizing efficient use of network resources and providing mechanisms for managing congestion, Layer 2 fees play a vital role in ensuring the scalability and performance of the network.

Understanding the L2 fee structure

Now that we have some understanding why L2 fees are required, let’s break down their components:

  • Gas fees: Similar to the Ethereum mainnet, L2 solutions utilize “gas fees.” This fee represents the computational resources required to execute a transaction. The higher the complexity of the transaction, the more gas it consumes and the higher the gas fee.
  • Transaction fees: This refers to all fees associated with an L2 transaction, including gas fees and any network-specific fees. Fee structures can vary depending on the L2 protocol but typically include fixed (network-related) fees and dynamic fees that fluctuate based on network congestion.
  • L1 and L2 fees: This is an alternative way of classifying L2 fees since L2 fees are typically made up of an L1 component (total cost of interactions with L1) and an L2 component (total cost of interactions with L2).

Fee calculation methods

Layer 2 (L2) fee calculations often involve complex formulas with lots of variables, depending on the specific L2 solution. Here we’ll highlight the major factors that affect fee calculations:

  1. Gas: The gas represents the computational effort required to execute the transaction. The total gas fee is the product of the gas used and the gas price, which is set by the network based on demand.
  2. Batching costs: Some L2 solutions, like Starknet, calculate fees based on the proportion of a user’s transaction in each batch. In other words, multiple transactions are grouped together and processed as a single unit, reducing the overall cost.
  3. Data-storage costs: In L2s, storing data on L1 incurs significant costs. Thus, the transaction fee calculations are heavily impacted by the cost of “calldata,” which ensures data availability and comprises the majority of the cost. 
  4. Network congestion: Some L2 solutions adjust their fees dynamically based on network congestion and demand. For example, when the network is busy, the fees might increase to prioritize transactions that are willing to pay more.
  5. Fixed fees: Fixed fees also play a huge part in calculating L2 fees. This provides some predictability for users but doesn’t often reflect the true cost of a transaction.

typical user payments on l2s

(source: Growthepie.xyz)

Fee optimizations on Starknet

While L2 fees are significantly lower than Ethereum mainnet fees, L2 developers are constantly coming up with new ways to optimize and reduce them even further. Starknet developers, for example, have made it a core focus of the Starknet Roadmap to introduce various fee-slashing upgrades, such as Volition, Dynamic Layouts, and v0.13.0 and more. 

Below we’ll explain a little more about what these involve.

Leveraging EIP-4844

EIP-4844, one of the most highly-anticipated changes to Ethereum and part of the Dencun upgrade, was designed to drastically lower the operating costs of rollups. Dencun introduced a new type of transaction called “blobs.” This innovation changed how data is stored on Ethereum, replacing the previously more expensive “calldata” transactions.

Starknet was the first to implement this long-awaited upgrade and was one of its biggest beneficiaries due to the fact that call data accounted for nearly 90% of the gas fees Starknet paid to post transactions to Ethereum. As a result of leveraging the EIP-4844 upgrade, Starknet users saw fees take an average 95% drop – from $6.8 to $0.04.

Volition

Among the various factors influencing transaction costs, onchain data availability alone can account for up to 95% of the average transaction cost. Therefore, reducing L1 onchain data can significantly lower overall costs for users and developers. Starknet’s solution to this challenge is called Volition.

Volition is a new feature that will allow Starknet to dramatically reduce the cost of storing transaction data. Rather than store all transaction data on Ethereum, with Volition, developers can choose to store transaction data on Starknet, drastically reducing storage fees.

v0.13.0 upgrade

Starknet’s v0.13.0 was released in January 2024 and introduced a slew of improvements to throughput and performance as well as support for EIP-4844 that saw a significant reduction in transaction fees. The upgrade also included expanding block size on the network and reducing transaction fees by up to 25%.

Dynamic Layouts

Dynamic Layouts, already live on Starknet mainnet, are Starknet’s latest efficiency upgrade to the SHARP (SHARed Prover) system. SHARP (SHARed Prover) processes batches of transactions from different dApps offchain, and validates the proof of their computation onchain, amortizing the cost of that single proof between all transactions. The result is enhanced throughput, reduced latency, and drastically lower costs.

Up until now, SHARP reserved resources for dedicated operations (builtins) regardless of whether they are used. This translated to actual memory computation. Think of it like the post office mailing a large box with only one book inside.

With Dynamic Layouts, resources are used more wisely, so you only pay for what you use. Or in other words, the box is filled more efficiently and you’re only paying for the space your “book” uses. This means less wasted space, better resource use, and a reduction of transaction fees.

Early fee reductions

The Starknet Foundation has launched an early fee-reduction initiative to lower transaction fees ahead of schedule, before each of the technical elements of the roadmap are rolled out.

This proactive move applies cost-saving benefits of future network upgrades immediately, aiming to mirror the much lower fees expected once Starknet fully transitions to a decentralized proof-of-stake (PoS) model. At that stage, users will barely pay any fees at all as staking rewards will cover almost all network operating costs.

So, if you’re on the hunt for an L2 that offers blazing speed, rock-bottom fees, and is always on top of the latest developments, then look no further thanStarknet.

To get started on Starknet, open a wallet with Argent or Braavos, bridge funds from your Ethereum wallet and then check out the awesome apps available on Starknet.

To stay updated with the latest developments in the Starknet ecosystem, follow Starknet on X