eth_getCode
Network: Ethereum Sepolia · Testnet · Chain ID 11155111 (0xaa36a7)
Counts as 1 request. See Request Counting.
Returns code at a given address. Used to check if an address is a smart contract.
Parameters
DATA(20 bytes) — Address to get code from.QUANTITY|TAG— Block number, or"latest","earliest","pending".
Returns
DATA — The code from the given address. Returns 0x for EOA (non-contract) accounts.
Request
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "latest"],
"id": 1
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x6080604052..."
}Replace the example address with a contract on Ethereum Sepolia.
If the result is
"0x", the address is an EOA (externally owned account), not a contract.
Code Examples
curl -X POST https://ethereum-sepolia-rpc.blockreq.com/v1/rpc/public \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","latest"],"id":1}'