> ## 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_newBlockFilter | Monad

> Monad API method that creates a filter in the node to notify when a new block arrives. Use eth_getFilterChanges to poll for new blocks.

Monad API method that creates a filter in the node to notify when a new block arrives. Use `eth_getFilterChanges` to poll for new blocks.

## Parameters

* `none`

## Response

* `result` — the filter ID, used to poll for new blocks with `eth_getFilterChanges`.

## `eth_newBlockFilter` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const { ethers } = require("ethers");

  const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

  async function createBlockFilter() {
    const filterId = await provider.send("eth_newBlockFilter", []);
    console.log("Filter ID:", filterId);

    // Poll for new blocks
    setInterval(async () => {
      const changes = await provider.send("eth_getFilterChanges", [filterId]);
      if (changes.length > 0) {
        console.log("New blocks:", changes);
      }
    }, 2000);
  }

  createBlockFilter();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3
  import time

  node_url = "CHAINSTACK_NODE_URL"

  web3 = Web3(Web3.HTTPProvider(node_url))

  # Create the block filter
  filter_id = web3.eth.filter('latest').filter_id
  print(f'Filter ID: {filter_id}')

  # Poll for new blocks
  while True:
      changes = web3.eth.get_filter_changes(filter_id)
      if changes:
          print(f'New blocks: {changes}')
      time.sleep(2)
  ```
</CodeGroup>

## Use case

A practical use case for `eth_newBlockFilter` is building applications that need to react to new blocks as they are mined, such as block explorers, monitoring tools, or HTTP-only clients that can't hold a persistent WebSocket connection. For real-time streaming, prefer `eth_subscribe("newHeads")` over WebSocket — see the [event-monitoring tutorial](/docs/monad-tutorial-event-monitoring).


## OpenAPI

````yaml openapi/monad_node_api/blocks_info/eth_newBlockFilter.json POST /
openapi: 3.0.0
info:
  title: Monad Node API
  version: 1.0.0
  description: This is an API for interacting with a Monad node.
servers:
  - url: https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800
security: []
paths:
  /:
    post:
      tags:
        - Blocks info
      summary: eth_newBlockFilter
      operationId: eth_newBlockFilter
      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_newBlockFilter
                params:
                  type: array
                  default: []
      responses:
        '200':
          description: >-
            A filter ID that can be used with eth_getFilterChanges to poll for
            new blocks
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: string
                    description: The filter ID

````