# Introduction

## What is UDF?

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.

## How UDFs Work

At a high level, a UDF in Hemera Indexer:

1. **Depends on certain blockchain data**: UDFs specify dependencies on existing data classes (e.g., blocks, transactions, logs) provided by the Hemera Indexer.
2. **Processes the data**: UDFs contain custom logic that processes the input data and transforms it into the desired output format.
3. **Outputs data to the database**: The processed data is stored in the database as defined by your model.

<figure><img src="https://lh7-rt.googleusercontent.com/slidesz/AGV_vUe6FaEl1g0leLlcvX_cgyM5rjt47DR5Pe2_t74cFeHU4AicQWSsBbak8pWacdKC6c_rJA-9xi9Cuoqg9uobJIYke8CKI4nA2AlN-T5xiTmgxaacho0FoBXToITFO75Rlsi-cofyzvGoNviZ5eqZcc3twbzlyXnH=s2048?key=VbpyRI7YKJkuvjCAzsPkmQ" alt=""><figcaption></figcaption></figure>

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thehemera.com/udfs-user-defined-functions/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
