eth_getCode
Retrieve the deployed bytecode of any smart contract using its address. Works across 30+ Ethereum networks via Infura.
Instructions
Get the deployed bytecode of a smart contract.
Args:
contractAddress (string): Contract address (20-byte hex, e.g., '0x...').
network (string, optional): Ethereum network to query. Defaults to 'mainnet'.
Returns:
Hexadecimal string containing the contract bytecode. Returns '0x' if address is not a contract or has no code.
Examples:
"Get USDT contract code": { "contractAddress": "0xdAC17F958D2ee523a2206206994597C13D831ec7" }
"Check Sepolia contract": { "contractAddress": "0x...", "network": "sepolia" }
Errors:
InvalidParams: When contractAddress format is invalid.
InternalError: When Infura API is unavailable or returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contractAddress | Yes | The 20-byte contract address to retrieve the code from. | |
| network | No | The Ethereum network to connect to (e.g., 'mainnet' or 'sepolia'). | mainnet |
| response_format | No | Output format: 'json' for structured data, 'markdown' for human-readable. | json |