klay_getAccount

Returns the account information of a given address.

📘

Supported on Klaytn (mainnet) only.

Parameters

Request

NameTypeDescription
address20-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
AccountEach account type has different attributes.

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 (Account type: Externally Owned Account)
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_getAccount","params":["0x3111a0577f322e8fb54f78d9982a26ae7ca0f722", "latest"],"id":1}'

// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    accType: 1,
    account: {
      balance: 4985316100000000000,
      humanReadable: false,
      key: {
        key: {
          x: "0x230037a99462acd829f317d0ce5c8e2321ac2951de1c1b1a18f9af5cff66f0d7",
          y: "0x18a7fb1b9012d2ac87bc291cbf1b3b2339356f1ce7669ae68405389be7f8b3b6"
        },
        keyType: 2
      },
      nonce: 11
    }
  }
}
// Request (Account type: Smart Contract Account)
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_getAccount","params":["0x3111a0577f322e8fb54f78d9982a26ae7ca0f722", "latest"],"id":1}'

// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "accType": 2,
    "account": {
      "balance": "0x0",
      "codeFormat": 0,
      "codeHash": "80NXvdOay02rYC/JgQ7RfF7yoxY1N7W8P7BiPvkIeF8=",
      "humanReadable": false,
      "key": {
        "key": {},
        "keyType": 3
      },
      "nonce": 1,
      "storageRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
    }
  }
}