Account
Last updated
Last updated
This default address is used as the default from
property, if no from
property is specified in parameters of the following methods:
->
->
Property
20-byte String
- Any Klaytn address. You should have the private key for that address in your node or keystore. Default is undefined
.
Example
Returns true
if the account associated with the address is created. It returns false
otherwise.
NOTE accountCreated checks if the account exists on the network, so even if a key pair is created, false is returned if the account matching the address does not exist on the actual blockchain network.
Parameters
address
String
The address of the account you want to query to see if it has been created on the network.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns Boolean
- The existence of an input address.
Example
NOTE getAccount returns the account that exists on the network, so even if a key pair is created, null is returned if the account matching the address does not exist on the actual blockchain network.
Parameters
address
String
The address of the account for which you want to get account information.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns a JSON object - A JSON object that contains the account information.
Example
Returns a list of accounts that the node controls.
Parameters
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns Array
- An array of addresses controlled by node.
Example
NOTE getAccountKey returns the account key if the account exists on the network, so even if a key pair is created, null is returned if the account matching the address does not exist on the actual blockchain network.
Parameters
address
String
The address of the account for which you want to get accountKey.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns Object
- The account key consist of public key(s) and a key type.
Example
Gets the balance of an address at a given block.
Parameters
address
String
The address to get the balance of.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns String
- The current balance for the given address in peb.
Example
Gets the code at a specific address.
Parameters
address
String
The address to get the code from.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns String
- The data at given address address
.
Example
Gets the number of transactions sent from this address.
Parameters
address
String
The address to get the number of transactions from.
blockNumber
number | string
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Number
The number of transactions sent from the given address.
Example
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
address
String
The address of the account you want to check for isContractAccount.
defaultBlock
Number | String
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns Boolean
- true
means the input parameter is an existing smart contract address.
Example
Parameters
message
String
Message to sign.
address
String
The address of the account to sign the message with.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise
returns String
- The message signature signed with the account's private key.
Example
(optional) If you pass this parameter, it will not use the default block set with .
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 .
(optional) If you pass this parameter, it will not use the default block set with .
Returns the account key of the Externally Owned Account (EOA) of the 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 .
(optional) If you pass this parameter, it will not use the default block set with .
(optional) If you pass this parameter, it will not use the default block set with .
(optional) If you pass this parameter, it will not use the default block set with .
(optional) A block number, the string pending
for the pending nonce, or the string earliest
or latest
as in the . If omitted, latest
will be used.
(optional) If you pass this parameter, it will not use the default block set with .
Generates signed data specific to the Klaytn network. Refer to to know how the signature is generated.
NOTE: This API provides the function to sign a message using an account that exists in your node. The account in the node must be unlocked to sign the message. To sign a transaction, use .