{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "latest",
    "0x0"
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "blockNumber": "0x1b4",
    "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "hash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
    "input": "0x",
    "nonce": "0x1",
    "to": "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
    "transactionIndex": "0x0",
    "value": "0x2710",
    "v": "0x25",
    "r": "0xc9cf86333bcb065d140032ecaab5d9281bde80f21b9687b3e94161de42d51895",
    "s": "0x727a108a0b8d101465414033c3f705a9c7b826e596766046ee1183dbc8aeaa68"
  }
}

Defined in the Ethereum JSON-RPC Specification

Returns information about a transaction by block number and transaction index position.

Parameters

blockParameter
string
required

Integer block number, or the string “latest”, “earliest” or “pending”.

transactionIndex
string
required

Integer of the transaction index position as a hexadecimal string.

Returns

result
object

A transaction object, or null when no transaction was found.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "latest",
    "0x0"
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "blockHash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "blockNumber": "0x1b4",
    "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
    "gas": "0x76c0",
    "gasPrice": "0x9184e72a000",
    "hash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
    "input": "0x",
    "nonce": "0x1",
    "to": "0x85h43d8a49eeb85d32cf465507dd71d507100c1",
    "transactionIndex": "0x0",
    "value": "0x2710",
    "v": "0x25",
    "r": "0xc9cf86333bcb065d140032ecaab5d9281bde80f21b9687b3e94161de42d51895",
    "s": "0x727a108a0b8d101465414033c3f705a9c7b826e596766046ee1183dbc8aeaa68"
  }
}

Error Handling

CodeMessageDescription
-32602Invalid parametersInvalid block parameter or transaction index
4100Requested method not supportedThe method is not supported by the wallet

Transaction indices start at 0x0 for the first transaction in a block. If the index exceeds the number of transactions, null is returned.