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: 0x3b Introduced: Frontier (EVM genesis) EXTCODESIZE returns the size in bytes of the code stored at a given address.

Specification

Stack Input:
Stack Output:
Gas Cost: Variable (hardfork-dependent)
  • Frontier: 20 gas
  • Tangerine Whistle (EIP-150): 700 gas
  • Berlin (EIP-2929): 2600 gas (cold) / 100 gas (warm)

Behavior

Returns the bytecode length of the account at the given address. Returns 0 for:
  • EOAs (externally owned accounts)
  • Non-existent accounts
  • Contracts during construction (before constructor completes)

Examples

Basic Usage

Contract Detection

Constructor Bypass

Gas Cost

Historical evolution:
HardforkColdWarm
Frontier20-
Tangerine Whistle700-
Berlin2600100

Common Usage

Proxy Implementation Check

Security

Constructor Bypass

During construction, EXTCODESIZE returns 0:

Better Pattern

Use tx.origin check or whitelist:

Implementation

References