eth_getBlockByNumber | Optimism

Optimism API method that retrieves a block's information by its number. The block number is a sequential identifier for each block in the blockchain.

👍

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • blockNumber — the number of the block to retrieve, encoded as a hexadecimal string. For example, 0x6f5f828 represents block number 116783144.
  • fullTransactionObjects — a boolean indicating whether to return full transaction objects or only their hashes. If true, full transaction objects are returned; if false, only the hashes of the transactions are returned.

Response

  • result — an object containing the block's information, including the block number, timestamp, transactions, and more. If fullTransactionObjects is true, this will include detailed information about each transaction in the block.

Use case

The eth_getBlockByNumber method is useful for applications that need to retrieve specific blocks from the blockchain based on their block number. This can include block explorers, wallets, or any application that requires detailed information about a particular block or its transactions.

Try the eth_getBlockByNumber RPC method yourself

Language
Click Try It! to start a request and see the response here!