Block
Last updated
Last updated
When you send an API request with the eth
namespace, the block height is determined by the defaultBlock
parameter.
The following options are possible for the defaultBlock
parameter:
HEX String
- an integer block number
String "earliest"
for the earliest/genesis block
String "latest"
- for the latest mined block
String "pending"
- for pending state/transactions
Returns the number of the most recent block.
Parameters
None
Return Value
Type | Description |
---|---|
Example
Returns information about a header by number.
Please check the Caution-Header before using this API.
Parameters
Return Value
Example
Returns information about a header by hash.
Please check Caution-Header before using this API.
Parameters
Return Value
Object
- A header object, or null
when no header was found. Otherwise, it returns an error.
Example
Returns information about a block by block number.
Please check Caution-Block before using this API.
Parameters
Return Value
Example
Returns information about a block by hash.
Please check Caution-Block before using this API.
Parameters
Return Value
Object
- A block object, or null
when no block was found. Otherwise, it returns an error.
Example
Returns receipts included in a block.
Parameters
Return Value
Receipts included in a block. If the target block contains no transaction, an empty array []
is returned.
Example
Returns information about a uncle of a block by hash and the uncle's index position. Since there are no uncles in Klaytn, it always returns null
.
Parameters
Return Value null
Example
Returns information about a uncle of a block by number and the uncle's index position. As there are no uncles in Klaytn, it always returns null
.
Parameters
Return Value null
Example
Returns the number of transactions in a block matching the given block number.
Parameters
Return Value
Example
Returns the number of transactions in a block from a block that matches the given hash.
Parameters
Return Value
Example
Returns the number of uncles in a block from a block matching the given block number. Since there are no uncles in Klaytn, it returns 0x0
. It returns null
if there is no matching block.
Parameters
Return Value
Example
Returns the number of uncles in a block from a block matching the given block hash. Since there are no uncles in Klaytn, it returns 0x0
. It returns null
if there is no matching block.
Parameters
Return Value
Example
Returns the value from a storage position at a given address.
Parameters
Return Value
Example
Calculating the correct position depends on the storage to retrieve. Consider the following contract deployed at 0x295a70b2de5e3953354a6a8344e616ed314d7251
by the address 0x391694e7e0b0cce554cb130d723a9d27458f9298
.
Retrieving the value of pos0
is straight forward:
Retrieving an element of the map is harder. The position of an element in the map is calculated with:
This means to retrieve the storage on pos1["0x391694e7e0b0cce554cb130d723a9d27458f9298"]
we need to calculate the position with:
The Klaytn console which comes with the klay
library can be used to make the calculation
Now to fetch the storage:
Returns true
if client is actively mining new blocks.
NOTE: Currently, every node is on mining mode by default to resend transactions. Please note that the actual "mining" is only performed by the Consensus Nodes (CNs).
Parameters
None
Return Value
Example
Returns an object with data about the sync status or false
.
Parameters
None
Return Value
Object|Boolean
, an object with sync status data or false
when not syncing:
Example
Type | Description |
---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Type | Description |
---|---|
Name | Type | Description |
---|---|---|
QUANTITY
Integer of the current block number the client is on.
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in the default block parameter.
32-byte DATA
Hash of a block.
baseFeePerGas
QUANTITY
The base fee per gas.
difficulty
QUANTITY
The integer of the difficulty for this block.
extraData
DATA
The "extra data" field of this block.
gasLimit
QUANTITY
The maximum gas allowed in this block.
gasUsed
QUANTITY
The total used gas by all transactions in this block.
hash
32-byte DATA
Hash of the block. null
when it is a pending block.
logsBloom
256-byte DATA
The bloom filter for the logs of the block.
miner
20-byte DATA
The address of the beneficiary to whom the mining rewards were given.
mixHash
32-byte DATA
The hash which proves combined with the nonce that a sufficient amount of computation has been carried out on this block.
nonce
8-byte DATA
The hash of the generated proof-of-work.
number
QUANTITY
The block number. null
when it is a pending block.
parentHash
32-byte DATA
Hash of the parent block.
receiptsRoot
32-byte DATA
The root of the receipts trie of the block.
sha3Uncles
32-byte DATA
The SHA3 of the uncles data in the block.
size
QUANTITY
Integer of the size of this block in bytes.
stateRoot
32-byte DATA
The root of the final state trie of the block.
timestamp
QUANTITY
The Unix timestamp for when the block was collated.
totalDifficulty
QUANTITY
The total blockScore of the chain until this block.
transactionsRoot
32-byte DATA
The root of the transaction trie of the block.
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in default block parameter.
Boolean
If true
it returns the full transaction objects, if false
only the hashes of the transactions.
32-byte DATA
Hash of a block.
Boolean
If true
it returns the full transaction objects, if false
only the hashes of the transactions.
baseFeePerGas
QUANTITY
The base fee per gas.
difficulty
QUANTITY
The integer of the difficulty for this block
extraData
DATA
The "extra data" field of this block.
gasLimit
QUANTITY
The maximum gas allowed in this block.
gasUsed
QUANTITY
The total used gas by all transactions in this block.
hash
32-byte DATA
Hash of the block. null
when it is a pending block.
logsBloom
256-byte DATA
The bloom filter for the logs of the block. null
when it is a pending block.
miner
20-byte DATA
The address of the beneficiary to whom the mining rewards were given.
mixHash
32-byte DATA
The hash which proves combined with the nonce that a sufficient amount of computation has been carried out on this block.
nonce
8-byte DATA
The hash of the generated proof-of-work.
number
QUANTITY
The block number. null
when it is a pending block.
parentHash
32-byte DATA
Hash of the parent block.
receiptsRoot
32-byte DATA
The root of the receipts trie of the block.
sha3Uncles
32-byte DATA
The SHA3 of the uncles data in the block.
size
QUANTITY
Integer of the size of this block in bytes.
stateRoot
32-byte DATA
The root of the final state trie of the block.
timestamp
QUANTITY
The Unix timestamp for when the block was collated.
totalDifficulty
QUANTITY
The total blockScore of the chain until this block
transactionsRoot
32-byte DATA
The root of the transaction trie of the block.
transactions
Array
Array of transaction objects, or 32-byte transaction hashes depending on the last given parameter.
uncles
Array
Array of uncle hashes.
Number | 32-byte DATA | TAG
The block number or hash. Or the string "earliest"
, "latest"
or "pending"
as in default block parameter.
32-byte DATA
The hash of a block.
QUANTITY
The uncle's index position.
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in default block parameter.
QUANTITY
The uncle's index position.
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in default block parameter.
QUANTITY
Integer of the number of transactions in this block.
32-byte DATA
Hash of a block
QUANTITY
Integer of the number of transactions in this block.
QUANTITY | TAG
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in default block parameter.
QUANTITY
Integer of the number of transactions in this block. It returns null
if there is no matching block.
32-byte DATA
Hash of a block
QUANTITY
Integer of the number of transactions in this block. It returns null
if there is no matching block.
20-byte DATA
Address of the storage.
QUANTITY
Integer of the position in the storage.
QUANTITY | TAG | HASH
Integer or hexadecimal block number, or the string "earliest"
, "latest"
or "pending"
as in default block parameter, or block hash.
DATA
The value at this storage position.
Boolean
true
if the client is mining, otherwise false
.
startingBlock
QUANTITY
The block at which the import started (will only be reset, after the sync reached his head).
currentBlock
QUANTITY
The current block, same as eth_blockNumber
.
highestBlock
QUANTITY
The estimated highest block.
pulledStates
QUANTITY
The number of state entries processed until now. If the sync mode is not "fast", zero is returned.
knownStates
QUANTITY
The number of known state entries that still need to be pulled. If the sync mode is not "fast", zero is returned.