---
title: getTransactionByHash
slug: api/gettransactionbyhash
createdAt: 2022-12-06T18:10:45.000Z
---

{
  "id": "tQhqHTSFFm2UfHDDDKNFc",
  "data": {
    "url": "{{ENVIRONMENT}}",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "Content-Type",
          "type": "string",
          "example": "application/json",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "{\n\t\"jsonrpc\":\"2.0\",\n\t\"method\":\"eth_getTransactionByHash\",\n\t\"params\":[\n\t\t\"0xb2fea9c4b24775af6990237aa90228e5e092c56bdaee74496992a53c208da1ee\"\n\t],\n\t\"id\":1\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "<p>Returns the information about a transaction requested by transaction hash.</p>\n<p><strong>Parameters</strong></p>\n<p><code>DATA</code>, 32 Bytes - hash of a transaction</p>\n<pre><code>params: [\r\n   \"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238\"\r\n]\n</code></pre>\n<p><strong>Returns</strong></p>\n<p><code>Object</code> - A transaction object, or null when no transaction was found:</p>\n<p><code>hash</code>: <code>DATA</code>, 32 Bytes - hash of the transaction.</p>\n<p><code>nonce</code>: <code>QUANTITY</code> - the number of transactions made by the sender prior to this one.</p>\n<p><code>blockHash</code>: <code>DATA</code>, 32 Bytes - hash of the block where this transaction was in. <code>null</code> when its pending.</p>\n<p><code>blockNumber</code>: <code>QUANTITY</code> - block number where this transaction was in. <code>null</code> when its pending.</p>\n<p><code>transactionIndex</code>: <code>QUANTITY</code> - integer of the transactions index position in the block. <code>null</code> when its pending.</p>\n<p><code>from</code>: <code>DATA</code>, 20 Bytes - address of the sender.</p>\n<p><code>to</code>: <code>DATA</code>, 20 Bytes - address of the receiver. <code>null</code> when its a contract creation transaction.</p>\n<p><code>value</code>: <code>QUANTITY</code> - value transferred in Wei.</p>\n<p><code>gasPrice</code>: <code>QUANTITY</code> - gas price provided by the sender in Wei.</p>\n<p><code>gas</code>: <code>QUANTITY</code> - gas provided by the sender.</p>\n<p><code>input</code>: <code>DATA</code> - the data send along with the transaction.</p>",
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{ENVIRONMENT}} \\\n     --header 'accept: application/json'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{ENVIRONMENT}}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{ENVIRONMENT}}\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{ENVIRONMENT}}\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": ""
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}