Register and show off your project at Ethereum QuickPitch and win $10,000. Apply now


eth_getBlockByNumber RPC method

The API credit value for this method is 2 . To learn more about API credits and each method's value, visit the API Credits page.


  1. Quantity or Tag - Integer block number, or the string 'latest', 'earliest' or 'pending'. For more information, see the default block parameter description in Ethereum's documentation.
  2. Boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.


  1. Object - A block object, or null when no block was found.

    number - The block number of the requested block encoded as a hexadecimal. null when its pending block.

    hash - The block hash of the requested block. null when its pending block.

    parentHash - Hash of the parent block.

    nonce - Hash of the generated proof-of-work. null when its pending block.

    sha3Uncles - SHA3 of the uncles data in the block.

    logsBloom - The bloom filter for the logs of the block. null when its pending block.

    transactionsRoot - The root of the transaction trie of the block.

    stateRoot - The root of the final state trie of the block.

    receiptsRoot - The root of the receipts trie of the block.

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

    difficulty - Integer of the difficulty for this block encoded as a hexadecimal.

    totalDifficulty - Integer of the total difficulty of the chain until this block encoded as a hexadecimal.

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

    size - The size of this block in bytes as an Integer value encoded as hexadecimal.

    gasLimit - The maximum gas allowed in this block encoded as a hexadecimal.

    gasUsed - The total used gas by all transactions in this block encoded as a hexadecimal.

    timestamp - The unix timestamp for when the block was collated.

    transactions - Array of transaction objects, or 32 Bytes transaction hashes depending on the second Boolean parameter in request.

    uncles - Array of uncle hashes.

    baseFeePerGas - A string of the base fee encoded as a hexadecimal.

    mixHash - A string of a 256-bit hash encoded as a hexadecimal.

Code Examples:

require 'ethereum.rb'
client ='')
blockData = client.eth_get_block_by_number('0xc5043f',false)
puts blockData["result"]
Ready to get started? Create a free account