Skip to main content

eth_getCode

Overview

The 'eth_getCode' method returns the compiled byte code of a smart contract, if any, at a given address.

Request

curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [
"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8",
"latest"
],
"method": "eth_getCode"
}'

Request Parameters

  • address: [ Required ] A string representing the address (20 bytes) of the smart contract, from which the compiled byte code will be obtained.
  • block number: [ Required ] A hexadecimal block number, or the string 'latest', 'earliest' or 'pending'. Refer to the default block parameter section for more details.

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}

The compiled byte code of the smart contract at the given address.