Skip to main content
EVM

eth_getTransactionByBlockNumberAndIndex

Summary: Get transaction by block identifier and index

This request returns information about a transaction by block number or tag and the transaction's index position.

Parameters

block oneOf
required

Block number or string tag.

Block number string

Block number in hexadecimal.

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

Block tag enum

See the default block parameter.

  • earliest: The lowest numbered block the client has available.
  • finalized: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination.
  • latest: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions.
  • pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool.

Enum:
"earliest"
"finalized"
"latest"
"pending"

transactionIndex string
required

The position in the block, in hexadecimal.

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

Returns

Returns the transaction information or "not found".
eth_getTransactionByBlockNumberAndIndexResponse 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
0x49b95c
oneOf
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_getTransactionByBlockNumberAndIndex",
"params": ["0x49b95c","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"
}
}