Gas Fees
Learn how Abstract differs from Ethereum’s EVM opcodes.
Abstract’s gas fees depend on the fluctuating gas prices on Ethereum. As mentioned in the transaction lifecycle section, Abstract posts state diffs (as well as compressed contract bytecode) to Ethereum in the form of blobs.
In addition to the cost of posting blobs, their are costs associated with generating ZK proofs for batches and committing & verifying these proofs on Ethereum.
To fairly distribute these costs among L2 transactions, gas fees on Abstract are charged proportionally to how close a transaction brought a batch to being sealed (i.e. full).
Components
Fees on Abstract therefore consist of both off-chain and on-chain components:
- Off-chain Fee:
- Fixed cost (approximately $0.001 per transaction).
- Covers L2 state storage and zero-knowledge proof generation.
- Independent of transaction complexity.
- On-chain Fee:
- Variable cost (influenced by Ethereum gas prices).
- Covers proof verification and publishing state on Ethereum.
Differences from Ethereum
Aspect | Ethereum | Abstract |
---|---|---|
Fee Composition | Entirely on-chain, consisting of base fee and priority fee. | Split between off-chain (fixed) and on-chain (variable) components. |
Pricing Model | Dynamic, congestion-based model for base fee. | Fixed off-chain component with a variable on-chain part influenced by Ethereum gas prices. |
Data Efficiency | Publishes full transaction data. | Publishes only state deltas, significantly reducing on-chain data and costs. |
Resource Allocation | Each transaction independently consumes gas. | Transactions share batch overhead, potentially leading to cost optimizations. |
Opcode Pricing | Each opcode has a specific gas cost. | Most opcodes have similar gas costs, simplifying estimation. |
Refund Handling | Limited refund capabilities. | Smarter refund system for unused resources and overpayments. |
Gas Refunds
You may notice that a portion of gas fees are refunded for transactions on Abstract. This
is because accounts don’t have access to the block.baseFee
context variable;
and have no way to know the exact fee to pay for a transaction.
Instead, the following steps occur to refund accounts for any excess funds spent on a transaction:
Block overhead fee deduction
Upfront, the block’s processing overhead cost is deducted.
Gas price calculation
The gas price for the transaction is then calculated according to the EIP-1559 rules.
Gas price calculation
The maximum amount of gas (gas limit) for the transaction is deducted from
the account by having the account typically send tx.maxFeePerErg * tx.ergsLimit
. The transaction is then executed (see transaction
flow).
Gas refund
Since the account may have overpaid for the transaction (as they are sending the maximum fee possible), the bootloader refunds the account any excess funds that were not spent on the transaction.
Transaction Gas Fields
When creating a transaction on Abstract, you can set the gas_per_pubdata_limit
value
to configure the maximum gas price that can be charged per byte of pubdata (data posted to Ethereum in the form of blobs).
The default value for this parameter is 50000
.
Calculate Gas Fees
- Base Fee Determination: When a batch opens, Abstract calculates the FAIR_GAS_PER_PUBDATA_BYTE (EPf):
- Ef is the “fair” gas price in ETH
- L1_P is the price for L1 gas in ETH
- L1_PUB is the number of L1 gas needed for a single pubdata byte
- Overhead Calculation: For each transaction, Abstract calculates several types of overhead:
The total overhead is the maximum of these:
- Slot overhead (SO)
- Memory overhead (MO)
- Execution overhead (EAO)
O(tx) = max(SO, MO(tx), EAO(tx))
- Gas Limit Estimation: When estimating a transaction, the server returns:
- Actual Fee Calculation: The actual fee a user pays is:
- Fair Fee Calculation: Abstract calculates a “fair fee”:
- Refund Calculation: If the actual fee exceeds the fair fee, a refund is issued:
Was this page helpful?