Account

klay_accountCreated

Returns true if the account associated with the address is created. It returns false otherwise.

Parameters

Name
Type
Description

account

20-byte DATA

Address

block number or hash

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

Boolean

The existence of an input address

Example

// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_accountCreated","params":["0xa4f42d4d2a3a13874406435500950c9bf2d783db","latest"],"id":1}' https://public-en-baobab.klaytn.net

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

klay_accounts

Returns a list of addresses owned by client.

Parameters

None

Return Value

Type
Description

Array of 20-byte DATA

Addresses owned by the client.

Example

klay_encodeAccountKey

Encodes an account key using the Recursive Length Prefix (RLP) encoding scheme.

Parameters

Name
Type
Description

keytype

QUANTITY

Integer value indicating account key type. For the value of each account key type, see Account Key.

key

JSON DATA

Account key object

Return Value

Type
Description

DATA

RLP encoded account key

Example

klay_decodeAccountKey

Decodes an RLP encoded account key.

Parameters

Type
Description

DATA

RLP encoded account key

Return Value

Name
Type
Description

keytype

QUANTITY

Integer value indicating account key type.

key

JSON DATA

Account key object

Example

klay_getAccount

Returns the account information of a given address. There are two different account types in Klaytn: Externally Owned Account (EOA) and Smart Contract Account. See Klaytn Accounts.

Parameters

Name
Type
Description

address

20-byte DATA

Address

block number or hash

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

Account

Each account type has different attributes.

Example

klay_getAccountKey

Returns the account key of the Externally Owned Account (EOA) of a given address. If the account has AccountKeyLegacy or the account of the given address is a Smart Contract Account, it will return an empty key value. See Account Key.

Parameters

Type
Description

20-byte DATA

Address

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

AccountKey

The account key consist of public key(s) and a key type.

Example

klay_getBalance

Returns the balance of the account of given address.

Parameters

Name
Type
Description

address

20-byte DATA

Address to check for balance.

block number or hash

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

QUANTITY

Integer of the current balance in peb.

Example

klay_getCode

Returns code at a given address.

Parameters

Type
Description

20-byte DATA

Address

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

DATA

The code from the given address.

Example

klay_getTransactionCount

Returns the number of transactions sent from an address.

Parameters

Type
Description

20-byte DATA

Address

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

QUANTITY

Integer of the number of transactions send from this address.

Example

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.

Parameters

Name
Type
Description

account

20-byte DATA

Address

block number or hash

QUANTITY | TAG | HASH

Integer or hexadecimal block number, or the string "earliest", "latest" or "pending" as in the default block parameter, or block hash.

Return Value

Type
Description

Boolean

true means the input parameter is an existing smart contract address.

Example

klay_sign

The sign method calculates a Klaytn-specific signature with:

Adding a prefix to the message makes the calculated signature recognizable as a Klaytn-specific signature. This prevents misuse where a malicious dApp can sign arbitrary data, e.g., transaction, and use the signature to impersonate the victim.

NOTE: The address to sign with must be unlocked.

Parameters

Name
Type
Description

account

20-byte DATA

Address

message

N-byte DATA

Message to sign

Return Value

Type
Description

DATA

Signature

Example

Last updated