> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.chainstack.com/feedback

```json
{
  "path": "/reference/fantom-getblockbyhash",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# eth_getBlockByHash | Fantom

Fantom Chain API method that returns information about the block matching the given block hash. This method can be useful for analyzing a block and its transactions.

<Check>
  **Get your own node endpoint today**

  [Start for free](https://console.chainstack.com/) and get your app to production levels immediately. No credit card required.

  You can sign up with your GitHub, X, Google, or Microsoft account.
</Check>

## Parameters

* `hash` — the hash of the block
* `boolean` — if `true`, it returns the details of each transaction. If `false`, only the hashes of the transactions.

## Response

* `object` — block object, or `null` when no block was found.
  * `number` — the block number of the requested block, encoded as hexadecimal. `null` if the block is pending.
  * `hash` — the block hash of the requested block. `null` if the block is pending.
  * `parenthash` — the previous block's hash used to generate the current block. Also known as the 'parent block'.
  * `nonce` — the hash used to demonstrate proof-of-work. `null` if the block is pending. It returns `0x0000000000000000` when the consensus is proof-of-stake.
  * `sha3uncles` — the hash of the list of uncles included in the block. It is used to identify the block uniquely and to verify the integrity of the block's data.
  * `logsbloom` — the bloom filter for the block logs, a data structure that allows for efficient membership testing of elements in a set, in this case, the logs included in the block. `null` if pending.
  * `transactionsroot` — the root of the transaction trie of the block. The `transactionsRoot` field allows nodes to verify the integrity of the transactions in a block.
  * `stateroot` — the root of the final state trie of the block. The `stateroot` field is included in the block header and is used to verify the integrity of the state at the time the block was processed
  * `receiptsroot`— the root of the block's receipts trie. This is a 32-byte hash of the root node of the receipts trie for all transactions in the block. It is used to verify the integrity of the receipt data for all transactions in the block.
  * `miner` — the address of the miner receiving the reward.
  * `difficulty` — a measure of how hard it is to find a valid block for the blockchain. It is a number that increases as more miners join the network and more blocks are added to the chain. Encoded as hexadecimal.
  * `totaldifficulty`is the cumulative sum of the difficulty of all blocks that have been mined in the network since its inception. It measures the network's overall security and integrity.
  * `extradata` — the extra data included in a block by the miner who mined it. It often includes messages or other information related to the block.
  * `size` — the size of this block in bytes as an integer value, encoded as hexadecimal.
  * `gaslimit` — the maximum gas allowed in this block, encoded as hexadecimal.
  * `gasused` — the total used gas by all transactions in this block, encoded as hexadecimal.
  * `timestamp` — the Unix timestamp for when the block was collated.
  * `transactions` — an array of transaction objects. See [eth\_getTransactionByHash](/reference/fantom-gettransactionbyhash) for the exact shape.
  * `uncles` — the array of uncle hashes.

## `eth_getBlockByHash` code examples

<CodeGroup>
  ```javascript web3.js theme={"system"}
  const { Web3 } = require("web3");
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const web3 = new Web3(NODE_URL);

  async function getBlock(blockHash) {
      const block = await web3.eth.getBlock(blockHash, false);
      console.log(block);
    }
    
  getBlock("0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd")
  ```

  ```javascript ethers.js theme={"system"}
  const ethers = require('ethers');
  const NODE_URL = "CHAINSTACK_NODE_URL";
  const provider = new ethers.JsonRpcProvider(NODE_URL);

  const eth_getBlockByHash = async () => {
      const blockByNumber = await provider.send("eth_getBlockByHash", ["0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd",false]);
       console.log(blockByNumber);
     };

  eth_getBlockByHash();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"
  web3 = Web3(Web3.HTTPProvider(node_url))

  print(web3.eth.get_block("0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd", False))
  ```
</CodeGroup>

## Use case

The `eth_getBlockByHash` is excellent for analytics purposes. For example, it can be used to quickly find out the hashes of transactions that create new smart contracts. The `transactions` field, an array of all the transactions within the block, is returned in the response. By iterating through this array and examining each transaction's `to` field, a user can determine which transactions in the block are creating new smart contracts.


## OpenAPI

````yaml /openapi/fantom_node_api/eth_getBlockByHash.json POST /4ab982aa70a7baead515ffdb5915df3f
openapi: 3.0.0
info:
  title: Fantom Node API
  version: 1.0.0
  description: This is an API for interacting with a Fantom node.
servers:
  - url: https://fantom-mainnet.core.chainstack.com
security: []
paths:
  /4ab982aa70a7baead515ffdb5915df3f:
    post:
      tags:
        - upload
      summary: eth_getBlockByHash
      operationId: getBlockByHash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_getBlockByHash
                params:
                  type: array
                  items:
                    anyOf:
                      - type: string
                        title: Block Hash
                        description: The hash identifying the block.
                      - type: boolean
                        title: Transaction selector
                        description: >-
                          True for the full transactions, false for only the
                          transaction hashes.
                  default:
                    - >-
                      0x0004344d0000028b41ba91f2221f809b62389befbfe00e9f62c6c238336a32cd
                    - false
      responses:
        '200':
          description: The block information
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: object

````