← Mode overview
Mode · eth
eth_getLogs
Returns an array of all logs matching the specified filter.
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
Log objects
Schema
{
"title": "Filter results",
"oneOf": [
{
"type": "array",
"title": "new block or transaction hashes",
"items": {
"type": "string",
"title": "32 byte hex value",
"pattern": "^0x[0-9a-f]{64}$"
}
},
{
"type": "array",
"title": "new logs",
"items": {
"type": "object",
"title": "log",
"properties": {
"address": {
"type": "string",
"title": "address",
"pattern": "^0x[0-9a-fA-F]{40}$"
},
"blockHash": {
"type": "string",
"title": "block hash",
"pattern": "^0x[0-9a-f]{64}$"
},
"blockNumber": {
"type": "string",
"title": "block number",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
},
"blockTimestamp": {
"type": "string",
"title": "block timestamp",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
},
"data": {
"type": "string",
"title": "data",
"pattern": "^0x[0-9a-f]*$"
},
"logIndex": {
"type": "string",
"title": "log index",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
},
"removed": {
"type": "boolean",
"title": "removed"
},
"topics": {
"type": "array",
"title": "topics",
"items": {
"type": "string",
"title": "32 hex encoded bytes",
"pattern": "^0x[0-9a-f]{64}$"
}
},
"transactionHash": {
"type": "string",
"title": "transaction hash",
"pattern": "^0x[0-9a-f]{64}$"
},
"transactionIndex": {
"type": "string",
"title": "transaction index",
"pattern": "^0x(0|[1-9a-f][0-9a-f]*)$"
}
},
"required": [
"transactionHash"
]
}
}
]
}Example request
Endpoint: https://your-mode-node.azxa.io
JSON-RPC
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"fromBlock": "0x137d3c2",
"toBlock": "0x137d3c3",
"topics": []
}
]
}Example response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
"blockHash": "0xfc139f5e2edee9e9c888d8df9a2d2226133a9bd87c88ccbd9c930d3d4c9f9ef5",
"blockNumber": "0x233",
"blockTimestamp": "0x11",
"data": "0x0000000000000000000000000000000000000000000000000000000000000004",
"logIndex": "0x0",
"removed": false,
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
],
"transactionHash": "0x66e7a140c8fa27fe98fde923defea7562c3ca2d6bb89798aabec65782c08f63d",
"transactionIndex": "0x0"
},
{
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
"blockHash": "0x98b0ec0f9fea0018a644959accbe69cd046a8582e89402e1ab0ada91cad644ed",
"blockNumber": "0x238",
"blockTimestamp": "0x22",
"data": "0x0000000000000000000000000000000000000000000000000000000000000007",
"logIndex": "0x0",
"removed": false,
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
],
"transactionHash": "0xdb17aa1c2ce609132f599155d384c0bc5334c988a6c368056d7e167e23eee058",
"transactionIndex": "0x0"
}
]
}Test fixture
Fixture: contract-addr
Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getLogs",
"params": [
{
"address": [
"0x7dcd17433742f4c0ca53122ab541d0ba67fc27df"
],
"fromBlock": "0x1",
"toBlock": "0x4"
}
]
}Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x7dcd17433742f4c0ca53122ab541d0ba67fc27df",
"topics": [
"0x00000000000000000000000000000000000000000000000000000000656d6974",
"0xf4da19d6c17928e683661a52829cf391d3dc26d581152b81ce595a1207944f09"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x2",
"transactionHash": "0x5bc704d4eb4ce7fe319705d2f888516961426a177f2799c9f934b5df7466dd33",
"transactionIndex": "0x2",
"blockHash": "0xb4874cd66b2070da5d1905b5937e97c82d1891747739b3ebb0f7f6ffc9ad518a",
"blockTimestamp": "0x14",
"logIndex": "0xa",
"removed": false
},
{
"address": "0x7dcd17433742f4c0ca53122ab541d0ba67fc27df",
"topics": [
"0x00000000000000000000000000000000000000000000000000000000656d6974",
"0x95b7276947f6331672b0c63eca28c1d39f25286d5e2793d6a487837ff1475ba0"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
"blockNumber": "0x4",
"transactionHash": "0xd48ebacfb769b85602310e2e0cf322e19f8cce25ac69cfd52f2d8622e3bbc3c9",
"transactionIndex": "0x1",
"blockHash": "0x98f797a6af91ea770ab3a99d89c17a3a46d14c76db6bb711b18156a3493d2c94",
"blockTimestamp": "0x28",
"logIndex": "0x0",
"removed": false
}
]
}cURL
curl -X POST https://your-mode-node.azxa.io \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","fromBlock":"0x137d3c2","toBlock":"0x137d3c3","topics":[]}]}'