Docs
Supported ChainsMantleMantle-Specific Methods

eth_estimateL1Fee - Estimate L1 data posting fee

Estimate L1 data posting fee on Mantle Network. Essential for understanding transaction costs on the modular L2 rollup.

Estimate L1 data posting fee on the Mantle network. This method helps calculate the additional cost of posting transaction data to Ethereum L1 via EigenDA as part of Mantle's modular L2 architecture.

Overview

Mantle's modular L2 is an optimistic rollup that periodically submits batched transaction data to Ethereum L1 through EigenDA for data availability. While most transaction execution happens on L2 with low gas costs paid in MNT, there's an additional fee component for the L1 data availability costs.

Request Parameters

Request
transactionObject

Transaction object to estimate L1 fee for

Response Body

Response
resultQUANTITY

Estimated L1 fee in wei

Implementation Example

Bash
curl -X POST https://api-mantle-mainnet.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 Mantle

Fee Components

  1. L2 Execution Fee: Standard gas cost for transaction execution on Mantle (paid in MNT)
  2. L1 Data Fee: Cost of posting transaction data to Ethereum L1 via EigenDA 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
  5. Leverage EigenDA: Benefit from efficient data availability

Common Use Cases

1. Transaction Cost Planning

JavaScript
// Plan transaction costs before execution
async function planTransactionCosts(transactions) {
  const feeEstimator = new MantleFeeEstimator(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 = MantleFeeEstimator(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'])

Need help? Contact our support team or check the Mantle documentation.