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": {}
}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": {}
}data — the 32-byte hash of the block.quantity — the transaction index position within the block, encoded as hexadecimal.result — the transaction object, or null when no transaction was found:
blockHash — hash of the block containing this transactionblockNumber — number of the block containing this transactionfrom — address of the sendergas — gas provided by the sendergasPrice — gas price in weihash — hash of the transactioninput — the data sent along with the transactionnonce — number of transactions made by the senderto — address of the receivertransactionIndex — integer of the transaction’s index positionvalue — value transferred in weiv, r, s — signature valueseth_getTransactionByBlockHashAndIndex code examplesconst { 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();
eth_getTransactionByBlockHashAndIndex is iterating through all transactions in a block when analyzing block contents, or retrieving specific transactions based on their execution order.Was this page helpful?