Gas Pricing and Transaction Fees

This page provides a detailed look at exactly how transaction fees work on Zircuit. Zircuit transaction fees are composed of an Execution Gas Fee and an L1 Data Fee. The total cost of a transaction is the sum of these two fees. The following paragraphs describe how the cost for each of these are derived.

Execution Gas Fee

A transaction's execution gas fee is exactly the same fee that you would pay for the same transaction on Ethereum. This fee is equal to the amount of gas used by the transaction multiplied by the gas price attached to the transaction. Like Ethereum, Zircuit uses the EIP-1559 mechanism to set the base fee for transactions. The total price per unit gas that a transaction pays is the sum of the base fee and the optional additional priority.

The gas used by a transaction on Zircuit is exactly the same as the gas used by the same transaction on Ethereum. If a transaction costs 100,000 gas on Ethereum, it will also cost 100,000 on Zircuit. However, the gas price for that transaction is expected to be much lower on Zircuit than the gas price on Ethereum so you end up paying much less ETH in total. The EIP-1559 parameters used by Zircuit differ from those used by Ethereum as follows.

ParameterZircuit valueEthereum value (for reference)

Block gas limit

30,000,000 gas

30,000,000 gas

Block gas target

3,000,000 gas

15,000,000 gas

EIP-1559 elasticity multiplier

10

2

EIP-1559 denominator

50

8

Block time in seconds

2

12

Base Fee

The base fee is the minimum price per unit of gas that a transaction must pay to be included in a block. Transactions must specify a maximum base fee higher than the block base fee to be included. The actual fee charged is the block base fee, even if the transaction specifies a higher maximum base fee. The Zircuit base fee behaves exactly like the Ethereum base fee with a few small parameter changes to account for shorter block times.

Priority Fee

Just like on Ethereum, Zircuit transactions can specify a priority fee. This priority fee is a price per unit of gas that is paid on top of the base fee. For example, if the block base fee is 1 gwei and the transaction specifies a priority fee of 1 gwei, the total price per unit of gas is 2 gwei. The priority fee is an optional component of the execution gas fee and can be set to 0.

The Zircuit sequencer will prioritize transactions with a higher priority fee and execute them before any transactions with a lower priority fee. If transaction speed is important to your application, you may want to set a higher priority fee to ensure that your transaction is included more quickly. The eth_maxPriorityFeePerGas RPC method can be used to estimate a priority fee that will get your transaction included quickly.

L1 Data Fee

The L1 Data Fee is the only part of the Zircuit transaction fee that differs from the Ethereum transaction fee. This fee arises from the fact that the transaction data for all Zircuit transactions is published to Ethereum. This guarantees that the transaction data is available for nodes to download and execute. The L1 Data Fee accounts for the cost to publish a Zircuit transaction to Ethereum and is primarily determined by the current base fee on Ethereum. With the introduction of blobs on Ethereum, a new transaction type for posting this kind of data was introduced. The current Ethereum blob data gas price will largely determine the L1 data fee.

Mechanism

The L1 Data Fee is automatically charged for any transaction that is included in a Zircuit block. This fee is deducted directly from the address that sent the transaction. The exact amount paid depends on the estimated size of the transaction in bytes after compression, the current Ethereum blob gas price, and several small parameters.

The L1 Data Fee is most heavily influenced by the Ethereum base fee that is continuously relayed from Ethereum to Zircuit. Short-term fluctuations of the L1 Data Fee are generally quite small and should not impact the average transaction.

The L1 Data Fee is charged automatically. It is currently not possible to limit the maximum L1 Data Fee that a transaction is willing to pay.

Formula

The pricing functions for the L1 Data Fee uses the following parameters:

  • The current Ethereum base fee and/or blob base fee.

  • Two new scalar parameters that independently scale the base fee and blob base fee.

The L1 Data Fee calculation begins with counting the number of zero bytes and non-zero bytes in the transaction data. Each zero byte costs 4 gas and each non-zero byte costs 16 gas. This value, when divided by 16, can be thought of as a rough estimate of the size of the transaction data after compression.

tx_compressed_size = [(count_zero_bytes(tx_data)*4 + count_non_zero_bytes(tx_data)*16)] / 16

Next, the two scalars are applied to the base fee and blob base fee parameters to compute a weighted gas price multiplier.

weighted_gas_price = 16*base_fee_scalar*base_fee + blob_base_fee_scalar*blob_base_fee

The L1 Data Fee is then:

l1_data_fee = tx_compressed_size * weighted_gas_price

Last updated