Opcode Summary

PropertyValue
Opcode0x48
MnemonicBASEFEE
Gas2
Stack Input(none)
Stack Outputblock.basefee (uint256, current block’s base fee in wei)
BehaviorPushes the base fee of the current block onto the stack. Introduced in EIP-1559 (London fork, August 2021) alongside EIP-3198, which added this opcode so contracts can read the base fee on-chain. The base fee is algorithmically derived from the parent block’s gas usage: if the parent used more than the target gas (15M), the base fee increases by up to 12.5%; if less, it decreases by up to 12.5%. The base fee portion of transaction fees is burned (sent to address(0)) rather than paid to the validator.

Threat Surface

BASEFEE exposes the current block’s base fee to smart contract execution. Unlike validator-controlled values like COINBASE or TIMESTAMP, the base fee is deterministic — it is computed algorithmically from the parent block’s gas usage and cannot be directly set by the block proposer. This determinism makes BASEFEE highly predictable, which is both its strength (reliable gas market signal) and its weakness (exploitable when used for logic that assumes unpredictability).

The threat surface centers on three properties:

  1. BASEFEE is fully predictable. Given the parent block’s gas used and its base fee, the next block’s base fee is a deterministic calculation. Anyone — validators, MEV searchers, external observers — can compute the exact base fee for the next block before it is produced. Contracts that use block.basefee for entropy, time-gating, or conditional logic are exploitable because every participant can predict the value. MEV searchers routinely predict base fees 5+ blocks ahead with >99% accuracy using machine learning models.

  2. BASEFEE can be manipulated via block stuffing or emptying. While no single actor directly sets the base fee, validators and coordinated actors can influence it by controlling block fullness. Filling blocks to the 30M gas limit drives the base fee up (12.5% per block, compounding); producing empty blocks drives it down. Research from Protocol Labs (2023) demonstrates that miners with less than 50% of mining power can profitably manipulate the base fee, contradicting EIP-1559’s original incentive-compatibility assumptions.

  3. Gas-price-dependent contract logic creates MEV and griefing opportunities. Contracts that use block.basefee to gate access, compute fees, determine timeouts, or adjust parameters create attack surfaces where adversaries manipulate the base fee to trigger favorable conditions. A validator who stuffs blocks to spike the base fee can cause base-fee-dependent contracts to enter error states, deny service, or trigger liquidations.


Smart Contract Threats

T1: Base Fee Manipulation via Block Stuffing / Emptying (High)

The base fee update rule is: new_base_fee = parent_base_fee * (1 + 1/8 * (parent_gas_used - target_gas) / target_gas). An adversary who can influence block fullness can steer the base fee in a predictable direction:

  • Block stuffing to spike the base fee. Filling consecutive blocks to 30M gas (2x the 15M target) increases the base fee by 12.5% per block. Six full blocks roughly double the base fee. An attacker sending high-priority transactions that consume the entire block gas limit can spike the base fee within minutes. The cost is the transaction fees paid, but if the attacker profits from a base-fee-dependent contract more than they spend on stuffing, the attack is profitable.

  • Empty blocks to crash the base fee. A validator who proposes empty blocks (or blocks with only their own minimal transactions) decreases the base fee by up to 12.5% per block. This is harder to sustain because it requires colluding validators or a single validator who happens to propose consecutive blocks. However, Protocol Labs research (DISC 2023) proves this is economically rational for validators with less than 50% stake under certain conditions.

  • Targeted manipulation around contract triggers. If a contract has a threshold like require(block.basefee < 100 gwei), an adversary can time their actions to coincide with natural base fee fluctuations or actively stuff/empty blocks to cross the threshold. The predictability of the base fee update formula means the attacker knows exactly how many blocks of manipulation are needed.

Why it matters: Any contract whose behavior depends on block.basefee crossing a threshold is vulnerable to an adversary with moderate capital and validator access. The cost of base fee manipulation scales linearly with the number of blocks needed, while the attacker’s profit from the contract exploit may be non-linear.

T2: Using Base Fee for Randomness or Unpredictable Values (Critical)

block.basefee is completely deterministic given the parent block state. Using it as a source of entropy is fundamentally broken:

  • Deterministic from parent block. The base fee for block N is calculable from block N-1’s gas used and base fee. Every network participant — validators, searchers, users — can compute it before block N is produced. Combining block.basefee with other predictable values (block.timestamp, block.number, block.coinbase) does not increase entropy; the block proposer knows all of these values.

  • Predictable multiple blocks ahead. Base fee prediction models (e.g., Blocknative) achieve 99% accuracy for 5-block-ahead forecasts. Even without sophisticated models, the base fee changes by at most 12.5% per block, making the range of possible values extremely narrow. An attacker can enumerate all possible base fee values for the next several blocks and choose to act only when the outcome is favorable.

  • Static on low-activity chains. On L2s and low-traffic chains where blocks are consistently below the gas target, the base fee converges to its minimum value and changes infrequently, making it effectively a constant.

Why it matters: Any randomness, lottery, or selection mechanism that includes block.basefee in its entropy calculation is riggable by anyone who can observe the parent block — which is every network participant.

T3: Gas Cost Estimation That Breaks During Spikes (High)

Contracts that compute fees, refunds, or cost estimates using block.basefee can malfunction during periods of high network congestion:

  • Hardcoded base fee assumptions. A contract that estimates gas costs as block.basefee * gasAmount and compares against a fixed budget will fail when the base fee spikes. During the Yuga Labs Otherside NFT mint (May 2022), gas fees exceeded 8,000 gwei — a contract assuming a 30 gwei base fee would underestimate costs by 266x.

  • Insufficient fee collection. Relay contracts, meta-transaction forwarders, or gas abstraction layers that read block.basefee to determine how much to charge users may undercharge if the base fee increases between the user’s signature and the transaction’s inclusion. The base fee can increase by 12.5% per block, so a 10-block delay can mean a 230% increase.

  • Reverts from arithmetic overflow or underflow. Contracts computing tx.gasprice - block.basefee to derive the priority fee will revert if block.basefee > tx.gasprice (possible in edge cases with legacy transactions or misconfigured RPC calls). The go-ethereum client specifically patched this by setting basefee to 0 internally during eth_call to avoid simulation failures.

  • Gas token or gas futures mispricing. Protocols that issue tokens or derivatives based on gas prices may use block.basefee as an oracle. A sudden base fee spike can cause these instruments to become mispriced, enabling arbitrage at the protocol’s expense.

Why it matters: The base fee can spike 10-100x during congestion events (NFT mints, airdrops, protocol launches). Contracts that assume a stable base fee or compute fees using block.basefee at execution time without bounds checking will fail catastrophically during these events.

T4: Priority Fee Extraction and MEV via Base Fee Awareness (Medium)

MEV searchers use block.basefee to optimize their bidding strategy. Contracts that expose the priority fee (effective tip) create extraction opportunities:

  • Priority fee calculation reveals willingness to pay. The priority fee is tx.gasprice - block.basefee (for EIP-1559 transactions: min(maxPriorityFeePerGas, maxFeePerGas - block.basefee)). A contract that reads block.basefee and computes the effective tip can expose information about transaction urgency, enabling more efficient MEV extraction.

  • Gas price arbitrage across blocks. Searchers who predict the base fee for the next block can submit transactions with precisely calibrated maxFeePerGas to minimize overpayment while ensuring inclusion. Contracts that use block.basefee to set dynamic fees (e.g., Dutch auctions that decrease price based on gas cost) can be sniped by searchers who wait for a base fee drop to minimize their cost.

  • Validator collusion for base fee steering. If a validator knows that a high-value contract action triggers when block.basefee crosses a threshold, they can coordinate with other validators to stuff or empty blocks, then include their own transaction in the block where the threshold is crossed.

Why it matters: block.basefee is a public signal of network congestion. Contracts that incorporate it into economic logic (pricing, auctions, fee calculations) give sophisticated actors — searchers and validators — an information advantage over regular users.

T5: Base Fee Dependent Access Control (Critical)

Using block.basefee to gate access or restrict functionality is exploitable by any actor who can influence block fullness:

  • Gas-price-based function gating. A contract that uses require(block.basefee < threshold) to restrict operations to “low congestion” periods hands control to anyone who can stuff or empty blocks. A validator can empty their proposed blocks to lower the base fee, then include their privileged transaction in the same low-base-fee block.

  • Emergency shutdown triggers. Protocols that automatically pause when block.basefee > panicThreshold (interpreting high gas as a sign of an exploit) can be griefed by an attacker who stuffs blocks to spike the base fee, triggering the pause mechanism and denying service to all users.

  • Tiered access based on gas conditions. Contracts offering different functionality tiers based on block.basefee (e.g., “only allow large withdrawals when gas is cheap”) create a predictable window for attackers. They can wait for or engineer a base fee below the threshold and execute privileged operations.

Why it matters: Base fee thresholds are public, the base fee is predictable, and block fullness is influenceable. Any access control mechanism that depends on block.basefee provides zero security guarantees against a motivated adversary.


Protocol-Level Threats

P1: Base Fee Manipulation Economics (Medium)

The EIP-1559 base fee mechanism was designed to be incentive-compatible — honest behavior should be optimal for rational validators. However, academic research has challenged this assumption:

  • Sub-50% manipulation is profitable. Protocol Labs (DISC 2023) proved that validators with less than 50% of stake can profitably deviate from honest behavior by proposing empty blocks to lower the base fee for their own future transactions. The original EIP-1559 analysis assumed only >50% coalitions could profit from manipulation.

  • Coordination is not required for exploitation. Even without explicit collusion, rational validators may independently choose to join a base fee manipulation attack once it begins, because the expected payoff increases as more validators participate. This creates a coordination game where the honest equilibrium is not unique.

  • Novel congestion attacks persist post-EIP-1559. A 2024 study (hal-04518061) demonstrates attack strategies where adversaries can cause prolonged congestion without triggering the exponential base fee increase that was supposed to make sustained attacks prohibitively expensive.

P2: MEV and Base Fee Interaction (Medium)

The base fee interacts with MEV extraction in nuanced ways:

  • Base fee burn reduces MEV competition. Under EIP-1559, the base fee is burned rather than paid to validators. This means validators compete for the priority fee (tip), not the full gas price. Searchers must calibrate their bids against the priority fee, and the base fee sets the floor for transaction inclusion. This makes MEV extraction more sensitive to base fee fluctuations.

  • Base fee prediction is an MEV advantage. Searchers and builders who accurately predict future base fees can submit more efficiently priced transactions, outcompeting less sophisticated actors. Blocknative’s prediction API achieves 99% accuracy for next-block base fee estimation, giving subscribers a measurable edge.

  • PBS interaction. Under Proposer-Builder Separation (MEV-Boost), builders construct blocks and set the transaction ordering. Builders know the exact base fee of the block they are constructing and can optimize their own transaction inclusion accordingly. The base fee is not a surprise to anyone involved in block construction.

P3: EIP-1559 Burn Mechanism and Economic Attacks (Low)

The base fee burn mechanism (sending base_fee * gas_used to address(0) per transaction) has protocol-level implications:

  • Deflationary pressure manipulation. During high-congestion periods, the burn rate can exceed ETH issuance, making ETH temporarily deflationary. An attacker who holds large ETH positions could profit from engineering congestion spikes (via block stuffing) that increase the burn rate and reduce circulating supply, though the cost of sustained block stuffing makes this economically questionable for direct profit.

  • Burn-related accounting in L2s. L2s that implement EIP-1559 locally may have different burn destinations or may not burn at all (some redirect the base fee to a sequencer or treasury). Contracts that assume the L1 burn behavior (ETH sent to address(0)) may have incorrect economic assumptions on L2s.


Edge Cases

Edge CaseBehaviorSecurity Implication
Base fee = 0 (some L2s or testnets)BASEFEE returns 0 when the chain has no minimum base fee or during genesis/initial blockstx.gasprice - block.basefee equals tx.gasprice; division by block.basefee causes a revert (divide by zero); contracts using base fee as a denominator must guard against zero
Very high base fee during congestionDuring events like the Yuga Labs mint (May 2022), base fee exceeded 8,000 gweiContracts computing costs as block.basefee * gasAmount may overflow uint256 in extreme cases (though practically unlikely); fee estimation contracts will severely undercharge
Base fee on OP Stack L2s (Optimism, Base)EIP-1559 is implemented with different parameters; Base enforces a minimum of 0.005 gwei (5M wei) since Jovian upgradeBase fee fluctuates differently than L1; contracts assuming L1 base fee ranges will misjudge gas economics on L2
Base fee on ArbitrumConfigurable via ArbOwner.setMinimumL2BaseFee(); minimum base fee is chain-operator controlledCentralized sequencer can adjust the minimum base fee, changing contract behavior without on-chain governance
BASEFEE in STATICCALLReturns the same block.basefee value as in normal execution contextNo special behavior; BASEFEE is read-only by nature and is unaffected by static context restrictions
BASEFEE in DELEGATECALLReturns the same block.basefee as the parent context (block-level, not call-level)No change across delegatecall boundaries; BASEFEE is a block property
BASEFEE pre-London (historical blocks)BASEFEE opcode does not exist; execution reverts with invalid opcodeContracts compiled for London+ that use block.basefee will fail if deployed to or called on pre-London chains or forks
Maximum base fee increase+12.5% per block when parent block is 100% full (30M gas)Six consecutive full blocks roughly double the base fee; twelve blocks quadruple it. Spikes are fast but bounded.
Maximum base fee decrease-12.5% per block when parent block is empty (0 gas used)Recovery from spikes is slower than the spike itself because the decrease is applied to the (already lower) current value, not the peak
BASEFEE during eth_call simulationSome clients set base fee to 0 internally to prevent reverts during simulationContracts behave differently in simulation vs. on-chain execution; tx.gasprice - block.basefee succeeds in simulation but may revert on-chain

Real-World Exploits

Exploit 1: Fomo3D Block Stuffing — Base Fee Manipulation Avant la Lettre (~$3M, August 2018)

Root cause: An attacker filled consecutive blocks with gas-consuming transactions to prevent other players’ transactions from being included, effectively controlling block fullness and indirectly manipulating gas price dynamics.

Details: Fomo3D was an Ethereum gambling game where the last player to buy a “key” before a countdown timer expired won the pot (~10,469 ETH). The attacker deployed contracts that burned gas via assert() failures, filling 17 consecutive blocks (blocks 6191896-6191909, ~175 seconds) with high-fee junk transactions. This prevented other players from buying keys and resetting the timer. The attacker paid ~3M — a 30,000% ROI.

While this attack predates EIP-1559 (and thus the BASEFEE opcode), it is the canonical example of block stuffing — the same technique that would manipulate block.basefee post-London. Under EIP-1559, the attacker’s block-stuffing would have spiked the base fee by 12.5% per block, making continued stuffing exponentially more expensive. EIP-1559’s fee mechanism was explicitly designed to make sustained block stuffing uneconomical, though academic research has since shown it does not fully eliminate the incentive.

BASEFEE’s relevance: Post-EIP-1559, any contract that gates logic on block.basefee (e.g., “only allow action when gas is cheap”) is vulnerable to the same block-stuffing strategy. The attacker fills blocks to spike the base fee (or empties them to lower it), then exploits the contract when the threshold is crossed.

Impact: ~$3M stolen. Established block stuffing as a viable attack vector against any contract logic sensitive to block fullness or gas prices.

References:


Exploit 2: Yuga Labs Otherside Mint — Base Fee Spike Causes $4M+ in Failed Transactions (May 2022)

Root cause: Unprecedented demand for Bored Ape Yacht Club’s Otherside NFT mint caused the base fee to spike above 8,000 gwei, causing widespread transaction failures and gas waste.

Details: On May 1, 2022, Yuga Labs launched the Otherside metaverse land sale, selling 55,000 NFTs at ~4M+ in irretrievable gas fees (base fee is burned even on reverts). Total gas expenditure exceeded $123M. The Ethereum network was effectively unusable for hours, crashing Etherscan and slowing Uniswap and other DeFi protocols.

The minting contract lacked gas-efficient patterns (no batch minting, no merkle-tree allowlists), amplifying the per-transaction gas cost. Users who set maxFeePerGas based on the base fee at transaction submission found their transactions stuck or failing as the base fee increased 12.5% per block during the surge.

BASEFEE’s role: The EIP-1559 base fee mechanism amplified the crisis by its design — as demand filled blocks, the base fee increased exponentially (12.5% compounding per block). Contracts or wallets that estimated gas costs using block.basefee at submission time were stale by the time the transaction was included. Any contract computing fees as block.basefee * gasAmount would have severely undercharged during the spike.

Impact: 123M+ total gas costs. Network-wide denial of service for hours. $157M in ETH burned via the EIP-1559 mechanism during the event.

References:


Exploit 3: Blob Base Fee Inversion — L2s Overpay ~$550K During Arbitrum Airdrop (June 2024)

Root cause: A sudden demand spike for EIP-4844 blob space caused the blob base fee to spike to 8,000 gwei, inverting the cost ratio between blob data and calldata. L2s that did not dynamically switch to calldata overpaid by ~166 ETH.

Details: On June 20, 2024, the Arbitrum LayerZero airdrop triggered a transaction surge that doubled Arbitrum’s batch submissions to Ethereum (from ~20 to ~40 per 100 blocks). This consumed blob space faster than the blob base fee mechanism could adjust, spiking blob fees to 8,000 gwei — a “blob inversion” where posting data as blobs became more expensive than using calldata. The event lasted approximately 350 blocks (~70 minutes).

L2s collectively overpaid approximately 166 ETH (~$550,000). Arbitrum and Optimism had implemented dynamic switching between blob and calldata posting, but not all L2s adapted in time. The blob base fee uses the same exponential adjustment mechanism as EIP-1559’s base fee (though with different parameters), making it similarly vulnerable to demand spikes.

BASEFEE’s relevance: While this incident involved the blob base fee (BLOBBASEFEE, opcode 0x4A) rather than the execution base fee (BASEFEE, 0x48), the underlying mechanism is identical — an algorithmically derived fee that adjusts based on demand. The exploit pattern applies equally to any contract that makes economic decisions based on block.basefee: rapid fee spikes can cause cost estimates to become stale, contracts to overpay, or fee-dependent logic to malfunction.

Impact: ~$550K in L2 overpayments. Demonstrated that even protocol-level actors (L2 batch posters) can be caught off guard by base-fee-style mechanism spikes.

References:


Exploit 4: Base Fee Manipulation Research — Protocol Labs Proof of Sub-50% Attack (2023)

Root cause: Academic proof that EIP-1559’s base fee mechanism is not incentive-compatible for all rational validators, overturning a core security assumption of the fee market design.

Details: Researchers from Protocol Labs, Ethereum Foundation, and Columbia University published a formal analysis (DISC 2023) proving that validators with less than 50% of mining/staking power can profitably manipulate the base fee. The attack strategy involves proposing empty blocks to lower the base fee, then including high-value transactions in subsequent blocks at the reduced rate. The profit comes from the difference between the honest base fee and the manipulated (lower) base fee across the attacker’s future transactions.

The paper also showed that this manipulation does not require explicit coordination — under game-theoretic analysis, smaller validators may rationally join an ongoing manipulation attack because the expected payoff increases with participation. This creates a coordination game where honest behavior is not a unique Nash equilibrium.

A follow-up study (2024, hal-04518061) demonstrated novel congestion attack strategies that circumvent EIP-1559’s exponential cost increase, allowing prolonged congestion without the attacker paying exponentially increasing fees.

BASEFEE’s role: The BASEFEE opcode exposes the result of this manipulable mechanism to smart contracts. Any contract that reads block.basefee and makes economic or access-control decisions based on it is transitively vulnerable to the base fee manipulation attacks described in this research.

Impact: No direct financial loss (academic research), but overturned the security assumption underpinning EIP-1559’s fee market design. Any protocol or contract relying on the base fee being “honest” or “market-reflective” must account for the possibility of manipulation.

References:


Attack Scenarios

Scenario A: Block Stuffing to Trigger Base Fee Dependent Emergency Pause

// Vulnerable: Protocol pauses when base fee indicates "extreme congestion"
contract VulnerableVault {
    bool public paused;
    uint256 public constant PANIC_BASE_FEE = 200 gwei;
 
    modifier whenNotPaused() {
        if (block.basefee > PANIC_BASE_FEE) {
            paused = true;
        }
        require(!paused, "paused");
        _;
    }
 
    function withdraw(uint256 amount) external whenNotPaused {
        // ... process withdrawal
    }
 
    function unpause() external {
        require(block.basefee < PANIC_BASE_FEE / 2, "still congested");
        paused = false;
    }
}
 
// Attack: Attacker stuffs ~20 blocks to spike base fee from 30 gwei to >200 gwei.
// Cost: ~20 blocks * 30M gas * escalating base fee ≈ tens of ETH.
// Effect: Vault pauses, all withdrawals blocked. Attacker can exploit
// this in a composable attack (e.g., liquidate positions that depend
// on withdrawing from this vault). Unpausing requires base fee to drop
// to <100 gwei, which the attacker can delay by continued stuffing.

Scenario B: Base Fee as Broken Randomness

contract VulnerableLottery {
    address[] public players;
 
    function enter() external payable {
        require(msg.value == 0.1 ether);
        players.push(msg.sender);
    }
 
    function draw() external {
        require(players.length >= 10);
 
        // VULNERABLE: block.basefee is deterministic from the parent block.
        // Every network participant can compute the exact value before
        // the block is produced. Combined with block.timestamp and
        // block.number, the entire seed is predictable.
        uint256 seed = uint256(keccak256(abi.encodePacked(
            block.basefee,
            block.timestamp,
            block.number
        )));
        uint256 winnerIndex = seed % players.length;
 
        payable(players[winnerIndex]).transfer(address(this).balance);
        delete players;
    }
 
    // Attack: Attacker enters the lottery, then waits for a block where
    // the precomputed seed selects their index. Since block.basefee is
    // known from the parent block, block.number is sequential, and
    // block.timestamp is predictable within a 12-second slot, the
    // attacker can compute the winner for every upcoming block and
    // call draw() only when they win.
}

Scenario C: Gas Fee Estimation Failure During Base Fee Spike

// Meta-transaction forwarder that charges users based on current base fee
contract VulnerableForwarder {
    mapping(address => uint256) public deposits;
 
    function relay(
        address target,
        bytes calldata data,
        address user
    ) external {
        uint256 gasBefore = gasleft();
 
        (bool success,) = target.call(data);
        require(success, "call failed");
 
        uint256 gasUsed = gasBefore - gasleft();
        // VULNERABLE: Charges based on block.basefee at execution time,
        // but the user signed the meta-tx when base fee was lower.
        // If base fee spikes between signature and inclusion, the user
        // is overcharged. If the forwarder caps charges at the user's
        // signed maxFee, the forwarder absorbs the loss.
        uint256 cost = gasUsed * block.basefee;
        require(deposits[user] >= cost, "insufficient deposit");
        deposits[user] -= cost;
    }
 
    // Scenario: User signs meta-tx when base fee is 30 gwei.
    // An NFT mint causes base fee to spike to 500 gwei before inclusion.
    // Cost is 16.7x higher than expected. Either the user's deposit is
    // drained or the relay reverts, denying service.
}

Scenario D: Base Fee Threshold Access Control Bypass

// Vulnerable: Uses base fee to restrict expensive operations to off-peak hours
contract VulnerableGovernance {
    mapping(uint256 => uint256) public votes;
 
    function executeProposal(uint256 proposalId) external {
        // VULNERABLE: Intended to prevent execution during congestion.
        // A validator can propose an empty block (lowering base fee)
        // and include their executeProposal() call in it.
        require(
            block.basefee < 50 gwei,
            "network too congested for execution"
        );
        require(votes[proposalId] > quorum(), "quorum not met");
        _execute(proposalId);
    }
 
    function quorum() public pure returns (uint256) { return 100; }
    function _execute(uint256) internal { /* ... */ }
 
    // Attack: Adversary wants to execute a proposal during high congestion
    // (when honest governance participants assume it won't execute).
    // They collude with a validator who proposes a block with minimal
    // transactions, dropping base fee below 50 gwei for one block.
    // The adversary's executeProposal() tx is included in that block.
}

Mitigations

ThreatMitigationImplementation
T1: Block stuffing / emptyingUse time-weighted or multi-block base fee averages instead of single-block readsCompute avgBaseFee over the last N blocks using a sliding window; do not rely on a single block.basefee read for critical decisions
T1: Base fee threshold manipulationAdd hysteresis to threshold-based logicRequire the base fee to stay above/below a threshold for multiple consecutive blocks before triggering state changes
T2: Base fee for randomnessUse verifiable randomness (Chainlink VRF) or commit-revealChainlink VRF v2+ for provably fair randomness; never include block.basefee in entropy calculations
T3: Gas estimation failuresImplement bounds checking and fallback pricinguint256 effectiveBaseFee = block.basefee > MAX_EXPECTED ? MAX_EXPECTED : block.basefee; set reasonable upper and lower bounds for fee calculations
T3: Stale base fee in meta-transactionsInclude a maxBaseFee parameter in signed messagesUser signs maxBaseFee; relay checks require(block.basefee <= maxBaseFee) and reverts if base fee has spiked beyond the user’s tolerance
T4: Priority fee extractionAvoid exposing priority fee calculations on-chainDo not compute or store tx.gasprice - block.basefee in contract storage; keep fee logic off-chain where possible
T5: Base fee access controlNever use block.basefee for access controlReplace with msg.sender-based access control, role-based permissions (OpenZeppelin AccessControl), or time-based restrictions (block.timestamp with multi-block averaging)
T5: Emergency pause griefingUse multi-sig or governance-controlled pause, not automatic base fee triggersRequire human intervention (multi-sig) for pause/unpause; if automatic, use multiple signals (not just base fee) and require sustained conditions
General: Division by base feeGuard against zero base feerequire(block.basefee > 0) before any division; handle the zero case explicitly for L2 compatibility
General: Cross-chain base fee divergenceAbstract base fee access behind a chain-aware wrapperCheck block.chainid and apply chain-specific minimum/maximum bounds; test on all target chains

EIP/Compiler-Based Protections

  • EIP-1559 (London, August 2021): Introduced the base fee mechanism and the fee burn. The 12.5% per-block adjustment rate was designed to make sustained block stuffing exponentially expensive, providing partial mitigation against T1.
  • EIP-3198 (London, August 2021): Added the BASEFEE opcode so contracts can read the base fee. The EIP notes “no known security implications” because the value is publicly available in block headers, but on-chain access enables the contract-level threats described in T1-T5.
  • EIP-4844 (Dencun, March 2024): Introduced blob transactions with a separate blob base fee mechanism. The BLOBBASEFEE opcode (0x4A) exposes this value. Same manipulation concerns apply to blob base fee as to execution base fee.
  • Solidity >= 0.8.7: Supports block.basefee natively. Arithmetic operations on block.basefee benefit from Solidity 0.8.x’s built-in overflow/underflow checks.
  • Chainlink VRF v2+: Eliminates the need to use any block-level variable for randomness, fully mitigating T2.

Severity Summary

Threat IDCategorySeverityLikelihoodReal-World Precedent
T1Smart ContractHighMediumFomo3D block stuffing ($3M); Protocol Labs manipulation proof (2023)
T2Smart ContractCriticalHighOn-chain gambling exploits (2017-2019); deterministic from parent block
T3Smart ContractHighHighYuga Labs Otherside mint (550K L2 overpayment)
T4Smart ContractMediumMediumMEV searcher base fee prediction (Blocknative 99% accuracy)
T5Smart ContractCriticalMediumNo single large exploit, but trivially exploitable by validators or via block stuffing
P1ProtocolMediumLowProtocol Labs formal proof; novel congestion attack strategies (2024)
P2ProtocolMediumMediumMEV-Boost ecosystem; Blocknative prediction API
P3ProtocolLowLowEIP-1559 burn economics; theoretical ETH supply manipulation

OpcodeRelationship
GASPRICE (0x3A)Returns the effective gas price of the current transaction (tx.gasprice). The priority fee (tip to the validator) is GASPRICE - BASEFEE. Contracts computing priority fees must handle the case where GASPRICE < BASEFEE (possible in simulations).
GASLIMIT (0x45)Returns the gas limit of the current block. The base fee adjustment depends on how much of the block gas limit was used. A full block (gas used gas limit 30M) increases base fee by 12.5%; an empty block decreases it by 12.5%.
BLOBBASEFEE (0x4A)Returns the blob base fee (EIP-4844, Dencun fork). Uses the same exponential adjustment mechanism as the execution base fee but for blob data. Vulnerable to the same demand-spike and manipulation patterns. The June 2024 blob inversion demonstrates the shared risk model.
COINBASE (0x41)Returns the block proposer’s fee recipient address. BASEFEE determines how much of the gas price is burned vs. paid as priority fee to COINBASE. Validators receive (tx.gasprice - block.basefee) * gasUsed as priority fee, while block.basefee * gasUsed is burned.
PREVRANDAO (0x44)Returns the previous block’s RANDAO mix. Provides significantly better entropy than BASEFEE (which is fully deterministic) but is still biasable by the proposer. For randomness needs, PREVRANDAO is preferable to BASEFEE but Chainlink VRF is the gold standard.
NUMBER (0x43)Returns the current block number. Combined with BASEFEE, enables on-chain base fee history tracking. Both are block-level properties that are deterministic and publicly known before block finalization.