Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsLineaLinea-Specific Methods

eth_estimateL1Fee - Estimate L1 data posting fee

Estimate L1 data posting fee on Linea zkEVM. Essential for understanding transaction costs on the zkEVM rollup.

Linea RPC endpoint: endpoint URLs, plans and pricing.

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.

cURL request
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
      }'

Implementation Example

Understanding L1 Fees on Linea

Fee Components

  1. L2 Execution Fee: Standard gas cost for transaction execution on Linea
  2. 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

  1. Minimize Data: Reduce unnecessary data in transactions
  2. Batch Operations: Combine multiple operations into single transaction
  3. Use Events: Emit events instead of storing large data on-chain
  4. Optimize Encoding: Use efficient data encoding methods

Common Use Cases

1. Transaction Cost Planning

JavaScript
// 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

Python
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 gas
  • eth_gasPrice - Get current L2 gas price
  • eth_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.

On this page

OverviewImplementation ExampleUnderstanding L1 Fees on LineaFee ComponentsData Size ImpactCost Optimization StrategiesCommon Use Cases1. Transaction Cost Planning2. Data Optimization AnalysisRelated Methods