eth_newFilter - Ethereum

Builds up a filter object which notifies you every time the state changes. A filter object is based on filter options and shows changes via the command eth_getFilterChanges

How to Use the eth_newFilter Method

Parameters

Object - The filter options:

  • fromBlock: QUANTITY|TAG - (variable, default statement: "latest") the string "latest" or "pending", or an integer block number for the last mined block, returns "earliest" if the transaction wasn’t mined yet.

  • toBlock: QUANTITY|TAG - (variable, default statement: "latest") the string "latest" or "pending", or an integer block number for the last mined block, returns "earliest" if the transaction wasn’t mined yet.

  • address: DATA|Array, 20 Bytes - (variabel) An address of a contract or a list of addresses from which logs should originate.

  • topics: Array of DATA, - (variable) Array of 32 Bytes DATA order-dependent topics. Each topic can also contain DATA Arrays with "or" options.

What you receive

QUANTITY - A filter id.

Sample

Here is a typical appliance example.

Call

curl https://eth-mainnet.rpcfast.com/?api_key=<key> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics":["0x0000000000000000000000000000000000000000000000000000000012341234"]}],"id":1}'

Outcome

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x7185030cb5dabae60f32b996a4ab04a3"
}

Last updated