API ReferenceEVM RPC APIeth_getTransactionByBlockHashAndIndexOn this pageeth_getTransactionByBlockHashAndIndexGet Transaction By Hash And IndexPOSThttps://site1.moralis-nodes.com/:chain/:apiKeyRetrieves 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.NotePlease refer to RPC schema page for more details on the RPC params and RPC response definitions of the RPC method.PATH PARAMSchainstringrequiredThe blockchain to interact with.ethsepoliaholeskybasebase-sepoliapolygonamoybscbsc-testnetarbitrumarbitrum-sepoliaoptimismoptimism-sepoliagnosisgnosis-testnetlinealinea-sepoliaavalanchemoonbeammoonrivermoonbaseblastblast-sepoliamantlemantle-sepoliapolygon-zkevmpolygon-zkevm-cardonazksynczksync-sepoliazetachainzetachain-testnetfantomopbnbflowflow-testnetroninronin-testnetlisklisk-sepoliapulseapiKeystringrequiredYour API key for authentication.BODY PARAMRequest BodyobjectrequiredThe request payload for retrieving a transaction by block hash and transaction index.{ "jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockHashAndIndex" }Responses200Returns the transaction at the specified index in the given block.400Bad Request404Not Found429Too Many Requests500Internal Server ErrorTest Live APIcURLNode.jsPythonGoPHPcurl --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"}'// Node.js v18+ has native fetch support// No additional dependencies requiredconst options = { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' }, body: JSON.stringify({ "jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockHashAndIndex" })};fetch('https://site1.moralis-nodes.com/eth/YOUR_API_KEY', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));# Dependencies to install:# $ python -m pip install requestsimport requestsurl = "https://site1.moralis-nodes.com/eth/YOUR_API_KEY"payload = { "jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockHashAndIndex"}headers = { "Accept": "application/json", "Content-Type": "application/json"}response = requests.request("POST", url, json=payload, headers=headers)print(response.text)package mainimport ( "fmt" "strings" "net/http" "io")func main() { url := "https://site1.moralis-nodes.com/eth/YOUR_API_KEY" payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getTransactionByBlockHashAndIndex\"}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('POST', 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY', [ 'body' => '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionByBlockHashAndIndex"}', 'headers' => [ 'Accept' => 'application/json', 'Content-Type' => 'application/json', ],]);echo $response->getBody();Response Example200 Returns the transaction at the specified index in the given block.{ "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"}