hmy_getBlockByNumber

GetBlockByNumber

Get block by its index in the blockchain.

API v1

Parameters

  1. String - The block number.

  2. Boolean - If true, the returned block will contain all transactions in the block.

Returns

  • number - Number: The block number. null when its pending block.

  • hash 32 Bytes - String: Hash of the block. null when its pending block.

  • parentHash 32 Bytes - String: Hash of the parent block.

  • nonce 8 Bytes - String: Hash of the generated proof-of-work. null when its pending block.

  • logsBloom 256 Bytes - String: The bloom filter for the logs of the block. null when its pending block.

  • transactionsRoot 32 Bytes - String: The root of the transaction trie of the block

  • stateRoot 32 Bytes - String: The root of the final state trie of the block.

  • miner - String: The address of the beneficiary to whom the mining rewards were given.

  • difficulty - String: Integer of the difficulty for this block.

  • extraData - String: The “extra data” field of this block.

  • size - Number: Integer the size of this block in bytes.

  • gasLimit - Number: The maximum gas allowed in this block.

  • gasUsed - Number: The total used gas by all transactions in this block.

  • timestamp - Number: The unix timestamp for when the block was collated.

  • stakingTransactions - Array: Array of staking transactions object; are present by default

  • transactions - Array: Array of transaction objects; absent if second parameter is false.

  • uncles - Array: Array of uncle hashes.

Sample Curl Request

Sample Curl Response

API v2

Parameters

  1. Number - The block number.

  2. blockArgs - optional args struct in json format (should be used just with { })

    1. fullTx - Bool: To show full tx or not

    2. withSigners- Bool: Include block signes in blocks or not

    3. inclStaking - Bool: To show staking txs or not

Returns

  • number - Number: The block number. null when its pending block.

  • hash 32 Bytes - String: Hash of the block. null when its pending block.

  • parentHash 32 Bytes - String: Hash of the parent block.

  • nonce 8 Bytes - String: Hash of the generated proof-of-work. null when its pending block.

  • logsBloom 256 Bytes - String: The bloom filter for the logs of the block. null when its pending block.

  • transactionsRoot 32 Bytes - String: The root of the transaction trie of the block

  • stateRoot 32 Bytes - String: The root of the final state trie of the block.

  • miner - String: The address of the beneficiary to whom the mining rewards were given.

  • difficulty - String: Integer of the difficulty for this block.

  • extraData - String: The “extra data” field of this block.

  • size - Number: Integer the size of this block in bytes.

  • gasLimit - Number: The maximum gas allowed in this block.

  • gasUsed - Number: The total used gas by all transactions in this block.

  • timestamp - Number: The unix timestamp for when the block was collated.

  • stakingTransactions - Array: Array of staking transactions object; absent if inclStaking is false, are present by default

  • transactions - Array: Array of transaction objects; absent if second parameter is false.

  • uncles - Array: Array of uncle hashes.

Sample Curl Request

Sample Curl Response

Last updated