---
title: getBlockByHash
slug: api/getblockbyhash
createdAt: 2022-12-06T18:10:45.000Z
---

{
  "id": "xfXHrgATEhbUm-7afjeb5",
  "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_getBlockByHash\",\n\t\"params\":[\n\t\t\"0xad1328d13f833b8af722117afdc406a762033321df8e48c00cd372d462f48169\", \n\t\ttrue\n\t],\n\t\"id\":1\n}",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "<p>Returns information about a block by hash.</p>\n<p><strong>Parameters</strong></p>\n<p><code>DATA</code>, 32 Bytes - Hash of a block.</p>\n<p><code>Boolean</code> - If true it returns the full transaction objects, if false only the hashes of the transactions.</p>\n<pre><code>params: [\r\n   '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',\r\n   true\r\n]\n</code></pre>\n<p><strong>Returns</strong></p>\n<p><code>Object</code> - A block object, or null when no block was found:</p>\n<p><code>number</code>: <code>QUANTITY</code> - the block number. null when its pending block.</p>\n<p><code>hash</code>: <code>DATA</code>, 32 Bytes - hash of the block. <code>null</code> when its pending block.</p>\n<p><code>parentHash</code>: <code>DATA</code>, 32 Bytes - hash of the parent block.</p>\n<p><code>nonce</code>: <code>DATA</code>, 8 Bytes - hash of the generated proof-of-work. <code>null</code> when its pending block.</p>\n<p><code>sha3Uncles</code>: <code>DATA</code>, 32 Bytes - SHA3 of the uncles data in the block.</p>\n<p><code>logsBloom</code>: <code>DATA</code>, 256 Bytes - the bloom filter for the logs of the block. <code>null</code> when its pending block.</p>\n<p><code>transactionsRoot</code>: <code>DATA</code>, 32 Bytes - the root of the transaction trie of the block.</p>\n<p><code>stateRoot</code>: <code>DATA</code>, 32 Bytes - the root of the final state trie of the block.</p>\n<p><code>receiptsRoot</code>: <code>DATA</code>, 32 Bytes - the root of the receipts trie of the block.</p>\n<p><code>miner</code>: <code>DATA</code>, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.</p>\n<p><code>difficulty</code>: <code>QUANTITY</code> - integer of the difficulty for this block.</p>\n<p><code>totalDifficulty</code>: <code>QUANTITY</code> - integer of the total difficulty of the chain until this block.</p>\n<p><code>extraData</code>: <code>DATA</code> - the \"extra data\" field of this block.</p>\n<p><code>size</code>: <code>QUANTITY</code> - integer the size of this block in bytes.</p>\n<p><code>gasLimit</code>: <code>QUANTITY</code> - the maximum gas allowed in this block.</p>\n<p><code>gasUsed</code>: <code>QUANTITY</code> - the total used gas by all transactions in this block.</p>\n<p><code>timestamp</code>: <code>QUANTITY</code> - the unix timestamp for when the block was collated.</p>\n<p><code>transactions</code>: <code>Array</code> - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.</p>\n<p><code>uncles</code>: <code>Array</code> - Array of uncle hashes.</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": ""
    }
  ]
}