Back to Blog
Research
Sharding Fee Models: Local vs Global Fee Market
An exploration of the current gas pricing landscape in sharded systems, focusing on the advantages and disadvantages of local vs. global fee market.
02 Oct 2024
Introduction
As blockchain networks grow and handle more and more transactions, the efficient utilization of limited block space becomes critical. Transaction fees are currently one of the main levers for achieving this efficiency. They serve not only as incentive for validators who secure the network but also as a mechanism to prioritize transactions. Additionally, the transaction fee mechanism, which dynamically adjusts the fee level based on network activity, helps manage congestion by increasing fees during periods of high demand and decreasing them during periods of low demand.
In traditional blockchains, achieving this efficiency is a complex and ongoing challenge. Networks must balance between affordability of transaction fees for the end users, optimal block space usage and proper incentivization for validators, all without compromising security or decentralization.
In sharded blockchains, where parallel transaction processing is enabled via independent but connected shards, these challenges are amplified. Why? Let us briefly cover what some of these challenges are:
- Designing a transaction fee mechanism to meet the above-mentioned balance (affordability, optimal block space usage, validator incentives, security, etc.) is challenging, as the system is split into multiple shards, each handling a potentially variable transaction workload.
- Managing congestion and overload of shards is complex, as certain shards may handle disproportionately high activity due to the presence of popular dApps, while others remain underutilized. This imbalance can lead to suboptimal performance on congested shards, such as slower transaction processing. Depending on the fee market (local or global), this may or may not impact the transaction fees paid by users.
In this blog post, we will explore different approaches to gas pricing in sharded blockchains, discuss the ideal outcome of the transaction fee mechanism, and examine the pros and cons of local and global fee market. We also assert that the Local Fee Market is the best fit for zkSharding, and we will explain the reasoning behind this decision in the sections to follow.
Gas Pricing in Sharded Blockchains: Current Landscape
Currently there are three predominant approaches to gas pricing in sharded blockchains:
- Algorithmic global gas pricing (NEAR): In this model the gas price is adjusted based on the total gas usage across all shards. If the blockchain as a whole experiences higher resource demand than ideal, the gas price adjustment algorithm increases the gas price, and vice versa.
- Fixed consensus global gas pricing (TON): In this model the price of gas units is determined by the chain configuration and can be changed only by consensus of validators. In this model there is no real fee market, the whole system maintains a “take it or leave it” gas price level.
- Resource-specific global gas pricing (MULTIVERSX): In this gas pricing model, different types of operations have their own gas prices. For example, the gas price per unit for value movement and data handling is different from that of contract execution.
Theoretical Foundation: Characteristics of an Ideal Transaction Fee Mechanism
Before we dive deeper, it’s essential to ask: What is the ideal outcome of the blockchains’ transaction fee mechanism? To find that answer we will first quote Tim Roughgarden, cryptoeconomics and algorithmic game theory expert at a16z:
“Every block is fully utilized by the highest-value transactions, with all transactions paying a gas price equal to the market-clearing price.”[1]
The concept of a market-clearing price is one of the fundamental concepts of classical economic theory. What does it exactly mean?
The market-clearing price (MCP) is the price at which the quantity of goods supplied matches the quantity demanded in a market, ensuring that the market is in equilibrium. At this price, there is no excess supply (surplus) or excess demand (shortage), meaning that all sellers who want to sell at this price can find buyers, and all buyers who are willing to buy at this price can find sellers.[2]
In the context of blockchains, MCP is the price at which the total amount of gas demanded equals the available supply. This price serves to prioritize transactions based on their value, ensuring that the limited space in a block is used in the most efficient and economically viable way possible.
Transaction fee mechanisms like EIP-1559 aim to achieve a MCP for the target block size by dynamically adjusting the base fee per gas. To respond to fluctuations in demand, it uses variable-sized blocks, allowing block sizes to expand up to twice the target capacity when necessary. The base fee is adjusted automatically after each block, based on the gas usage in the previous block, ensuring a balance between supply and demand for block space. [3]
Local vs. Global Fee Market
In a sharded blockchain which utilizes variable size blocks, uniform target block size and a base fee adjustment algorithm there can be two market-clearing prices:
- Individual shard MCP: The price at which the individual shard’s gas demand equals the target block size.
- Global MCP: The price at which the total system’s gas demand equals the target sharded system’s gas supply.
The second option might not seem intuitive right away, so let’s start by visually explaining these two MCPs using a simplified model of gas demand across different shards:
- We have 5 shards with different demand for gas as a function of current gas price.
- The demand function is as follows: , where represents the gas demand for shard , is individual shards’ gas price, block_capacity is shards’ total block gas capacity (30,000,000 in this example), while is the demand price sensitivity of the said shard (for example: = 30,000,000).
- The demand function is a decreasing function as the demand for a good or a service lowers when the price rises.
- Ideal block fullness is 50%.
Local MCP
As shown in Figure 2, we observe that each shard has its individual market-clearing price, where the ideal block space for that shard is fully utilized. These prices vary because each shard experiences different levels of demand, which we represent in our model through shard-specific price sensitivity. The graph highlights the market-clearing prices for individual shards, which the fee adjustment mechanism should target in order to optimize efficiency and economic viability. An important outcome of this approach is that by balancing gas usage at the individual shard level, we also achieve system-wide balance, as all shards work toward the ideal block fullness.
Global MCP
In contrast, the Figure 3 illustrates the outcome of a Global Fee Market, where the system’s base fee adjustment algorithm targets a global market-clearing price. In our example, this price happens to be the best fitting for Shard 3. As a result, all shards, regardless of whether they have high or low demand, are subject to the same gas price. This may lead to imbalances, with some shards becoming overloaded while others are underutilized. In extreme cases, depending on the gas price adjustment mechanism, certain shards may experience congestion while others remain nearly empty. These extreme cases are usually handled through split and merge conditions. Some systems address these imbalances with mechanisms such as shard split/merge conditions.
Pros and Cons of Local and Global Fee Market
Now that we’ve explored the foundational aspects and current landscape of gas pricing in sharded blockchains, let’s dive into the pros and cons of the Local and Global Fee Market. There’s no one-size-fits-all solution; the best model depends on the goals of the system. Below, we’ll briefly present the key advantages and disadvantages of each approach to help highlight their trade-offs.
Local Fee Market
Pros:
- Each shard adjusts its gas price based on its own demand, ensuring that block space is used efficiently
- Efficient distribution:
- Applications aiming for cost efficiency are incentivized to deploy their contracts on less congested shards
- Users seeking cost efficiency are incentivized to interact with the same dApp on less congested shards, reducing the load on busier ones.
- By aiming for a target gas usage in each shard’s block, we maintain system-wide congestion balance. Local fee adjustments respond to both higher and lower activity, ensuring each shard stays balanced and gas usage aims for the target, promoting overall network efficiency.
Cons:
- Coordinating cross-shard transactions is more complex due to the need to estimate and synchronize gas prices between shards, adding overhead to the process.
- Lower prices on less congested shards may attract more users, potentially leading to congestion in previously underutilized shards, shifting bottlenecks rather than resolving them. This could be mitigated by smart wallets that dynamically route transactions to the most optimal shards based on real-time congestion and gas price data, ensuring an even distribution of traffic across the system.
Global Fee Market
Pros:
- Users face a consistent fee across the entire network simplifying fee estimation, especially for cross-shard transactions.
- Easier technical implementation.
- Uniformity as users are charged the same fee per gas unit regardless of which shard they use. This has been the case in sharded solutions on the market.
Cons:
- Available block space is not optimally used across the network
- Slow price response to demand spikes on individual shards as the gas price adjustment algorithm takes into account the total demand across all shards
- Uniform gas pricing removes the economic signals that would normally guide users to underutilized shards, reducing the system’s ability to self-balance based on supply and demand. Some systems address this through algorithmic shard management (e.g., split/merge conditions) to balance load, though this approach operates differently from a market-based system and increases the overall complexity of the system.
- Developers and users may not be incentivized to optimize for specific shard conditions, as there is no differentiation in pricing that rewards efficient shard usage.
Summary and Next Steps
In this blog post, we explored various aspects of transaction fees in sharded blockchains, including the Local Fee Market and Global Fee Market models. We also discussed the importance of achieving a market-clearing gas price and reviewed different gas pricing approaches. Among the models, we identified the Local Fee Market as the most fitting for zkSharding. This approach will help us manage uneven congestion by allowing each shard to adjust its gas price based on local demand. It promotes better block space utilization, improves network scalability, and provides users with more flexibility to transact on lower-cost shards if they wish.
While this model adds complexity—especially in cross-shard transactions—it leads to greater efficiency and economic viability by aligning transaction fees with shard-specific demand. The benefits in terms of resource optimization make it the most suitable choice for our solution.
In addition, we are researching the potential of programmable transfers, which would allow users to move their accounts/contracts between shards. This adds a new layer of flexibility, as users can optimize their transactions and participate in load balancing based on market dynamics rather than relying on predefined algorithms for state distribution.
Stay tuned as we publish more research and join the conversation in our Telegram.
References
[1] https://arxiv.org/abs/2012.00854
[2] https://economictimes.indiatimes.com/definition/clearing-price
[3] https://ethereum.github.io/abm1559/notebooks/eip1559.html