> ## 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.

# eth_getBlockTransactionCountByNumber | Tempo

> Tempo API method that returns the number of transactions in a block specified by block number. eth_getBlockTransactionCountByNumber on Tempo via Chainstack.

Tempo API method that returns the number of transactions in a block specified by block number.

## Parameters

* `blockNumber` — the block number (hex) or tag (`latest`, `earliest`, `pending`)

## Response

* `result` — the number of transactions in the block encoded as hexadecimal

## `eth_getBlockTransactionCountByNumber` code examples

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

  const getTransactionCount = async (blockNumber) => {
      const count = await provider.send("eth_getBlockTransactionCountByNumber", [blockNumber]);
      console.log(`Block ${blockNumber}: ${parseInt(count, 16)} transactions`);
    };

  // Get transaction count for latest block
  getTransactionCount("latest");

  // Get transaction count for a specific block
  getTransactionCount("0x564000");
  ```

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

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

  # Get transaction count for latest block
  result = web3.provider.make_request("eth_getBlockTransactionCountByNumber", ["latest"])
  count = int(result['result'], 16)
  print(f"Latest block: {count} transactions")

  # Using web3.py method
  count = web3.eth.get_block_transaction_count('latest')
  print(f"Latest block (via web3.py): {count} transactions")
  ```

  ```bash cURL theme={"system"}
  curl -X POST "CHAINSTACK_NODE_URL" \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc": "2.0", "method": "eth_getBlockTransactionCountByNumber", "params": ["latest"], "id": 1}'
  ```
</CodeGroup>


## OpenAPI

````yaml openapi/tempo_node_api/blocks_info/eth_getBlockTransactionCountByNumber.json POST /
openapi: 3.0.0
info:
  title: eth_getBlockTransactionCountByNumber Tempo example
  version: 1.0.0
  description: This is an API example for eth_getBlockTransactionCountByNumber for Tempo.
servers:
  - url: https://tempo-mainnet.core.chainstack.com/c3ce2925b51f1ed18719fe8a23bbdccf
security: []
paths:
  /:
    post:
      tags:
        - Blocks info
      summary: eth_getBlockTransactionCountByNumber
      operationId: tempo-eth-getBlockTransactionCountByNumber
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_getBlockTransactionCountByNumber
                params:
                  type: array
                  items: {}
                  default:
                    - latest
                  description: Block number (hex) or tag
                id:
                  type: integer
                  default: 1
      responses:
        '200':
          description: Transaction count in block
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string
                    description: Number of transactions in the block encoded as hexadecimal

````