# Data Processor

HDP (short for Herodotus Data Processor) is a [coprocessor](https://vitalik.eth.limo/general/2024/09/02/gluecp.html) that focuses on **accessing extensive sets of on-chain data and running computations over them in a trustless manner**.

HDP provides a powerful data-proving pipeline for computations over massive on-chain data. By verifying on-chain storage proofs on a zkVM, it securely enables the delegation of intensive computations involving authenticated on-chain data to fully off-chain logic.

[Getting started](https://docs.herodotus.dev/herodotus-docs/developers/data-processor/getting-started) by following the guide!

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2Fgit-blob-1eae74bbc39904142e28e0eb3d9a0c4e28899368%2Fhdp-logo.png?alt=media" alt=""><figcaption></figcaption></figure>

### What HDP Enables

With HDP, you can unlock the following features:

* **Access historical on-chain data**:

HDP mainly uses the idea of storage proofs. By providing any historical snapshot of a block's root (such as a storage root or account root) and verifying a Merkle-Patricia proof against the root, you can retrieve verified historical data.

* **Access on-chain data across multiple blockchains**:

Using storage proofs and by supplying the valid root, you can access data from multiple chains on any chain via native messages or commitments.

* **Run custom computations on accessible data**:

We provide basic aggregate functions to compute the accessed on-chain data, and we also support custom computations by allowing you to write arbitrary programs.

### Triggering HDP with a Single Request

Users can utilize the extensive features that HDP provides via a single request—either on-chain or off-chain—to trigger the full pipeline and access the computed results on-chain.

The process is straightforward:

* **Specify which function to run**
* **Define the data to process**
* **Provide the context of the computation**

This request is then processed, either synchronously or asynchronously, by the HDP operator. The result is delivered on-chain, allowing smart contracts to query it.

### HDP Enables Powerful Use Cases

HDP enables cutting-edge use cases that were previously impossible to perform in a fully sound way due to computing complexity or data size constraints.

* **Calculating Time-Weighted Average Price (TWAP)**:

TWAP smooths out short-term price fluctuations by averaging prices over a specified period. This results in a more stable and representative value of an asset pair, which is particularly valuable for financial applications like options pricing.

* **Verifying Average Balance**:

To prove an account maintained an average balance of 1 ETH over 1,000 blocks, you would set up a data lake to fetch the account balances for these blocks. Using the `avg` function, you can compute the average balance, verifying the account's balance consistency over time.

* **Identifying Balance Fluctuations**:

To count how often an account's average balance drops below 50 ETH, you could use the `count_if` function. This helps in assessing the frequency of significant balance reductions, providing insights into account activity.

* **Ensuring Compliance with OFAC Sanctions**:

If you want to restrict access to your dApp to addresses that have never sent funds to a sanctioned address, HDP enables this capability efficiently in a trustless way due to its ability to analyze historical on-chain data.

* **Predicting a User's Balance**:

HDP can perform sophisticated computations, such as linear regression. Given a set of historical ETH balances for an address, you can predict future balances using linear regression within HDP.


---

# 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.herodotus.dev/herodotus-docs/developers/data-processor.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.
