eth_getCodeByHash
Returns the contract bytecode associated with a given code hash (the keccak256 hash of the bytecode). Unlike eth_getCode, which looks up code via an account address at a specific block, this method resolves code directly from its hash, letting callers deduplicate bytecode fetches when multiple accounts share the same implementation (e.g., minimal proxies, upgradeable proxies, EIP-7702 delegators). Used by MegaETH's stateless validator to fetch witness-referenced contract code on demand.
Path Parameters
stringrequireddefaults to
docs-demoFor higher throughput, create your own API key
Request
string
format: "^0x[0-9a-f]{64}$"requiredThe 32-byte keccak256 hash of the contract bytecode (codeHash field from an account).
Responses
200
The bytecode associated with the given code hash, as a hexadecimal string. Returns "0x" if no code is stored under this hash.
Was this page helpful?