Skip to main content
Ethereum API
Multichain API

eth_newFilter

Summary: Creates a filter object, based on filter options, to notify when the state changes (logs).

Parameters

Filter object

filter

fromBlock string

from block

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

toBlock string

to block

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

address oneOf

Address(es)

Any Address null

Any Address

hex encoded address string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

Addresses array

Addresses

hex encoded address string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

topics oneOf

Topics

Any Topic Match null

Any Topic Match

Specified Filter Topics array

Specified Filter Topics

Filter Topic List Entry oneOf

Filter Topic List Entry

32 hex encoded bytes string

32 hex encoded bytes

Pattern: ^0x[0-9a-f]{64}$

Multiple Topic Match array

Multiple Topic Match

32 hex encoded bytes string

32 hex encoded bytes

Pattern: ^0x[0-9a-f]{64}$

Returns

Filter identifier string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Customize request
Parameter
Value
string
string
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
oneOf
oneOf
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "eth_newFilter",
"params": [
{
fromBlock: "0x137d3c2",
toBlock: "0x137d3c3",
address: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
topics: []
}
],
});
Example response
"0x01"