Pre-alphaWork in progress
Skip to content

eth_getCode ​

Returns code at a given address.

Ethereum specification · All supported methods

Parameters ​

Parameters are positional, in the order below.

ParameterTypeRequiredDescription
Address20-byte addressYesAccount or contract address.
BlockBlock number, tag, or EIP-1898 hash selectorNodefault: 'latest'. The state is the one after the block has been executed.

Return value ​

The account’s bytecode as hexadecimal bytes; 0x for an account without code.

Example ​

Replace <gateway-url> with your gateway base URL and <service-url> with the chain’s service path, such as service/ethereum.

sh
curl -X POST "<gateway-url>/<service-url>" \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["0xa50a51c09a5c451c52bb714527e1974b686d8e77","latest"]}'

Illustrative response; values depend on the selected network and request:

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x60806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f2458114604d57806355241077146071575b600080fd5b348015605857600080fd5b50605f6088565b60408051918252519081900360200190f35b348015607c57600080fd5b506086600435608e565b005b60005481565b60008190556040805182815290517f199cd93e851e4c78c437891155e2112093f8f15394aa89dab09e38d6ca0727879181900360200190a1505600a165627a7a723058209d8929142720a69bde2ab3bfa2da6217674b984899b62753979743c0470a2ea70029"
}

Direct behavior ​

State at the network head and its 128 preceding blocks is available through the recent service. Older state requests are automatically routed to providers with archive state.

Requests using latest follow Direct’s reference-block rules. The selected reference is preserved during recovery; separate requests can see a newer reference.

For providers ​

Support the recent-state window and the covered EIP-1898 selectors, including requireCanonical. Historical requests require verified archive state.

See provider qualification for checks and continued eligibility.

Unstoppable Infrastructure.