Skip to main content

eth_newFilter

Overview

The 'eth_newFilter' method creates a filter object based on the given filter options, to notify when the state changes (logs). To check if the state has changed, call 'eth_getFilterChanges'.

'Duration':

Filter IDs will be valid for up to fifteen minutes and can be polled by any connection using the same YOUR-COINAPI-KEY.

Request

curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_newFilter",
"params": [
{
"address": [
"0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907"
],
"fromBlock": "0x429d3b",
"toBlock": "latest",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
"0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
]
}
]
}'

Request Parameters

A filter object with the following keys and their values:

  • 'address': [optional] A contract address or a list of addresses from which logs should originate.
  • fromBlock': [optional, default is latest] A hexadecimal block number, or the string latest, earliest, or pending. See the default block parameter.
  • 'toBlock': [optional, default is latest] A hexadecimal block number, or the string latest, earliest, or pending. See the default block parameter.
  • 'topics': [optional] An array of 32 bytes DATA topics. Topics are order-dependent.

Topic Filters:

Topics are order-dependent. A transaction with a log with topics '[A, B]' will be matched by the following topic filters:

  • '[]': Anything.
  • '[A]': 'A' in the first position, and anything after.
  • '[null, B]': Anything in the first position AND 'B' in the second position, and anything after.
  • '[A, B]': 'A' in the first position AND 'B' in the second position, and anything after.
  • '[[A, B], [A, B]]': '(A OR B)' in the first position AND '(A OR B)' in the second position, and anything after.

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x7da018f96a3cd71bef5eedd3fc66596e"
}
  • filter ID: A hexadecimal denoting the newly created filter ID.