eth_getTransactionByBlockNumberAndIndex RPC Method
Fetches a single transaction from a block, identified by block number and the transaction's position index.
Parameters#
stringrequired
Block number (hex) or tag: latest, safe, finalized, pending.
stringrequired
Zero-based transaction index within the block, hex-encoded.
Result#
object | null - The transaction object, or null if no match is found.
Code sample#
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"latest",
"0x0"
],
"id": 1
}
Response#
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"type": "0x2",
"hash": "0x0e07d8b53ed3d91314c80e53cf25bcde02084939395845cbb625b029d568135c",
"blockNumber": "0x4b7",
"transactionIndex": "0x0",
"from": "0x3cf412d970474804623bb4e3a42de13f9bca5436",
"to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
"gas": "0x46a02",
"value": "0x0",
"input": "0x5ae401dc...",
"nonce": "0x16d"
}
}
Try It