Skip to main content
Returns the compiled bytecode stored at a given contract address. Returns "0x" for externally owned accounts (EOAs).

Parameters

address
string
required
The 20-byte address (typically a smart contract).
blockParameter
string
required
Block number in hexadecimal, or a block tag: latest, earliest, pending, safe, or finalized.

Returns

result
string
The bytecode at the address as a hex string. Returns "0x" if there is no code (EOA or self-destructed contract).

Example

{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0x4200000000000000000000000000000000000006",
    "latest"
  ],
  "id": 1
}