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": {}
}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": {}
}quantity|tag — the block number as a hexadecimal string, or one of the following block tags:
latest — the most recent block in the canonical chainearliest — the genesis blockpending — the pending state/transactionsquantity — 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_getTransactionByBlockNumberAndIndex code examplesconst { 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();
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.Was this page helpful?