Skip to main content
Returns the compiled bytecode at a given address. Returns "0x" for externally owned accounts (EOAs).
Flashblocks: Query https://mainnet-preconf.base.org with "pending" to detect contract deployments before the block seals.

Parameters

address
string
required
The 20-byte address to query.
block
string
required
Block number in hex, or "latest", "pending", "safe", "finalized", "earliest".

Returns

result
string
The bytecode at the address as a hex string. "0x" if there is no code.

Example

curl https://mainnet.base.org \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getCode",
    "params": ["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "latest"],
    "id": 1
  }'