> For a complete page index, fetch https://docs.conduit.xyz/llms.txt

# eth_newFilter

POST https://rpc.plume.org/YOUR_API_KEY
Content-Type: application/json

Creates a filter object based on filter options to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.

⚡ Compute Units: [20 CU](https://docs.conduit.xyz/rpc-nodes/information/compute-units)

Reference: https://docs.conduit.xyz/rpc-nodes/json-rpc-reference/eth-new-filter

## Request

### Body (application/json)

This endpoint expects an object.

- `filter` (Filter, required) — Filter options object

## Response

### 200

Opaque filter ID returned by the server. Pass this back to `eth_getFilterChanges`, `eth_getFilterLogs`, or `eth_uninstallFilter`. Not a numeric quantity — treat as an opaque hex string.

- `string`

## Types

### Filter

Filter options. All fields are optional. Note that blockHash is mutually exclusive with fromBlock/toBlock: if blockHash is provided, fromBlock and toBlock must be omitted.

- `address` (FilterAddress, optional) — Contract address or array of addresses from which logs should originate
- `topics` (list of FilterTopicsItems, optional) — Array of topic specifiers
- `fromBlock` (BlockNumberOrTag, optional) — Starting block number for search
- `toBlock` (BlockNumberOrTag, optional) — Ending block number for search
- `blockHash` (string, optional) — Restricts the logs to the single block with this hash. Mutually exclusive with fromBlock/toBlock.

### FilterAddress

Contract address or array of addresses from which logs should originate

### FilterTopicsItems

### BlockNumberOrTag

## Examples

**Request**

```json
[
  {
    "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "fromBlock": "latest"
  }
]
```

**Response**

```json
{
  "id": "1",
  "jsonrpc": "2.0",
  "result": "0x9cef478923ff08bf67fde6c64013158d"
}
```

**SDK Code**

```python
import requests

url = "https://rpc.plume.org/YOUR_API_KEY"

payload = [
    {
        "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "fromBlock": "latest"
    }
]
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://rpc.plume.org/YOUR_API_KEY';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '[{"address":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2","fromBlock":"latest"}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rpc.plume.org/YOUR_API_KEY"

	payload := strings.NewReader("[\n  {\n    \"address\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n    \"fromBlock\": \"latest\"\n  }\n]")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rpc.plume.org/YOUR_API_KEY")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"address\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n    \"fromBlock\": \"latest\"\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://rpc.plume.org/YOUR_API_KEY")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"address\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n    \"fromBlock\": \"latest\"\n  }\n]")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rpc.plume.org/YOUR_API_KEY', [
  'body' => '[
  {
    "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "fromBlock": "latest"
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rpc.plume.org/YOUR_API_KEY");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"address\": \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\",\n    \"fromBlock\": \"latest\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  [
    "address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "fromBlock": "latest"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://rpc.plume.org/YOUR_API_KEY")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```