Actions22
- Call Contract
- Estimate Gas
- Get Balance
- Get Block
- Get Block By Hash
- Get Block Number
- Get Block Transaction Count By Hash
- Get Block Transaction Count By Number
- Get Code
- Get Gas Price
- Get Logs
- Get Storage At
- Get Transaction
- Get Transaction By Block Hash And Index
- Get Transaction By Block Number And Index
- Get Transaction Count
- Get Transaction Receipt
- Get Uncle By Block Hash And Index
- Get Uncle By Block Number And Index
- Get Uncle Count By Block Hash
- Get Uncle Count By Block Number
- Send Raw Transaction
Get Logs
AI-generatedOverview
This node operation retrieves blockchain logs that match specified filter criteria using the Infura API. It is useful for monitoring events emitted by smart contracts or transactions within a specified block range. For example, a user can fetch logs from a particular contract address between two blocks or filter logs by specific topics to track certain events.
Use Case Examples
- Fetch logs emitted by a specific smart contract between block 1000000 and 1000100.
- Retrieve logs filtered by topics to monitor specific event types across the blockchain.
Properties
| Name | Meaning |
|---|---|
| Address | Contract address to filter logs (optional). If provided, only logs from this address are returned. |
| From Block | Starting block number or tag (hex, "latest", "earliest", "pending") from which to begin fetching logs. |
| To Block | Ending block number or tag (hex, "latest", "earliest", "pending") up to which to fetch logs. |
| Topics | JSON array string representing topics to filter logs by specific event signatures or indexed parameters. |
Output
JSON
logs- Array of log objects matching the filter criteria.logsCount- Number of logs returned.filteraddress- Contract address filter used in the query.fromBlock- Starting block filter used in the query.toBlock- Ending block filter used in the query.topics- Topics filter used in the query.
metadatanetwork- Blockchain network used for the query.operation- Operation performed, here 'getLogs'.timestamp- Timestamp when the query was executed.infura_endpoint- The Infura API endpoint used for the request.
Dependencies
- Infura API key credential
Troubleshooting
- If the 'Topics' input is not a valid JSON array, the node throws an error 'Topics must be a valid JSON array'. Ensure the topics input is correctly formatted JSON.
- Network or credential misconfiguration can cause request failures. Verify the Infura API credentials and network settings.
- If no logs are returned, check that the address, block range, and topics filters are correctly set and that relevant events exist in that range.
Links
- Infura Ethereum API - eth_getLogs - Official documentation for the eth_getLogs method used to fetch logs from the Ethereum blockchain via Infura.