Fee model
Overview
Like other rollups (e.g., ZKsync), Via Network must cover the cost of publishing transactions from L2 back to L1. Because of this, fees on Via Network depend on:
Layer‑1 gas prices
DA layer gas cost parameters
L2 minimum gas price parameters
These combine to form an L2 gas price that balances fair fee pricing and operational cost recovery.
The core output of this model is a set of values called the batch fee inputs, including:
l1_gas_price: the scaled L1 gas pricefair_l2_gas_price: the L2 gas price that transactions must payfair_pubdata_price: the scaled pubdata price for publishing data
These values are passed to the rest of the system to determine final transaction fees.
Fee Model Structure
The Via Network fee model is composed of three main pieces:
Fee parameter provider – supplies real‑time L1 price information.
Batch fee input calculator – computes the fair L2 gas price and pubdata price.
Clipping logic – enforces operational caps to ensure continuity GitHub
L1 Gas Price
Cost (in base tokens) to publish on the Layer‑1 chain (scaled).
Fair L2 Gas Price
A baseline gas price that L2 transactions must meet, covering overhead and minimum thresholds.
Fair Pubdata Price
A price for bytes of pubdata, tied to the base L1 price.
Deriving the Fee
Get L1 Prices
Via’s fee model starts by querying the Bitcoin L1 price from an external provider for:
l1_gas_price: the L1 gas price historyl1_pubdata_price: the estimated cost per pubdata unit
These come from an implementation of ViaBaseTokenRatioProvider.
Compute Fair L2 Gas Price
The fair L2 gas price is computed based on batch overheads and a minimum L2 gas price provided in the configuration. The formula is:
Where:
batch_overhead_l1_gas: L1 gas cost per batch (operational overhead)config.max_gas_per_batch: max gas units per batchconfig.minimal_l2_gas_price: minimum allowable L2 gas price
This produces a fair L2 gas price that covers overheads and respects the configured minimum
Pubdata Price
Via uses the scaled L1 pubdata price parameter (relatively constant cost on DA layer) directly as the fair pubdata price:
This price roughly tracks how much it costs to post data to DA layer(Celestia).
When submitting a transaction, your effective gas cost will depend on:
Current L1 gas price (from real feeds)
Pubdata pricing tied to DA pubdata cost
L2 minimum gas price.
These combine to give a per‑unit L2 gas price for your transaction, ensuring both fair pricing and operational cost coverage.
MAX_TRANSACTION_GAS_LIMIT
A recommended maximal amount of gas that a transaction can spend on computation is MAX_TRANSACTION_GAS_LIMIT=1125899906842624.
Reference:
Last updated