Klaytn Docs
Search…
⌃K

Configuration

gasPriceAt

caver.klay.gasPriceAt([defaultBlock] [, callback])
Returns the unit price of gas in peb that was effective at the given block height.
Parameters
Name
Type
Description
defaultBlock
Number | String
(optional) If you don't pass this parameter, the default block set by caver.klay.defaultBlock will be used.
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise returns String - A numeric string of the gas price in peb.
Example
> caver.klay.gasPriceAt().then(console.log);
0x5d21dba00
> caver.klay.gasPriceAt('latest').then(console.log);
0x5d21dba00

getChainId

caver.klay.getChainId([callback])
Returns the chain ID of the chain.
Parameters
Name
Type
Description
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise returns Number - Integer of the chain ID of the chain.
Example
> caver.klay.getChainId().then(console.log);
1001

getGasPrice

caver.klay.getGasPrice([callback])
Returns the unit price defined in the Klaytn network.
Parameters
Name
Type
Description
callback
Function
(optional) Optional callback, returns an error object as the first parameter and the result as the second.
Return Value
Promise returns String - Number string of the current unit price in peb.
Example
> caver.klay.getGasPrice().then(console.log);
"25000000000"

getNodeInfo

caver.klay.getNodeInfo([callback])
Returns the current client version of a Klaytn node.
Parameters
Name
Type
Description
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 client version of a Klaytn node.
Example
> caver.klay.getNodeInfo().then(console.log);
Klaytn/v0.10.1+fc5c37064e/linux-amd64/go1.11.2

getProtocolVersion

caver.klay.getProtocolVersion([callback])
Returns the Klaytn protocol version of the node. The current version (as of v1.9.0) of Cypress/Baobab is istanbul/65.
Parameters
Name
Type
Description
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 Klaytn protocol version of the node.
Example
> caver.klay.getProtocolVersion().then(console.log);
0x40

isSenderTxHashIndexingEnabled

caver.klay.isSenderTxHashIndexingEnabled([callback])
Returns true if the node is indexing sender transaction hash to transaction hash mapping information.
Parameters
Name
Type
Description
callback
Function
(optional) Optional callback function. The callback is fired with an error object as the first parameter and the result as the second.
Return Value
Promise returns Boolean - true means the node is indexing the sender transaction hash to find the fee-payer-signed transaction. For detailed information, please see Klaytn Platform API - klay_getTransactionBySenderTxHash and Klaytn Transactions - Fee Delegation and SenderTxHash.
Example
> caver.klay.isSenderTxHashIndexingEnabled().then(console.log);
true

isParallelDBWrite

caver.klay.isParallelDBWrite([callback])
Returns true if the node is writing blockchain data in parallel manner. It is enabled by default.
Parameters
Name
Type
Description
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 node is writing blockchain data in a parallel manner. Returns false if the node is writing the data in a serial manner.
Example
> caver.klay.isParallelDBWrite().then(console.log);
true

rewardbase

caver.klay.rewardbase([callback])
Returns the rewardbase of the current node. Rewardbase is the address of the account where the block reward goes to. Only the Klaytn Consensus Nodes (CN) have the rewardbase in their configuration. See Configuration File.
Parameters
Name
Type
Description
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 rewardbase of the current node.
Example
> caver.klay.rewardbase().then(console.log);
0xed9d108be2a9a7ea5f180ace80f31b66ea107283
Last modified 1mo ago