Skip to main content

Don't have an RPC Node yet?

Start using RPC Nodes in your project today.

Get your free RPC Node

eth_getTransactionByBlockHashAndIndex

Get Transaction By Hash And Index

POSThttps://site1.moralis-nodes.com/:chain/:apiKey

Retrieves a single transaction by its block hash and index position within the block. This allows for precise querying of transactions when the block hash and transaction's index are known.

Note

Please refer to RPC schema page for more details on the RPC params and RPC response definitions of the RPC method.

PATH PARAMS
chainstringrequired
The blockchain to interact with.
apiKeystringrequired
Your API key for authentication.
BODY PARAM
Request Bodyobjectrequired
The request payload for retrieving a transaction by block hash and transaction index.
Responses
200Returns the transaction at the specified index in the given block.
400Bad Request
404Not Found
429Too Many Requests
500Internal Server Error
curl --request POST \
--url 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getTransactionByBlockHashAndIndex"
}
'
Response Example
{
"blockHash": "0x18173058d45f8aa984181fdfbfece01a93a971ea63e008231b2e15f151e0903f",
"blockNumber": "0x12b39a9",
"from": "0xbb936e46099df268a2c6537299b75cf3609a0541",
"gas": "0x2bace",
"gasPrice": "0x3bb9d4fcb",
"maxPriorityFeePerGas": "0x4c4b40",
"maxFeePerGas": "0x5666e04ce",
"hash": "0x6e760d4b659e9c68b943829b0f4adaa07f3e3c043ee8d4f4787045909ba63090",
"input": "0xa76dfc3b...",
"nonce": "0x1b00",
"to": "0x111111125421ca6dc452d289314280a0f8842a65",
"transactionIndex": "0x0",
"value": "0x214e8348c4f0000",
"type": "0x2",
"chainId": "0x1",
"v": "0x1",
"r": "0xf611431e6b44cbc02c4278915d979c9034b6d37b139b8c55ae428abbe9d52d4b",
"s": "0x1bc0fcf547e60d54daf313f840db039c3c1904c5b9724b9d7a8ec1f2abb46b53"
}