← Base overview
Base · eth
eth_newFilter
Install a log filter in the server, allowing for later polling. Registers client interest in logs matching the filter, and returns an identifier.
Parameters
FilterrequiredSchema{ "title": "filter", "oneOf": [ { "type": "object", "title": "Filter by block range", "properties": { "address": { "title": "Address(es)", "oneOf": [ { "type": "null", "title": "Any Address" }, { "type": "string", "title": "Address", "pattern": "^0x[0-9a-fA-F]{40}$" }, { "type": "array", "title": "Addresses", "items": { "type": "string", "title": "hex encoded address", "pattern": "^0x[0-9a-fA-F]{40}$" } } ] }, "fromBlock": { "title": "from block", "oneOf": [ { "type": "string", "title": "Block number", "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$" }, { "type": "string", "title": "Block tag", "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error", "enum": [ "earliest", "finalized", "safe", "latest" ] } ] }, "toBlock": { "title": "to block", "oneOf": [ { "type": "string", "title": "Block number", "pattern": "^0x(0|[1-9a-f][0-9a-f]*)$" }, { "type": "string", "title": "Block tag", "description": "`earliest`: The lowest numbered block the client has available; `finalized`: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination; `safe`: The most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions; `latest`: The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions. Before the merge transition is finalized, any call querying for `finalized` or `safe` block MUST be responded to with `-39001: Unknown block` error", "enum": [ "earliest", "finalized", "safe", "latest" ] } ] }, "topics": { "title": "Topics", "oneOf": [ { "type": "null", "title": "Any Topic Match" }, { "type": "array", "title": "Specified Filter Topics", "items": { "title": "Filter Topic List Entry", "oneOf": [ { "type": "null", "title": "Any Topic Match" }, { "type": "string", "title": "Single Topic Match", "pattern": "^0x[0-9a-f]{64}$" }, { "type": "array", "title": "Multiple Topic Match", "items": { "type": "string", "title": "32 hex encoded bytes", "pattern": "^0x[0-9a-f]{64}$" } } ] } } ] } } }, { "type": "object", "title": "Filter by block hash", "properties": { "address": { "title": "Address(es)", "oneOf": [ { "type": "null", "title": "Any Address" }, { "type": "string", "title": "Address", "pattern": "^0x[0-9a-fA-F]{40}$" }, { "type": "array", "title": "Addresses", "items": { "type": "string", "title": "hex encoded address", "pattern": "^0x[0-9a-fA-F]{40}$" } } ] }, "blockHash": { "type": "string", "title": "block hash", "pattern": "^0x[0-9a-f]{64}$" }, "topics": { "title": "Topics", "oneOf": [ { "type": "null", "title": "Any Topic Match" }, { "type": "array", "title": "Specified Filter Topics", "items": { "title": "Filter Topic List Entry", "oneOf": [ { "type": "null", "title": "Any Topic Match" }, { "type": "string", "title": "Single Topic Match", "pattern": "^0x[0-9a-f]{64}$" }, { "type": "array", "title": "Multiple Topic Match", "items": { "type": "string", "title": "32 hex encoded bytes", "pattern": "^0x[0-9a-f]{64}$" } } ] } } ] } }, "required": [ "blockHash" ] } ] }
Result
Filter identifier
Schema
{
"type": "string",
"title": "hex encoded unsigned integer",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
}Example request
Endpoint: https://your-base-node.azxa.io
JSON-RPC
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_newFilter",
"params": [
{
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"fromBlock": "0x137d3c2",
"toBlock": "0x137d3c3",
"topics": []
}
]
}Example response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x01"
}cURL
curl -X POST https://your-base-node.azxa.io \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_newFilter","params":[{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","fromBlock":"0x137d3c2","toBlock":"0x137d3c3","topics":[]}]}'