eth_getTransactionByBlockNumberAndIndex | Optimism

Optimism API method eth_getTransactionByBlockNumberAndIndex retrieves information about a transaction by specifying the block number and the transaction's index position within the block. This method is useful for fetching specific transactions when the block number and index are known.

👍

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.
  • transactionIndex — the index position of the transaction in the block, specified as a hexadecimal. The example uses "0x1".

Response

  • result — an object containing details about the transaction, including the block hash, block number, from address, gas used, gas price, hash, input data, nonce, to address, transaction index, value transferred, and the signature components (v, r, s).

Use case

The eth_getTransactionByBlockNumberAndIndex method is essential for:

  • Applications that need to retrieve specific transactions from a known block for analysis or display.
  • Services that monitor blocks and transactions for security, compliance, or other operational reasons.
  • Tools that reconstruct transaction sequences within blocks for auditing or forensic purposes.

Try the eth_getTransactionByBlockNumberAndIndex RPC method yourself

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