Returns information about a transaction by block number and transaction index position.
Request Format
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"0x1442e",
"0x2"
],
"id": 1
}
Response Format
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x510efccf44a192e6e34bcb439a1947e24b86244280762cbb006858c237093fda",
"blockNumber": "0x422",
"chainId": 2018,
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0x5208",
"gasPrice": "0x3b9aca00",
"hash": "0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44",
"input": "0x",
"nonce": "0x1",
"to": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
"transactionIndex": "0x0",
"value": "0x4e1003b28d9280000",
"v": "0xfe7",
"r": "0x84caf09aefbd5e539295acc67217563438a4efb224879b6855f56857fa2037d3",
"s": "0x5e863be3829812c81439f0ae9d8ecb832b531d651fb234c848d1bf45e62be8b9"
}
}
Parameters
- Block (
BlockNumberOrTag
): The block number or a special tag (latest
,earliest
,pending
). - Transaction Index (
uint
): The index position of the transaction within the block.
Return Value
- Transaction Information (
TransactionInfo
ornotFound
): If the transaction exists, returns an object containing:blockHash
(hash32
): Hash of the block containing this transaction.blockNumber
(uint
): Block number where this transaction was included.chainId
(uint
): Chain ID of the transaction.from
(address
): Sender’s Ethereum address.gas
(uint
): Gas limit for the transaction.gasPrice
(uint
): Gas price used for the transaction.hash
(hash32
): Transaction hash.input
(bytes
): Input data of the transaction.nonce
(uint
): Nonce of the transaction sender.to
(address
): Recipient's Ethereum address.transactionIndex
(uint
): Index position in the block.value
(uint
): Amount of ETH transferred.v
,r
,s
: Signature values.- Returns
null
if the transaction is not found.
Example
Request
{
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex",
"params": [
"0x1442e",
"0x2"
],
"id": 1
}
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x510efccf44a192e6e34bcb439a1947e24b86244280762cbb006858c237093fda",
"blockNumber": "0x422",
"chainId": 2018,
"from": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
"gas": "0x5208",
"gasPrice": "0x3b9aca00",
"hash": "0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44",
"input": "0x",
"nonce": "0x1",
"to": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
"transactionIndex": "0x0",
"value": "0x4e1003b28d9280000",
"v": "0xfe7",
"r": "0x84caf09aefbd5e539295acc67217563438a4efb224879b6855f56857fa2037d3",
"s": "0x5e863be3829812c81439f0ae9d8ecb832b531d651fb234c848d1bf45e62be8b9"
}
}
Notes
- If the transaction is pending, some fields like
blockHash
andblockNumber
may benull
. - Useful for retrieving transaction details using block number and transaction index.