Skip to main content
Monad API method that returns information about a transaction by block number and transaction index position. This method allows you to retrieve a specific transaction using the block number and the transaction’s position within that block.
Get you own node endpoint todayStart 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

  • quantity|tag — the block number as a hexadecimal string, or one of the following block tags:
    • latest — the most recent block in the canonical chain
    • earliest — the genesis block
    • pending — the pending state/transactions
  • quantity — the transaction index position within the block, encoded as hexadecimal.

Response

  • result — the transaction object, or null when no transaction was found:
    • blockHash — hash of the block containing this transaction
    • blockNumber — number of the block containing this transaction
    • from — address of the sender
    • gas — gas provided by the sender
    • gasPrice — gas price in wei
    • hash — hash of the transaction
    • input — the data sent along with the transaction
    • nonce — number of transactions made by the sender
    • to — address of the receiver
    • transactionIndex — integer of the transaction’s index position
    • value — value transferred in wei
    • v, r, s — signature values

eth_getTransactionByBlockNumberAndIndex code examples

const { ethers } = require("ethers");

const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

async function getTransactionByIndex() {
  const blockNumber = "latest"; // Or use hex like "0x1234"
  const index = "0x0"; // First transaction
  const tx = await provider.send("eth_getTransactionByBlockNumberAndIndex", [blockNumber, index]);
  console.log(tx);
}

getTransactionByIndex();

Use case

A practical use case for eth_getTransactionByBlockNumberAndIndex is building block explorers that allow users to browse transactions sequentially within blocks, or analyzing the first or last transactions in recent blocks.