curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_newFilter",
"id": 1,
"params": [
{
"fromBlock": "latest",
"address": "0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_newFilter",
"id": 1,
"params": [
{
"fromBlock": "latest",
"address": "0x350a791Bfc2C21F9Ed5d10980Dad2e2638ffa7f6",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
eth_newFilter
creates a new filter object for monitoring log entries that match specified criteria. This method is crucial for applications that need to track events or changes in smart contracts.
The example tracks all transfers of the Chainlink token.
Once you install the filter, track the changes with eth_getFilterChanges.
filterObject
— an object containing filter options:
fromBlock
— (optional) the block number (in hexadecimal) or one of the strings "earliest"
, "latest"
, or "pending"
from where to start filtering. Default is "latest"
.address
— (optional) an address or a list of addresses to only get logs from specific contracts.topics
— (optional) an array of topics to filter for log entries. Each event signature generated by the EVM logging mechanism has a unique topic.result
— the ID of the created filter. This ID is used to identify and manage the filter with other filter methods like eth_getFilterChanges
or eth_getFilterLogs
.eth_newFilter
method is essential for:
The ID of the created filter
The response is of type object
.
Was this page helpful?