> For the complete documentation index, see [llms.txt](https://docs.herodotus.dev/herodotus-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.herodotus.dev/herodotus-docs/developers/data-processor.md).

# 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](/herodotus-docs/developers/data-processor/getting-started.md) by following the guide!

<figure><img src="/files/STuUEaOkcAxVxvMljYEM" 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.
