klay_isContractAccount

Returns true if an input account has a non-empty codeHash at the time of a specific block number. It returns false if the account is an EOA or a smart contract account which doesn't have codeHash.

📘

Supported on Klaytn (mainnet) only.

Parameters

Request

NameTypeDescription
account20-byte DATAAddress
block number or hashQUANTITY | TAG | HASHInteger or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

NOTE: In versions earlier than Klaytn v1.7.0, only integer block number, the string "earliest" and "latest" are available.

Result

TypeDescription
Booleantrue means the input parameter is an existing smart contract address.

API Endpoint

The format of a Klaytn API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/klaytn/

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/klaytn/

Example

// Request
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_isContractAccount","params":["0x2f07d5b3fa1051460099dc9ea0c2975b6ea67776", "latest"],"id":1}'

// Result
{
    "jsonrpc":"2.0",
    "id":1,
    "result":true
}