Ethereum icon

Ethereum

Interact with Ethereum blockchain

Account → Get Code

AI-generated

Summary

Fetch the contract code at a given address.

Inputs

  • address — Ethereum address to query; empty uses the credential's address.
  • blockTag — Block identifier to read code from; defaults to "latest".
  • blockNumber — Specific block number when blockTag is set to "custom".

Output shape

hex-encoded contract bytecode string (or null if no code exists)

If the address has no contract code, the operation returns null; otherwise returns the runtime bytecode as a hex string.

Examples

Example 1: Retrieve code from a known contract using its address

address=0x123abc... , blockTag=latest

Example 2: Get code from a custom block number

address=0xdef456..., blockTag=custom, blockNumber=1234567

Example 3: Use default credential address with latest block

address omitted (uses credential), blockTag=latest

Links

Discussion