Updated on 2023-12-15 GMT+08:00

eth_getCode

Introduction

This API returns the compiled byte code of a smart contract, if any, at a given address. It consumes 40 CUs. In the dedicated edition, the throughput is 8000 per second for 8 vCPUs and 32 GB memory and 15,000 per second for 16 vCPUs and 64 GB memory.

Parameter Description

Parameter

Type

Description

Address

String

A 20-byte string of the storage address from which the bytecode will be obtained.

Block number

String

A hexadecimal block number, or the string (earliest, latest, or pending).

Return Value

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

Request

curl https://your-http-endpoint/v1/<API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getCode","params": ["0x06012c8cf97bead5deae237070f9587f8e7a266d", "0x65a8db"],"id":1}'