API ReferenceEVM RPC APIeth_getTransactionByBlockNumberAndIndexVersion: 2.2On this pageeth_getTransactionByBlockNumberAndIndexGet Transaction By Block Number And IndexPOSThttps://site1.moralis-nodes.com/:chain/:apiKeyRetrieves a specific transaction by its block number (which can be specified as a hexadecimal or as one of the special strings 'latest', 'earliest', 'pending') and its index position within the block.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-sepoliaapiKeystringrequiredYour API key for authentication.BODY PARAMjsonrpcstringrequiredJSON-RPC version (typically 2.0).idnumberrequiredThe request identifier.methodstringrequiredThe JSON-RPC method being invoked.paramsrpcArrayrequiredParameters for the method, including the block number and the transaction index.[ "latest", "0x0" ]Responses200 Returns the transaction at the specified index in the given block.objectDetails of the transaction at the specified index in the given block.Test Live APINode.jsPythoncURLGoPHP// Dependencies to install:// $ npm install node-fetch --save// add "type": "module" to package.jsonimport fetch from 'node-fetch';const options = { method: 'POST', headers: { accept: 'application/json', 'content-type': 'application/json' }, body: JSON.stringify({ "jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionByBlockNumberAndIndex" })};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_getTransactionByBlockNumberAndIndex"}headers = { "Accept": "application/json", "Content-Type": "application/json"}response = requests.request("POST", url, json=payload, headers=headers)print(response.text)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_getTransactionByBlockNumberAndIndex"}'package mainimport ( "fmt" "strings" "net/http" "io/ioutil")func main() { url := "https://site1.moralis-nodes.com/eth/YOUR_API_KEY" payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getTransactionByBlockNumberAndIndex\"}") 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, _ := ioutil.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_getTransactionByBlockNumberAndIndex"}', '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"}