Updated on 2024-11-14 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.

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}'