Skip to main content
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.

Overview

Opcode: 0x48 Introduced: London (EIP-3198, part of EIP-1559) BASEFEE retrieves the base fee per gas for the current block. This is a core component of EIP-1559’s fee market mechanism, representing the minimum gas price that must be paid for transaction inclusion.

Specification

Stack Input:
Stack Output:
Gas Cost: 2 (GasQuickStep) Operation:
Hardfork: Available from London onwards (EIP-1559)

Behavior

BASEFEE pushes the base fee per gas onto the stack as a 256-bit unsigned integer in wei:
The base fee adjusts dynamically based on block utilization:
  • Block full: Base fee increases by 12.5%
  • Block empty: Base fee decreases by 12.5%
  • Block 50% full: Base fee stays constant

Examples

Basic Usage

Pre-London Error

Fee Calculations

Priority Fee Calculation

Gas Cost

Cost: 2 gas (GasQuickStep) BASEFEE is one of the cheapest operations, enabling efficient fee market interaction. Comparison:
  • BASEFEE: 2 gas
  • GASPRICE (0x3A): 2 gas
  • GASLIMIT: 2 gas
  • TIMESTAMP: 2 gas

Common Usage

Dynamic Fee Adjustment

Fee Threshold Guards

Congestion Detection

Gas Refund Calculations

Fee Market Analytics

Security Considerations

Base Fee Manipulation

Validators cannot directly manipulate base fee (algorithmic adjustment):

Fee Volatility

Base fee can change significantly between blocks:

Transaction Priority

Base fee doesn’t guarantee inclusion priority:

Pre-London Compatibility

Contracts must handle pre-London networks:

EIP-1559 Fee Mechanism

Fee Components

Base Fee Adjustment Algorithm

Implementation

Edge Cases

Pre-London Execution

Zero Base Fee

Extreme Network Congestion

Initial London Block

Historical Context

Pre-London (Legacy)

Post-London (EIP-1559)

Benchmarks

Performance:
  • Hardfork check: O(1)
  • Stack push: O(1)
Gas efficiency:
  • 2 gas per query
  • ~500,000 queries per million gas

References