Skip to main content
POST
eth_getCode
curl --request POST \
  --url https://tempo-moderato.core.chainstack.com/a25a421add2280d53fdbc23417055501/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0x20c0000000000000000000000000000000000000",
    "latest"
  ],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Tempo API method that returns the bytecode at a given address. This is commonly used to verify if an address is a contract.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • address — the address to get the code from
  • blockParameter — the block number (hex) or tag (latest, earliest, pending)

Response

  • result — the bytecode at the given address, or 0x if no code exists (EOA)

eth_getCode code examples

const Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);

// Check if pathUSD is a contract
const PATHUSD = "0x20c0000000000000000000000000000000000000";

async function getCode() {
  const code = await web3.eth.getCode(PATHUSD);
  console.log(`Is contract: ${code !== '0x'}`);
}

getCode()

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_getCode
params
any[]

Contract address and block parameter

id
integer
default:1

Response

200 - application/json

The contract bytecode

jsonrpc
string
id
integer
result
string

The bytecode at the given address, or 0x if no code exists

Last modified on January 23, 2026