Actions11
Overview
The node provides functionality to listen for and query events emitted by a smart contract on an Ethereum-compatible blockchain (EVM chain). It allows users to specify the contract address, ABI, event name, and block range to fetch historical or recent events. This is useful for monitoring specific contract activities such as token transfers, approvals, or custom events emitted by decentralized applications.
Common scenarios include:
- Tracking token transfer events to update off-chain databases.
- Monitoring contract state changes triggered by specific events.
- Polling recent blocks for new events in scheduled workflows.
For example, a user can configure the node to listen for "Transfer" events from an ERC20 token contract over the last 100 blocks, filtering only those where the sender matches a particular address.
Properties
| Name | Meaning |
|---|---|
| Contract Address | The smart contract address to query events from. Example: 0x1234567890123456789012345678901234567890. |
| Contract ABI | The contract's Application Binary Interface (ABI) in JSON format. Defines the contract's functions and events. |
| Event Name | The name of the event to listen for, e.g., Transfer, Approval. |
| Block Range | How to determine the block range for querying events. Options: - Last N Blocks: Query events from the last N blocks. - Custom Block Range: Specify exact start and end block numbers. - Recent Blocks (for polling): Query only the most recent blocks, ideal for scheduled polling. |
| Last N Blocks | Number of recent blocks to query when using "Last N Blocks" option. Default is 100, max recommended 1000. |
| From Block | Starting block number for the query when using "Custom Block Range". |
| To Block | Ending block number for the query when using "Custom Block Range". Can be "latest" for the most recent block or a specific block number like 18000000. |
| Recent Blocks | Number of most recent blocks to query when using "Recent Blocks" option. Default is 5. Ideal for scheduled polling. |
| Event Filters | Optional JSON-formatted filters for event arguments. For example, {"from": "0x123...", "to": "0x456..."} filters events where the from and to fields match specified addresses. |
| Event Limit | Maximum number of events to return. Set to 0 for no limit. Default is 50. |
Output
The node outputs an array of event objects matching the query criteria. Each event object typically includes:
- The decoded event data with named parameters as defined in the contract ABI.
- Metadata such as block number, transaction hash, and log index.
- Filtered event arguments according to any specified filters.
If binary data were involved (e.g., logs with raw data), it would be included in the event details, but this node primarily returns structured JSON event data.
Dependencies
- Requires connection to an Ethereum-compatible RPC endpoint (configured via credentials providing an RPC URL and private key).
- Uses the
etherslibrary for blockchain interaction. - Requires a valid contract ABI in JSON format to decode events.
- Needs an API key credential that grants access to the RPC provider.
Troubleshooting
- Invalid Contract ABI: If the ABI JSON is malformed or incorrect, event decoding will fail. Ensure the ABI is properly formatted JSON representing the contract interface.
- Incorrect Contract Address: Using an invalid or non-contract address will result in no events found or errors. Verify the contract address is correct and deployed on the target network.
- Block Range Issues: Specifying an invalid block range (e.g.,
fromBlockgreater thantoBlock) may cause errors or empty results. Double-check block numbers. - Event Name Mismatch: If the event name does not exist in the ABI, no events will be returned. Confirm the event name matches exactly (case-sensitive).
- RPC Connection Errors: Network issues or invalid RPC URLs will prevent querying events. Check RPC endpoint availability and credentials.
- Event Filters Format: Filters must be valid JSON strings. Malformed JSON will cause parsing errors.