Skip to main content
EVM

eth_getTransactionByBlockHashAndIndex

Summary: Get transaction by block hash and index

This request returns information about a transaction for the provided block hash and transaction index position.

Parameters

blockHash
string
required

A string representing the hash (32 bytes) of a block.

Pattern: ^0x[0-9a-f]{64}$


transactionIndex
string
required

The position in the block in hexadecimal.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Returns

eth_getTransactionByBlockHashAndIndexResponse
oneOf

null

Not Found (null).

Contextual information
object
required

Contextual information

blockHash
string

Block hash, 32 byte hex identifier for the block derived from the block header.

Pattern: ^0x[0-9a-f]{64}$

blockNumber
string

Block number as hex-encoded unsigned integer.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

from
string

Sender's address.

Pattern: ^0x[0-9a-fA-F]{40}$

hash
string

32 byte hex identifier for the transaction hash.

Pattern: ^0x[0-9a-f]{64}$

transactionIndex
string

Transaction index.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Customize request
Parameter
Value
string
string

Request

curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockHashAndIndex",
"params": ["0x3ff53efeec688238a8ecc0a1404221d1be3723aa6531f12f4d635dc8e7824779","0x2"],
"id": 1
}'

Example response

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0x3ff53efeec688238a8ecc0a1404221d1be3723aa6531f12f4d635dc8e7824779",
"blockNumber": "0x49b95c",
"chainId": "0xe708",
"from": "0x05cc939ac053dc47366fe8032f9be00f5f33b508",
"gas": "0x439d0",
"gasPrice": "0x3dfd240",
"hash": "0x8b04f98bec033ccc46e13f01ed75e0b2b12c0dc8b7d7d16102cf2b4addeaa3b8",
"input": "0x83bd37f900011a51b19ce03dbe0cb44c1528e34a7edd7771e9af000...",
"nonce": "0x8d",
"r": "0xbc381ffdf71e5934df37913906305d88e06daf0051e69e42cabe4539e6fc4c58",
"s": "0x4d65409fdc70bb2d14926b038ac7a064d8cce583df50efb424438dfd9333d578",
"to": "0x2d8879046f1559e53eb052e949e9544bcb72f414",
"transactionIndex": "0x2",
"type": "0x0",
"v": "0x1ce33",
"value": "0x0"
}
}