# eth_getLogs - Ethereum Returns an array of all logs matching a given filter object. For more information about eth_getLogs check out our Deep Dive into eth_getLogs page. # Parameters Object - The filter options: * fromBlock: QUANTITY|TAG - (optional, default: "latest") Value:\ Integer block number * "latest" for the last mined block. * "pending", "earliest" for not yet mined transactions. * toBlock: QUANTITY|TAG - (optional, default: "latest") Value: * Integer block number. * "latest" for the last mined block. * "pending", "earliest" for not yet mined transactions. * address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate. * topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics. * Topics are order-dependent. Each topic can also be an array of DATA with "or" options. * Check out more details on how to format topics in [eth\_newFilter](https://unifra.readme.io/reference/eth_newFilter). * blockHash: DATA, 32 Bytes - (optional) With the addition of EIP-234 (Geth >= v1.8.13 or Parity >= v2.1.0), blockHash is a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. **If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.** ```json params: [ { address: "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907", topics: [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", ], blockHash: "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb", }, ]; ``` *** # Returns Array of DATA, 20 Bytes - Addresses owned by the client. *** Array - Array of log objects, or an empty array if nothing has changed since last poll. * For filters created with eth\_newBlockFilter the return are block hashes (DATA, 32 Bytes), e.g. \["0x3454645634534..."]. * For filters created with eth\_newPendingTransactionFilter the return are transaction hashes (DATA, 32 Bytes), e.g. \["0x6345343454645..."]. * For filters created with eth\_newFilter logs are objects with following params: * removed: TAG - True when the log was removed, due to a chain reorganization. False if its a valid log. * logIndex: QUANTITY - Integer of the log index position in the block. Null when its pending log. * transactionIndex: QUANTITY - Integer of the transactions index position log was created from. Null when its pending log. * transactionHash: DATA, 32 Bytes - Hash of the transactions this log was created from. Null when its pending log. * blockHash: DATA, 32 Bytes - Hash of the block where this log was in. Null when its pending. Null when its pending log. * blockNumber: QUANTITY - The block number where this log was in. Null when its pending. Null when its pending log. * address: DATA, 20 Bytes - Address from which this log originated. * data: DATA - Contains one or more 32 Bytes non-indexed arguments of the log. * topics: Array of DATA - Array of 0 to 4 32 Bytes DATA of indexed log arguments. * In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declare the event with the anonymous specifier. # Example ## Request ```curl curl https://eth-mainnet.unifra.io/v1/your-api-key \ -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"}],"id":0}' ``` ```Text Postman URL: https://eth-mainnet.unifra.io/v1/your-api-key RequestType: POST Body: { "jsonrpc":"2.0", "method":"eth_getLogs", "params":[{"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"}], "id":0 } ``` ## Result ```json { "jsonrpc": "2.0", "id": 0, "result": [ { "address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907", "topics": [ "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75", "0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078" ], "data": "0x000000000000000000000000000000000000000000000000000000012a05f200", "blockNumber": "0x429d3b", "transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b", "transactionIndex": "0xac", "blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb", "logIndex": "0x56", "removed": false } ] } ``` # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "ethereum-api", "version": "1.0" }, "servers": [ { "url": "https://eth-mainnet.unifra.io/v1" } ], "security": [ {} ], "paths": { "/{your-api-key}": { "post": { "summary": "web3_sha3 - Ethereum", "description": "Returns Keccak-256 (not the standardized SHA3-256) of the given data.", "operationId": "web3_sha3", "parameters": [ { "name": "your-api-key", "in": "path", "schema": { "type": "string" }, "required": true } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "jsonrpc": { "type": "string", "default": "2.0" }, "method": { "type": "string", "default": "web3_sha3" }, "params": { "type": "array", "items": { "type": "string" } }, "id": { "type": "integer", "default": 0, "format": "int32" } } } } } }, "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true } ```