TriportRPC

eth_getCode

BNB Smart Chain / https://triport.io/rpc/bsc

Minimum tier: Free

BNB Smart Chain method guide

Last updated:

eth_getCode returns the bytecode stored at an address at a selected BNB Smart Chain block.

The result is 0x-prefixed even-length EVM byte data. An empty 0x result means the selected state has no bytecode at that address; callers should not treat it as contract metadata or decoded ABI.

Use this method to distinguish code-bearing accounts or retrieve deployed runtime bytecode. Use eth_getStorageAt for one storage slot and eth_call to execute a contract getter. Historical reads depend on the two confirmed archive-state pool nodes.

Parameters

eth_getCode parameters
NameTypeRequiredDescription
addressAddressYes
blockBlockTagYes

Returns

eth_getCode return value
FieldType
codeData

Examples

curl https://triport.io/rpc/bsc \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["<address>","<block>"]}'
const res = await fetch("https://triport.io/rpc/bsc", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getCode",
  "params": [
    "<address>",
    "<block>"
  ]
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/rpc/bsc",
    headers={"Authorization": "Bearer <api-key>"},
    json={"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["<address>","<block>"]},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Chain: BNB Smart Chain.
  3. Clusters: mainnet.
  4. Credit cost: 1 per call.

FAQ

What does eth_getCode do?
Return account bytecode at a block.
How many credits does eth_getCode cost?
eth_getCode costs 1 credit(s) per call on Triport by default.
Is eth_getCode available over WebSocket?
eth_getCode is an HTTP JSON-RPC method.