caver.rpc.klay
Last updated
Last updated
caver.rpc.klay
provides JSON-RPC call with klay
name space.
Returns true
if the account associated with the address is created in the Klaytn blockchain platform. It returns false
otherwise.
Parameters
Name | Type | Description |
---|---|---|
Return Value
Promise
returns boolean
Type | Description |
---|---|
Example
Returns the account information of a given address in the Klaytn. For more details about the types of an account in Klaytn, please refer to Klaytn Account Types.
NOTE caver.rpc.klay.getAccount
returns the account that exists on the network, so null
is returned if the account matching the address does not exist on the actual blockchain network.
Parameters
Return Value
Promise
returns object
Example
Returns AccountKey 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. Please refer to Account Key for more details.
NOTE caver.rpc.klay.getAccountKey
returns an object that differs by each AccountKey type. If a Klaytn account matching the given address does not exist in the network, null
is returned.
Parameters
Return Value
Promise
returns object
Example
Encodes an object that contains AccountKey information using the Recursive Length Prefix (RLP) encoding scheme. Also you can use account.getRLPEncodingAccountKey to get RLP-encoded AccountKey.
Parameters
Return Value
Promise
returns string
Example
Decodes a RLP-encoded AccountKey. Also you can use caver.account.accountKey.decode to decode a RLP-encoded AccountKey.
Parameters
Return Value
Promise
returns object
Example
Returns the balance of the account of the given address in Klaytn.
Parameters
Return Value
Promise
returns string
Example
Returns code at a given address.
Parameters
Return Value
Promise
returns string
Example
Returns the total number of transactions sent from an address.
Parameters
Return Value
Promise
returns string
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. Please refer to Smart Contract Account for more details.
Parameters
Return Value
Promise
returns boolean
Example
Generates signed data specific to the Klaytn. Refer to Klaytn Platform API - klay_sign to know how the signature is generated.
NOTE: This API provides the function to sign a message using an imported account in your Klaytn node. The imported account in your node must be unlocked to sign the message. To sign a transaction with imported account in your Klaytn node, use caver.rpc.klay.signTransaction.
Parameters
Return Value
Promise
returns string
Example
Returns a list of addresses owned by the Klaytn Node.
Parameters
Return Value
Promise
returns Array
Example
Returns the number of the most recent block.
Parameters
Return Value
Promise
returns string
Example
Returns a block header by block hash or block number. If the user passes the block hash as a parameter, caver.rpc.klay.getHeaderByHash is called, and if the block number is called as a parameter, caver.rpc.klay.getHeaderByNumber is called.
Parameters
Return Value
Promise
returns object
Example
Returns a block header by block number.
Parameters
Return Value
Promise
returns object
Example
Returns the block number of the most recent block by using blockHash
.
Parameters
Return Value
Promise
returns object
- An object includes the block header:
Example
Returns information about a block by block hash or block number. If the user passes the block hash as a parameter, caver.rpc.klay.getBlockByHash is called, and if the block number is called as a parameter, caver.rpc.klay.getBlockByNumber is called.
Parameters
Return Value
Promise
returns object
Example
Returns information about a block by block number.
Parameters
Return Value
Promise
returns object
Example
Returns the block number of the most recent block by using blockHash
.
Parameters
Return Value
Promise
returns object
- An object includes block:
Example
Returns receipts included in a block identified by block hash.
Parameters
Return Value
Promise
returns Array
Example
Returns the number of transactions in a block matching the given block number.
Parameters
Return Value
Promise
returns string
Example
Returns the number of transactions in a block matching the given block hash.
Parameters
Return Value
Promise
returns string
Example
Returns a block with consensus information matched by the given block number.
Parameters
Return Value
Promise
returns object
Example
Returns a block with consensus information matched by the given hash.
Parameters
Return Value
Promise
returns object
- A block object with consensus information (a proposer and a list of committee members), or null when no block was found:
Example
Returns a list of all validators in the committee at the specified block.
Parameters
Return Value
Promise
returns Array
Example
Returns the size of the committee at the specified block.
Parameters
Return Value
Promise
returns number
Example
Returns a list of all validators of the council at the specified block.
Parameters
Return Value
Promise
returns Array
Example
Returns the size of the council at the specified block.
Parameters
Return Value
Promise
returns number
Example
Returns the value from a storage position at a given address.
Parameters
Return Value
Promise
returns string
Example
Returns true
if client is actively mining new blocks.
Parameters
Return Value
Promise
returns boolean
- true
if the client is mining, otherwise false
.
Example
Returns an object with data about the sync status or false.
Parameters
Return Value
Promise
returns object|boolean
- false
if the Klaytn Node is not syncing. Otherwise, a sync object is returned:
Example
Executes a new message call immediately without sending a transaction on the blockchain. It returns data or an error object of JSON RPC if an error occurs.
Parameters
callObject
has the following properties:
Return Value
Promise
returns string
Example
Generates and returns an estimate of how much gas
is necessary to allow a transaction to complete. The transaction from this method will not be added to the blockchain.
Parameters
See caver.rpc.klay.call parameters, expect that all properties are optional.
Return Value
Promise
returns string
Example
Generates and returns an estimate of how much computation cost
will be spent to execute the transaction. Klaytn limits the computation cost of a transaction to 100000000
currently not to take too much time by a single transaction. The transaction will not be added to the blockchain like caver.rpc.klay.estimateGas.
Parameters
See caver.rpc.klay.call parameters, expect that all properties are optional.
Return Value
Promise
returns string
Example
Returns information about a transaction by block hash
and transaction index
position.
Parameters
Return Value
Promise
returns object
Example
Returns information about a transaction by block number
and transaction index
position.
Parameters
Return Value
Promise
returns object
Example
Returns the information about a transaction requested by transaction hash.
Parameters
Return Value
Promise
returns object
- A transaction object, or null
when no transaction was found:
If the transaction is in pending
status that has not yet been processed, default values for blockHash
, blockNumber
and transactionIndex
are returned. See the example below.
Example
Returns the information about a transaction requested by the sender transaction hash.
Please note that this API returns the correct result only if the indexing feature is enabled in the node by --sendertxhashindexing
. Use caver.rpc.klay.isSenderTxHashIndexingEnabled to check if the indexing feature is enabled or not.
Parameters
Return Value
Promise
returns object
Example
Returns the receipt of a transaction by transaction hash.
NOTE Receipt is not available for pending
transactions whose transactions have not yet been processed.
Parameters
Return Value
Promise
returns object
- A transaction receipt object, or null
when no receipt was found:
NOTE effectiveGasPrice
is supported since caver-js v1.9.0.
Example
Returns the receipt of a transaction by sender transaction hash.
Please note that this API returns the correct result only if the indexing feature is enabled in the node by --sendertxhashindexing
. Use caver.rpc.klay.isSenderTxHashIndexingEnabled to check if the indexing feature is enabled or not.
NOTE Receipt is not available for pending
transactions whose transactions have not yet been processed.
Parameters
Return Value
Promise
returns object
Example
Sends a signed transaction
to the Klaytn.
The signedTransaction
parameter can be a "RLP-encoded signed transaction." You can get the RLP-encoded transaction of a signed transaction using transaction.getRLPEncoding
. For convenience, caver.rpc.klay.sendRawTransaction
also accepts a "signed transaction instance" as parameter.
Parameters
Return Value
For PromiEvent, the following events are available:
transactionHash
returns string
: Is fired right after a transaction is sent and a transaction hash is available.
receipt
returns object
: Is fired when a transaction receipt is available. See caver.rpc.klay.getTransactionReceipt for more detail.
error
returns Error
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
Signs a transaction as a transaction sender
with an "imported account's private key" in your Klaytn Node and propagates the transaction to the Klaytn.
For more information about each transaction type, refer to Transaction.
NOTE: This API provides the function to sign a transaction using an imported account in your Klaytn node. The imported account in your node must be unlocked to sign a transaction.
Parameters
Return Value
For PromiEvent, the following events are available:
transactionHash
returns string
: Is fired right after a transaction is sent and a transaction hash is available.
receipt
returns object
: Is fired when a transaction receipt is available. See caver.rpc.klay.getTransactionReceipt for more detail.
error
returns Error
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
Signs a fee delegated transaction as a transaction fee payer
with an imported account's private key
in your Klaytn Node and propagates the transaction to the Klaytn.
Before using sendTransaction
as a fee payer, the transaction sender must have signed with valid signature(s) and the nonce
must have been defined.
For more information about each transaction type, refer to Transaction.
NOTE: This API provides the function to sign a transaction using an imported account in your Klaytn node. The imported account in your node must be unlocked to sign a transaction.
Parameters
Return Value
For PromiEvent, the following events are available:
transactionHash
returns string
: Is fired right after a transaction is sent and a transaction hash is available.
receipt
returns object
: Is fired when a transaction receipt is available. See caver.rpc.klay.getTransactionReceipt for more detail.
error
returns Error
: Is fired if an error occurs during sending. On an out-of-gas error, the second parameter is the receipt.
Example
Signs a transaction as a transaction sender with an "imported account's private key" in your Klaytn Node.
For more information about each transaction type, refer to Transaction.
NOTE: This API provides the function to sign a transaction using an imported account in your Klaytn node. The imported account in your node must be unlocked to sign a transaction.
Parameters
Return Value
Promise
returns object
- An object includes signed transaction:
Example
Signs a transaction as a transaction fee payer with an "imported account's private key" in your Klaytn Node.
For more information about each transaction type, refer to Transaction.
NOTE: This API provides the function to sign a transaction using an imported account in your Klaytn node. The imported account in your node must be unlocked to sign a transaction.
Parameters
Return Value
Promise
returns object
- An object includes signed transaction:
Example
Returns the decoded anchored data in the transaction for the given transaction hash.
Parameters
Return Value
Promise
returns object
- An object includes decoded anchored data:
Example
Returns the chain ID of the chain.
Parameters
Return Value
Promise
returns string
Example
Returns the current client version of a Klaytn node.
Parameters
Return Value
Promise
returns string
Example
Returns the current price per gas in peb.
Parameters
Return Value
Promise
returns string
Example
Returns the current price per gas in peb for the given block.
Parameters
Return Value
Promise
returns string
Example
Returns a suggested gas tip cap for dynamic fee transactions in peb. Since Klaytn has a fixed gas price, this returns the gas price set by Klaytn.
Parameters
Return Value
Promise
returns string
Example
Returns the lower bound gas price in peb.
Parameters
Return Value
Promise
returns string
Example
Returns the upper bound gas price in peb.
Parameters
Return Value
Promise
returns string
Example
Returns fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.
Parameters
Return Value
Promise
returns object
- An object includes fee history:
Example
This method creates an accessList based on a given Transaction. The accessList contains all storage slots and addresses read and written by the transaction, except for the sender account and the precompiles. This method uses the same transaction call object and blockNumberOrTag object as caver.rpc.klay.call
. An accessList can be used to release stuck contracts that became inaccessible due to gas cost increases. Adding an accessList to your transaction does not necessary result in lower gas usage compared to a transaction without an access list.
Parameters
Return Value
Promise
returns object
- An object includes an access list:
Example
Returns true
if the node is writing blockchain data in a parallel manner.
Parameters
Return Value
Promise
returns boolean
Example
Returns true
if the node is indexing sender transaction hash to transaction hash mapping information.
Parameters
Return Value
Promise
returns boolean
Example
Returns the Klaytn protocol version of the node. The current version (as of v1.9.0) of Cypress/Baobab is istanbul/65
.
Parameters
Return Value
Promise
returns string
Example
Returns the rewardbase of the current node. Rewardbase is the address of the account where the block rewards go to. It is only required for CNs.
Parameters
Return Value
Promise
returns string
Example
Polling method for a filter, which returns an array of logs since the last poll.
Parameters
Return Value
Promise
returns Array
- Array of log objects, or an empty array if nothing has changed since the last poll.
For filters created with caver.rpc.klay.newBlockFilter, the returns are block hashes, e.g., ["0x3454645634534..."]
.
For filters created with caver.rpc.klay.newPendingTransactionFilter, the returns are transaction hashes, e.g., ["0x6345343454645..."]
.
For filters created with caver.rpc.klay.newFilter, logs are objects with the following parameters:
Example
Returns an array of all logs matching the filter with the given id. The filter object should be obtained by using newFilter.
Note that filter ids returned by other filter creation functions, such as caver.rpc.klay.newBlockFilter or caver.rpc.klay.newPendingTransactionFilter, cannot be used with this function.
Parameters
Return Value
See caver.rpc.klay.getFilterChanges
Example
Returns an array of all logs matching a given filter object.
Parameters
The options object can contain the following:
Return Value
See caver.rpc.klay.getFilterChanges
Example
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call caver.rpc.klay.getFilterChanges.
Parameters
Return Value
Promise
returns string
Example
Creates a filter object using the given filter options, to receive the specific state changes (logs).
To check if the state has changed, call caver.rpc.klay.getFilterChanges.
To obtain all logs matching the filter created by newFilter
, call caver.rpc.klay.getFilterLogs.
For detailed information about the topics in the filter object, please see Klaytn Platform API - klay_newFilter.
Parameters
The options object can contain the following:
Return Value
Promise
returns string
Example
Creates a filter in the node, to receive the information about new pending transaction arrival. To check if the state has changed, call caver.rpc.klay.getFilterChanges.
Parameters
Return Value
Promise
returns string
Example
Uninstalls a filter with a given id. Should always be called when a watch is no longer needed. Additionally, filters time out when they are not being called with caver.rpc.klay.getFilterChanges for a period of time.
Parameters
Return Value
Promise
returns boolean
Example
Returns Keccak-256 (not the standardized SHA3-256) of the given data. You can use caver.utils.sha3 instead of this.
Parameters
Return Value
Promise
returns string
Example
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
address
string
The address of the account you want to query to see if it has been created on the network.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
boolean
The existence of an input address in the Klaytn.
address
string
The address of the account for which you want to get account information.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
An object that contains the account information. Each account type has different attributes.
address
string
The address of Klaytn account from which you want to get an object of AccountKey information.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
An object that contains AccountKey information. Each AccountKey type has different attributes.
accountKey
object
An object defines keyType
and key
inside or an instance of AccountKey
(AccountKeyLegacy, AccountKeyPublic, AccountKeyFail, AccountKeyWeightedMultiSig or AccountKeyRoleBased).
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
A RLP-encoded AccountKey.
encodedKey
string
A RLP-encoded AccountKey.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
An object defines keyType
and key
inside.
address
string
The address of the account for which you want to get balance.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The current balance for the given address in peb.
address
string
The address to get the code from.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The code from the given address.
address
string
The address to get the number of transactions from.
blockNumber
number | string
(optional) A block number, the string pending
for the pending nonce, or the string earliest
or latest
as in the default block parameter. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The number of transactions sent from the given address in hex.
address
string
The address you want to check for isContractAccount.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
boolean
true means the input parameter is an existing smart contract address.
address
String
The address of the imported account to sign the message.
message
String
Message to sign.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The signature made from an imported account.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Array
An array of addresses owned by the Klaytn Node.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The number of the most recent block in hex.
blockNumberOrHash
number | string
The block hash, number or the block tag string.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A block header object. For a detailed description of the return value, please refer to caver.rpc.klay.getHeaderByHash.
blockNumber
number | string
The block number or the block tag string.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A block header object. For a detailed description of the return value, please refer to caver.rpc.klay.getHeaderByHash.
blockHash
string
The block hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
baseFeePerGas
string
The base fee per gas. This value is returned only when EthTxTypeCompatibleBlock is activated for that block number.
blockScore
string
The difficulty of mining in the blockchain network. The use of blockScore
differs from the consensus of the network. Always 1 in the BFT consensus engine.
extraData
string
The "extra data" field of this block.
gasUsed
string
The gas in total that was used by all transactions in this block.
governanceData
string
RLP encoded governance configuration
hash
string
Hash of the block. null
when it is a pending block.
logsBloom
string
The bloom filter for the logs of the block. null
when it is a pending block.
number
string
The block number. null
when it is a pending block.
parentHash
string
Hash of the parent block.
receiptsRoot
string
The root of the receipts trie of the block.
reward
string
The address of the beneficiary to whom the block rewards were given.
stateRoot
string
The root of the final state trie of the block.
timestamp
string
The unix timestamp for when the block was collated.
timestampFoS
string
The fraction of a second of the timestamp for when the block was collated.
transactionsRoot
string
The root of the transaction trie of the block.
blockNumberOrHash
number | string
The block hash, number or the block tag string.
returnTransactionObjects
boolean
(optional, default false
) If true
, the returned block will contain all transactions as objects, and if false
, it will only contain the transaction hashes.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A block object. For a detailed description of the return value, please refer to caver.rpc.klay.getBlockByHash.
blockNumber
number | string
The block number or the block which is tagged with a string (genesis
or latest
).
returnTransactionObjects
boolean
(optional, default false
) If true
, the returned block will contain all transactions as objects, and if false
, it will only contain the transaction hashes.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A block object. For detailed description of return value, please refer to caver.rpc.klay.getBlockByHash.
blockHash
string
The block hash.
returnTransactionObjects
boolean
(optional, default false
) If true
, the returned block will contain all transactions as objects, and if false
, it will only contain the transaction hashes.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
baseFeePerGas
string
The base fee per gas. This value is returned only when EthTxTypeCompatibleBlock is activated for that block number.
blockScore
string
The difficulty of mining in the blockchain network. The use of blockScore
differs from the consensus of the network. Always 1 in the BFT consensus engine.
extraData
string
The "extra data" field of this block.
gasUsed
string
The gas in total that was used by all transactions in this block.
governanceData
string
RLP encoded governance configuration
hash
string
Hash of the block. null
when it is a pending block.
logsBloom
string
The bloom filter for the logs of the block. null
when it is a pending block.
number
string
The block number. null
when it is a pending block.
parentHash
string
Hash of the parent block.
receiptsRoot
string
The root of the receipts trie of the block.
reward
string
The address of the beneficiary to whom the block rewards were given.
size
string
Integer the size of this block in bytes.
stateRoot
string
The root of the final state trie of the block.
timestamp
string
The unix timestamp for when the block was collated.
timestampFoS
string
The fraction of a second of the timestamp for when the block was collated.
totalBlockScore
string
Integer of the total blockScore of the chain until this block.
transactions
Array
Array of transaction objects, or 32-byte transaction hashes depending on the returnTransactionObjects
parameter.
transactionsRoot
string
The root of the transaction trie of the block.
voteData
string
RLP encoded governance vote of the proposer.
blockHash
string
The block hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Array
The transaction receipts included in a block. If the target block contains no transaction, an empty array []
is returned. For detailed description of transaction receipt, please refer to caver.rpc.klay.getTransactionReceipt.
blockNumber
number | string
The block number or the block tag string (genesis
or latest
).
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The number of transactions in the given block in hex.
blockHash
string
The block hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The number of transactions in the given block in hex.
blockNumber
number | string
The block number or the block tag string (genesis
or latest
).
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
An object includes block with consensus information. For detailed description of return value, please refer to caver.rpc.klay.getBlockWithConsensusInfoByHash.
blockHash
string
The block hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
blockScore
string
Former difficulty. Always 1 in the BFT consensus engine
committee
Array
Array of addresses of committee members of this block. The committee is a subset of validators who participated in the consensus protocol for this block.
extraData
string
The "extra data" field of this block.
gasUsed
string
The gas in total that was used by all transactions in this block.
governanceData
string
RLP encoded governance configuration
hash
string
Hash of the block. null
when it is a pending block.
logsBloom
string
The bloom filter for the logs of the block. null
when it is a pending block.
number
string
The block number. null
when it is a pending block.
originProposer
string
The proposal of 0 round at the same block number.
parentHash
string
Hash of the parent block.
proposer
string
The address of the block proposer.
receiptsRoot
string
The root of the receipts trie of the block.
reward
string
The address of the beneficiary to whom the block rewards were given.
round
number
The round number.
size
string
Integer the size of this block in bytes.
stateRoot
string
The root of the final state trie of the block.
timestamp
string
The unix timestamp for when the block was collated.
timestampFoS
string
The fraction of a second of the timestamp for when the block was collated.
totalBlockScore
string
Integer of the total blockScore of the chain until this block.
transactions
Array
Array of transaction objects.
transactionsRoot
string
The root of the transaction trie of the block.
voteData
string
RLP encoded governance vote of the proposer
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Array
Addresses of all validators in the committee at the given block.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
number
The size of the committee at the given block.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Array
An array of validator addresses of the council at the given block, or null when no council was found.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
number
The size of the council at the given block.
address
string
The address to get the storage from.
position
number
The index position of the storage. For more information on calculating the position
, refer to klay_getStorageAt.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The value at this storage position.
callback
function
(optional) Optional callback, which returns an error object as the first parameter and the result as the second.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
startingBlock
string
The block number in hex where the sync started.
currentBlock
string
The block number in hex where the node currently synced to.
highestBlock
string
The estimated block number in hex to sync to.
knownStates
string
The estimated states in hex to download.
pulledStates
string
The already downloaded states in hex.
callObject
object
A transaction call object. See the next table for the object's properties.
blockNumber
number | string
(optional) A block number, or the string latest
or earliest
. If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
to
string
(optional when testing the deployment of a new contract) The address the transaction is directed to.
input
string
(optional) The hash of the method signature and encoded parameters. You can use caver.abi.encodeFunctionCall.
from
string
(optional) The address the transaction is sent from.
gas
string
(optional) The gas provided for the transaction execution. klay_call
consumes zero gas, but this parameter may be needed by some executions.
gasPrice
string
(optional) The gasPrice used for each paid gas.
value
string
(optional) The value sent with this transaction in peb
.
string
The returned data of the call. e.g., the return value of a smart contract function.
string
The amount of gas used.
string
The amount of computation cost used.
blockHash
string
The block hash.
index
number
A transaction index position inside the block.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A transaction object, see caver.rpc.klay.getTransactionByHash for more detail.
blockNumber
number | string
The block number or the block tag string (genesis
or latest
).
index
number
A transaction index position inside the block.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A transaction object, see caver.rpc.klay.getTransactionByHash for more detail.
transactionHash
string
A transaction hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
blockHash
string
Hash of the block where this transaction was in.
blockNumber
string
Block number where this transaction was in.
codeFormat
string
(optional) The code format of smart contract code.
feePayer
string
(optional) Address of the fee payer.
feePayerSignatures
Array
(optional) An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
string
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
string
Address of the sender.
gas
string
Gas provided by the sender.
gasPrice
string
Gas price provided by the sender in peb.
hash
string
Hash of the transaction.
humanReadable
Boolean
(optional) true
if the address is humanReadable, false
if the address is not humanReadable.
key
string
(optional) The RLP-encoded AccountKey used to update AccountKey of an Klaytn account. See AccountKey for more details.
input
string
(optional) The data sent along with the transaction.
nonce
string
The number of transactions made by the sender prior to this one.
senderTxHash
string
(optional) Hash of the tx without the fee payer's address and signature. This value is always the same as the value of hash
for non-fee-delegated transactions.
signatures
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
to
string
Address of the receiver. null
when it is a contract deploying transaction.
transactionIndex
string
Integer of the transaction index position in the block.
type
string
A string representing the type of the transaction.
typeInt
number
An integer representing the type of the transaction.
value
string
Value transferred in peb.
senderTxHash
string
The sender transaction hash. See SenderTxHash for more detail.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A transaction object, see caver.rpc.klay.getTransactionByHash for more details.
transactionHash
string
A transaction hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
blockHash
string
Hash of the block where this transaction was in.
blockNumber
string
Block number where this transaction was in.
codeFormat
string
(optional) The code format of smart contract code.
contractAddress
string
The contract address created, if the transaction was a contract creation, otherwise null
.
effectiveGasPrice
string
The actual value per gas deducted from the sender. Before the Magma hard fork, this value was equal to the transaction’s gas price. After the Magma hard fork, it is equal to the value of baseFee
in the block header.
feePayer
string
(optional) Address of the fee payer.
feePayerSignatures
Array
(optional) An array of fee payer's signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
feeRatio
string
(optional) Fee ratio of the fee payer. If it is 30, 30% of the fee will be paid by the fee payer. 70% will be paid by the sender.
from
string
Address of the sender.
gas
string
Gas provided by the sender.
gasPrice
string
Gas price provided by the sender in peb.
gasUsed
string
The amount of gas used by this specific transaction alone.
humanReadable
Boolean
(optional) true
if the address is humanReadable, false
if the address is not humanReadable.
key
string
(optional) The RLP-encoded AccountKey used to update AccountKey of a Klaytn account.
input
string
(optional) The data sent along with the transaction.
logs
Array
Array of log objects, which this transaction generated.
logsBloom
string
Bloom filter for light clients to quickly retrieve related logs.
nonce
string
The number of transactions made by the sender prior to this one.
senderTxHash
string
(optional) Hash of a transaction that is signed only by the sender. See SenderTxHash. This value is always the same as transactionHash
for non-fee-delegated transactions.
signatures
Array
An array of signature objects. A signature object contains three fields (V, R, and S). V contains ECDSA recovery id. R contains ECDSA signature r while S contains ECDSA signature s.
status
string
0x1
if the transaction was successful, 0x0
if the Klaytn Virtual Machine reverted the transaction.
txError
string
(optional) detailed error code if status
is equal to 0x0
.
to
string
Address of the receiver. null
when it is a contract creation transaction.
transactionHash
string
Hash of the transaction.
transactionIndex
string
Integer of the transaction index position in the block.
type
string
A string representing the type of the transaction.
typeInt
number
An integer representing the type of the transaction.
value
string
Value transferred in peb.
senderTxHash
string
The sender transaction hash. See SenderTxHash for more detail.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
object
A transaction receipt object, see caver.rpc.klay.getTransactionReceipt for more detail.
signedTransaction
string | object
A RLP-encoded signed transaction or an instance of signed transaction.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
PromiEvent
A promise combined event emitter. It will be resolved when a transaction receipt is available.
transaction
object
An instance of a transaction to be sent to the Klaytn.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
PromiEvent
A promise combined event emitter. It will be resolved when a transaction receipt is available.
transaction
object
An instance of fee delegated transaction to send to the Klaytn.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
PromiEvent
A promise combined event emitter. It will be resolved when a transaction receipt is available.
transaction
object
An instance of a transaction to sign.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
raw
string
A RLP-encoded signed transaction.
tx
object
The transaction object including the sender's signature.
transaction
object
An instance of a transaction to sign.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
raw
string
A RLP-encoded signed transaction.
tx
object
The transaction object to sign as fee payer.
transactionHash
string
A transaction hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
BlockHash
string
Hash of the child chain block that this anchoring transaction was performed.
BlockNumber
number
The child chain block number that this anchoring transaction was performed.
ParentHash
string
Hash of the parent block.
TxHash
string
The root of the transaction trie of the block.
StateRootHash
string
The root of the final state trie of the block.
ReceiptHash
string
The root of the receipts trie of the block.
BlockCount
number
The number of blocks generated during this anchoring period. In most cases, this number is equal to the child chain's SC_TX_PERIOD
, except the case that this transaction was the first anchoring tx after turning on the anchoring.
TxCount
number
The number of transactions generated in the child chain during this anchoring period.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The chain ID of the chain.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The current client version of a Klaytn node.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The current gas price in peb.
blockNumber
number
(optional) The block number. If omitted, the latest unit price will be returned.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The current gas price in peb.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The suggested gas tip cap in peb.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The lower bound gas price in peb.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The upper bound gas price in peb.
blockCount
number|BigNumber|BN|string
Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.
lastBlock
number|BigNumber|BN|string
Highest number block (or block tag string) of the requested range.
rewardPercentiles
Array
A monotonically increasing list of percentile values to sample from each block’s effective priority fees per gas in ascending order, weighted by gas used. (Example: ['0', '25', '50', '75', '100']
or ['0', '0.5', '1', '1.5', '3', '80']
)
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
oldestBlock
string
Lowest number block of returned range.
reward
Array
A two-dimensional array of effective priority fees per gas at the requested block percentiles.
baseFeePerGas
Array
An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.
gasUsedRatio
Array
An array of gasUsed/gasLimit in the block.
callObject
object
A transaction call object. Please see caver.rpc.klay.call parameters.
blockParameter
number|BigNumber|BN|string
(optional) A block number, blockhash or the block tag string (latest
or earliest
). If omitted, latest
will be used.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
oldestBlock
string
Lowest number block of returned range.
reward
Array
A two-dimensional array of effective priority fees per gas at the requested block percentiles.
baseFeePerGas
Array
An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.
gasUsedRatio
Array
An array of gasUsed/gasLimit in the block.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
boolean
true
means the node is writing blockchain data in a parallel manner. It is false
if the node is serially writing the data.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
boolean
true
means the node is indexing sender transaction hash to transaction hash mapping information.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The Klaytn protocol version of the node.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The rewardbase address.
filterId
String
The filter id.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
logIndex
string
The log index position in the block.
transactionIndex
string
The index position of transactions where this log was created from.
transactionHash
string
Hash of the transactions this log was created from. null
when pending.
blockHash
string
Hash of the block where this log was in. null
when pending.
blockNumber
string
The block number where this log was in. null
when pending.
address
string
Address from which this log originated.
data
string
Contains the non-indexed arguments of the log.
topics
Array
Array of 0 to 4 32-byte DATA of indexed log arguments. (In Solidity: The first topic is the hash of the signature of the event (e.g., Deposit(address,bytes32,uint256)
), except you declared the event with the anonymous
specifier.).
filterId
string
The filter id.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
options
object
The filter options. See the below table to find the description.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
fromBlock
number | string
(optional) The block number of the earliest block to get the logs. ("latest"
means the most recent block.) The default value is "latest"
.
toBlock
number | string
(optional) The block number of the last block to get the logs. ("latest"
means the most recent block.). The default value is "latest"
.
address
string | Array
(optional) An address or a list of addresses. Only the logs related to the particular account(s) will be returned.
topics
Array
(optional) An array of values that must appear in the log entries. The order is important. If you want to leave topics out, use null
, e.g., [null, '0x12...']
. You can also pass an array for each topic with options for that topic, e.g., [null, ['option1', 'option2']]
.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
A filter id.
options
object
The filter options. See the below table to find the description.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
fromBlock
number | string
(optional) The block number of the earliest block to get the logs. ("latest"
means the most recent block.) The default value is "latest"
.
toBlock
number | string
(optional) The block number of the last block to get the logs. ("latest"
means the most recent block.). The default value is "latest"
.
address
string | Array
(optional) An address or a list of addresses. Only the logs related to the particular account(s) will be returned.
topics
Array
(optional) An array of values that must appear in the log entries. The order is important. If you want to leave topics out, use null
, e.g., [null, '0x12...']
. You can also pass an array for each topic with options for that topic, e.g., [null, ['option1', 'option2']]
.
string
A filter id.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
A filter id.
filterId
string
The filter id.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
boolean
true
if the filter was successfully uninstalled, otherwise false
.
data
String
The data to be converted into a SHA3 hash.
callback
function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
string
The SHA3 result of the given data.