Returns the bytecode at a given address. This is useful for verifying if an address is a contract or an externally owned account.
Parameters
The address to get bytecode from (20 bytes).
Integer block number, or the string “latest”, “earliest” or “pending”.
Returns
The bytecode at the given address as a hexadecimal string. Returns “0x” for externally owned accounts.
Error Handling
If the result is “0x”, the address is an externally owned account (EOA). If it contains bytecode, it’s a smart contract.