Introduction
Last updated
Last updated
In Hemera Indexer, a User-Defined Function (UDF) is essentially a custom indexing job that:
Extracts specific data from the blockchain.
Processes the data according to your custom logic.
Stores the results in the database.
UDFs allow you to focus on the data that matters to your application without dealing with unnecessary blockchain data. For instance, you might be interested in indexing only specific events from smart contracts, calculating address-level features, or aggregating token balances. UDFs enable you to define this custom extraction and transformation logic.
At a high level, a UDF in Hemera Indexer:
Depends on certain blockchain data: UDFs specify dependencies on existing data classes (e.g., blocks, transactions, logs) provided by the Hemera Indexer.
Processes the data: UDFs contain custom logic that processes the input data and transforms it into the desired output format.
Outputs data to the database: The processed data is stored in the database as defined by your model.
UDFs are integrated into the indexing process of Hemera Indexer. When the indexer runs, it not only indexes the standard blockchain data but also executes your UDFs to produce custom outputs.