Skip to main content
POST
/
eth_getTransactionByBlockHashAndIndex
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": [
    "0xf3cf930f1b4d9637134d09f126c57c30c3f4f40edf10ba502486b26d14b4f944",
    "0x0"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": {}
}
Monad API method that returns information about a transaction by block hash and transaction index position. This method allows you to retrieve a specific transaction from a block when you know both the block hash 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

  • data — the 32-byte hash of the block.
  • 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_getTransactionByBlockHashAndIndex code examples

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

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

async function getTransactionByIndex() {
  const blockHash = "0xf3cf930f1b4d9637134d09f126c57c30c3f4f40edf10ba502486b26d14b4f944";
  const index = "0x0"; // First transaction
  const tx = await provider.send("eth_getTransactionByBlockHashAndIndex", [blockHash, index]);
  console.log(tx);
}

getTransactionByIndex();

Use case

A practical use case for eth_getTransactionByBlockHashAndIndex is iterating through all transactions in a block when analyzing block contents, or retrieving specific transactions based on their execution order.

Body

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

Response

200 - application/json

The transaction object.

jsonrpc
string
id
integer
result
object | null