Skip to main content
POST
/
eth_getTransactionByBlockNumberAndIndex
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "latest",
    "0x0"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": {}
}
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.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getTransactionByBlockNumberAndIndex
params
string[]

Response

200 - application/json

The transaction object.

jsonrpc
string
id
integer
result
object | null