eth_getTransactionByBlockHashAndIndex RPC Method

Fetches a single transaction from a block, identified by the block hash and the transaction's position index.

Parameters#

stringrequired

32-byte block hash, hex-encoded.

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_getTransactionByBlockHashAndIndex",
  "params": [
    "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
    "0x0"
  ],
  "id": 1
}

Response#

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "type": "0x2",
    "hash": "0x0e07d8b53ed3d91314c80e53cf25bcde02084939395845cbb625b029d568135c",
    "blockHash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
    "blockNumber": "0x4b7",
    "transactionIndex": "0x0",
    "from": "0x3cf412d970474804623bb4e3a42de13f9bca5436",
    "to": "0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45",
    "gas": "0x46a02",
    "value": "0x0",
    "input": "0x5ae401dc...",
    "nonce": "0x16d"
  }
}
Try It