eth_newFilter - Base
eth_newFilter. Create a new filter to monitor specific logs or events
eth_newFilter - base [Value: 20CU]
Creates a filter object to notify when logs that match specific criteria are added to the blockchain
Use cases
- Monitor contract events within specific block range
- Filter logs from a particular smart contract
- Track specific events for auditing or analytics
Constraints
- Requires valid block range and contract address
- Node must support filter creation functionality
- Accurate block and address input essential for results
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl https://base.drpc.org \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock": "0xe20360", "toBlock": "0xe20411", "address": "0x6b175474e89094c44da98b954eedeac495271d0f","topics": []}],"id":1}'
'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xb1770efb14906e509893b6190359658208ae64d0c56e22f748a1b0869885559e"
}
Request params
idinteger
jsonrpcstring
methodstring
array of objects
blockHashstring
Specifies the block hash to filter logs from. If this parameter is set, the fromBlock and toBlock parameters will be ignored.
addressarray_of_strings
(optional) Contract address or a list of addresses from which logs should originate.
fromBlockstring
(optional) The starting block for the filter.
- latest [default] - The most recent block in the blockchain (default).
- earliest - The first block, also known as the genesis block.
- pending - Transactions that have been broadcast but not yet included in a block.
toBlockstring
(optional) The ending block for the filter
- latest [default] - The most recent block in the blockchain (default).
- earliest - The first block, also known as the genesis block.
- pending - Transactions that have been broadcast but not yet included in a block.
topicsarray_of_strings
(optional) An array of log topics.
Response
200
The ID of the newly created filter, represented as a hexadecimal string. Response params
object
idinteger
jsonrpcstring
resultarray_of_objects