EIPs Explained

EIP-7825 · Final · Core · 2024-11-23

EIP-7825: Transaction Gas Limit Cap

Caps the gas limit of any single transaction at 16,777,216 (2^24), independent of the block gas limit, so no one transaction can monopolize a block as block limits rise.

What problem does it solve?

Before this change, a transaction could set its gas limit as high as the whole block gas limit. As Ethereum raises block gas limits, that means one transaction could consume an ever larger, unbounded amount of work. The spec highlights three risks:

  • DoS: a single huge transaction concentrates load and can stall block validation.
  • State growth: very large transactions tend to make large state changes.
  • Validation time: long-running transactions slow block verification, which hurts smaller nodes and decentralization.

Putting a fixed ceiling on each transaction keeps worst-case per-transaction work predictable even as block gas limits are raised.

How it works

  • There is a protocol-level maximum of 16,777,216 gas (2^24) per transaction.
  • Mempool: a transaction whose gasLimit exceeds the cap is invalid and is not accepted into the txpool.
  • Blocks: a block containing any transaction with gasLimit above the cap is invalid.
  • The cap is independent of the block gas limit, which stays well above it. Blocks still hold many transactions; each one is simply bounded.

The value was chosen as a clean power of two that is still large enough for contract deployments and complex DeFi interactions. The check is on the declared gasLimit, not on gas actually used, so a transaction that would use only 1M gas but declares 20M is rejected.

EIP-7825 shipped in the Fusaka upgrade (EIP-7607), which activated on mainnet on 2025-12-03.

Sample code

Clamp gas limits in your own tooling so transactions are not rejected (ethers v6):

import { JsonRpcProvider, Wallet } from "ethers";

const TX_GAS_LIMIT_CAP = 16_777_216n; // 2^24, EIP-7825

const provider = new JsonRpcProvider(process.env.RPC_URL);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);

const req = { to: target, data: calldata };
const estimate = await provider.estimateGas({ ...req, from: wallet.address });
const padded = (estimate * 12n) / 10n;   // 20% headroom

if (estimate > TX_GAS_LIMIT_CAP) {
  throw new Error("Operation too large for one transaction; split it up");
}
const gasLimit = padded > TX_GAS_LIMIT_CAP ? TX_GAS_LIMIT_CAP : padded;

await wallet.sendTransaction({ ...req, gasLimit });

Things to know

  • Status is Final and the rule is live on mainnet.
  • Most transactions are far below the cap, but very large contract deployments, big batch operations or heavy one-shot migrations may need to be split across several transactions.
  • Watch for tools that set a fixed high default gas limit (for example 30M): those transactions are now rejected even if they would use little gas.
  • Contract code size limits still apply separately; this cap only bounds gas.
  • Fusaka also raised the default block gas limit to 60M (EIP-7935), more than three times the per-transaction cap.

#gas #transactions #dos #core #fusaka

Details

Authors
Giulio Rebuffo (@Giulio2002), Toni Wahrstätter (@nerolation)
Status
Final
Type
Standards Track / Core
Created
2024-11-23
Required by

Machine-readable: Markdown · JSON