eth_estimateL1Fee - Estimate L1 data posting fee
Estimate L1 data posting fee on Linea zkEVM. Essential for understanding transaction costs on the zkEVM rollup.
Estimate L1 data posting fee on the Linea zkEVM network. This method helps calculate the additional cost of posting transaction data to Ethereum L1 as part of Linea's zkEVM rollup architecture.
Overview
Linea zkEVM is a Layer 2 rollup that periodically submits batched transaction data and proofs to Ethereum L1. While most transaction execution happens on L2 with low gas costs, there's an additional fee component for the L1 data availability costs.
Request Parameters
Transaction object to estimate L1 fee for
Response Body
Estimated L1 fee in wei
Implementation Example
curl -X POST https://api-linea-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateL1Fee",
"params": [
{
"from": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb5",
"to": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
"gas": "0x5208",
"gasPrice": "0x3b9aca00",
"value": "0x1bc16d674ec80000",
"data": "0x"
}
],
"id": 1
}'Understanding L1 Fees on Linea
Fee Components
- L2 Execution Fee: Standard gas cost for transaction execution on Linea
- L1 Data Fee: Cost of posting transaction data to Ethereum L1 for data availability
Data Size Impact
L1 fees scale with transaction data size:
- Simple transfers: Minimal L1 fee
- Contract interactions: Moderate L1 fee based on calldata
- Large data payloads: Significant L1 fee component
Cost Optimization Strategies
- Minimize Data: Reduce unnecessary data in transactions
- Batch Operations: Combine multiple operations into single transaction
- Use Events: Emit events instead of storing large data on-chain
- Optimize Encoding: Use efficient data encoding methods
Common Use Cases
1. Transaction Cost Planning
// Plan transaction costs before execution
async function planTransactionCosts(transactions) {
const feeEstimator = new LineaFeeEstimator(rpcUrl);
const plans = [];
for (const tx of transactions) {
const breakdown = await feeEstimator.getFullFeeBreakdown(tx);
plans.push({
transaction: tx,
estimatedCost: breakdown.totalEstimatedCost,
l1FeeRatio: breakdown.breakdown.l1FeePercentage,
recommendation: breakdown.breakdown.l1FeePercentage > 70 ?
'Consider batching or data optimization' : 'Cost efficient'
});
}
return plans.sort((a, b) => a.estimatedCost - b.estimatedCost);
}2. Data Optimization Analysis
def optimize_contract_call_data(base_transaction, data_variations):
"""Find most cost-effective data encoding"""
fee_estimator = LineaFeeEstimator(rpc_url)
results = []
for name, data in data_variations.items():
tx = {**base_transaction, 'data': data}
breakdown = fee_estimator.get_full_fee_breakdown(tx)
results.append({
'encoding': name,
'data_size': len(data) // 2 - 1, # Hex bytes
'total_cost': breakdown['total_estimated_cost'],
'l1_fee': breakdown['l1_fee'],
'efficiency': breakdown['l1_fee'] / (len(data) // 2 - 1)
})
# Sort by total cost
return sorted(results, key=lambda x: x['total_cost'])Related Methods
eth_estimateGas- Estimate L2 execution gaseth_gasPrice- Get current L2 gas priceeth_feeHistory- Historical fee data
Need help? Contact our support team or check the Linea documentation.
eth_coinbase
Check the legacy eth_coinbase compatibility method on Linea. Public endpoints may return an address, `unimplemented`, or another unsupported-method response depending on the client.
rollup_gasPrices - Get zkEVM gas price oracle...
Get zkEVM gas price oracle data on Linea. Essential for understanding gas pricing on the zkEVM rollup.