FAQs
1. General Overview
Q: What are User-Defined Functions (UDFs) in Hemera? A: UDFs in Hemera allow developers to extend and customize the behavior of the indexing process. They enable custom data handling, extraction, processing, and storage of blockchain data, allowing the creation of highly specific, feature-oriented data streams.
Q: What is the typical lifecycle of a UDF? A: A UDF lifecycle includes the following stages:
Definition: Define UDF parameters, triggers, and configuration.
Deployment: Deploy the UDF to listen and react to blockchain events.
Execution: UDF processes and transforms data, saving results to the database.
Maintenance: Update, version, or retire UDFs as needed.
2. UDF Configuration and Components
Q: What is the recommended file structure for organizing UDF components? A: The recommended file structure is:
modules/custom/{feature_name}/models
for Models.modules/custom/{feature_name}/domains
for Data Classes.modules/custom/{feature_name}/abi.py
for ABI files.job.py
for the UDF job logic.Central configuration under
config/indexert-config.yaml
.
Q: How should I structure Models and Data Classes in UDFs?
A: Models define database table structures and store processed data. Data Classes, used in memory, represent data during processing. Models use the bytea
format for hex fields and include special fields like address
, transaction_hash
, block_number
, and block_timestamp
with reserved meanings.
Q: How can I configure filters in a UDF?
A: Define custom filters using the get_filter job
method. This allows specific data selection criteria based on transaction types, addresses, or events, which reduces the data load by processing only relevant data.
3. Data Handling and Processing
Q: What is the purpose of consolidating _collect
and _process
functions?
A: Consolidating _collect
and _process
ensures a sequential data flow where _collect
gathers data and _process
transforms it. This setup simplifies the code structure, making it easier to maintain and reducing potential errors.
Q: What are the standardized methods for collecting data in a UDF? A: Hemera recommends four main data collection methods:
Block-Level Collection for raw block data.
Transaction-Level Collection for transaction-specific data.
Log-Based Collection for event-related data.
ABI-Decoded Collection for complex contract interactions.
Q: How do I handle dependency data acquisition in a standardized way? A: Use consistent naming and standardized utility functions for common dependency data requirements (e.g., fetching transaction details). Limit data acquisition to necessary dependencies, streamlining both code readability and resource efficiency.
4. Database and Data Consistency
Q: How does database management work in UDFs?
A: Hemera automates database management for standard tasks, but developers configure and manage specific aspects within their UDFs. Models define how data is structured in the database, while collect_domain
in the job logic handles data persistence.
Q: How does data consistency work for Address-Level and Event-Level data? A:
Address-Level Data: Requires ordered indexing for consistency, especially for historical transactions.
Event-Level Data: Unique identifiers allow flexible indexing across any block range without strict ordering.
Q: Can I process historical data with a UDF? A: Yes, you can set a starting block number in the configuration. The indexer will process blockchain data from this point onward. Address-level data requires ordered processing, while event-level data is flexible and can be processed in any range.
5. Utility and Data Transformation Methods
Q: What utility methods are available for handling data in UDFs? A: Hemera provides various utility methods:
ABI Utilities: Define contract objects and functions using
Web3.contract
.Encoding/Decoding: Encode data for storage and decode transaction inputs or logs.
String and Hex Conversions: Standardize hex and string conversions for addresses and transaction data.
Q: How can I encode and decode data within my UDF? A: Use the utility functions provided by Hemera to encode data for storage and decode transaction inputs, logs, or other data elements as required by your UDF’s processing logic.
6. Troubleshooting and Feedback
Q: What should I do if I encounter bugs in my UDF? A: Follow these steps:
Check your logs to identify error sources.
Review your filter configurations, triggers, and dependency data acquisition settings.
Submit detailed bug reports or feature suggestions via GitHub or by emailing support@thehemera.com.
Q: How can I submit feedback or feature requests for UDF improvements? A: You can submit feedback through the Hemera GitHub repository, or send an email to support@thehemera.com with a clear description of your suggestions.
7. Version Control and Roadmap
Q: What happens when a UDF version is updated? A: UDF version updates may introduce new fields, logic, or features. Compatibility checks are essential to ensure that updates do not disrupt existing workflows. If necessary, migration steps will be outlined for major version changes.
Q: What is the roadmap for future UDF features and enhancements? A: The roadmap includes support for additional UDFs, improved data handling capabilities, and expanding compatibility with more chains. Community feedback helps shape this roadmap, so please share any feature requests.
8. Ecosystem and Community Support
Q: Where can I connect with other developers or ask questions? A: Hemera’s Discord is the primary channel for developer communication, where you can ask questions, share ideas, and collaborate with the community.
Q: Can the community contribute new UDFs or support new chains? A: Yes! Community contributions are encouraged, and detailed guidelines are provided for adding UDFs and expanding chain support. Contribute via the Hemera GitHub repository or discuss with the community on Discord.
Q: How can I submit a completed UDF? A: Prepare your code following Hemera’s guidelines and submit it to the Hemera GitHub repository or email it to support@thehemera.com. Your submission will be reviewed, and upon approval, integrated into the ecosystem.
Q: How can I qualify for the Hemera Builder Program? A: Developers who contribute at least five UDFs and meet certain quality standards are eligible to join the Builder Program, which offers token grants and exclusive resources. Apply via the Hemera Builder Program Form.
Last updated