> For the complete documentation index, see [llms.txt](https://assay.gitbook.io/assay-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://assay.gitbook.io/assay-docs/integrations/envio.md).

# Envio

Why Assay's read layer runs on Envio HyperIndex, what the handlers compute, and how to run or deploy it.

**Where:** `indexer/` (Envio HyperIndex, one deployment for Monad mainnet and testnet since 5 Oct). Live GraphQL: `https://indexer.dev.hyperindex.xyz/557d70c/v1/graphql`. The entity reference is on [Indexer and GraphQL](/assay-docs/for-developers/indexer.md).

Envio is Assay's read layer. Every trust question an app asks, like which key signed this batch or whether a host is drifting, is answered from entities the handlers compute at index time.

## Problem

Assay's data is spread across events in its own contracts and the ERC-8004 registry, and it only means something when joined. A grade is useless without the host's identity, and an anchor is useless without the key that signed it. Answering "can I trust host X for model Y right now?" from raw RPC means scanning every log on every request.

## Why Envio

| Need                           | What HyperIndex gives                                              |
| ------------------------------ | ------------------------------------------------------------------ |
| Several contracts in one place | Typed handlers over many contracts and chains in one `config.yaml` |
| Fast backfill                  | HyperSync, much faster than RPC log scans                          |
| Reorg safety                   | Handled by the framework, so handlers hold no rollback logic       |
| A query API                    | GraphQL out of the box                                             |
| External data                  | The Effect API, used here to load ERC-8004 agent cards             |

## What we built

| Piece                 | Detail                                                                                                                                  |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| Sources               | ReceiptAnchor, VerifierRegistry, CreAttestor, and the ERC-8004 Identity and Reputation registries, synced through HyperSync with no RPC |
| 12 entities           | Including `HostModelStats`, `DriftEvent`, `ModelLeaderboard`, `KeyRotation` and `HostActivity`                                          |
| Derived at index time | Drift, per-verifier leaderboards, daily activity, key history                                                                           |
| Agent cards           | Fetched from `agentURI` through the Effect API, with timeouts and size limits                                                           |
| Chain-prefixed ids    | `143-…` and `10143-…`. Adding mainnet on 5 Oct was a config change, not a migration                                                     |
| Handler tests         | 22, on simulated events with no network                                                                                                 |
| Live                  | Envio Cloud dev plan, synced to the chain head: `https://indexer.dev.hyperindex.xyz/557d70c/v1/graphql`                                 |

## How to try it

1. `cd indexer && corepack pnpm install && corepack pnpm codegen && corepack pnpm test`
2. With Docker running and `ENVIO_API_TOKEN` set: `corepack pnpm dev`, then open `http://localhost:8080`.
3. Paste the "Activity" query from [Indexer and GraphQL](/assay-docs/for-developers/indexer.md).

It's deployed on Envio Cloud's free development plan from the `indexer/` folder (dashboard "Indexer Directory" `./indexer`) and redeploys on every push to the `envio` branch.

## What it drives

| Page                                                                                                                      | From the indexer                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Receipt page](https://assay-ten-xi.vercel.app/app/#r/0x9a166cacb2ffe4784ad556f69b690b7cebf71150f737a5a3c324f9e98e7907e5) | One query by batch root: batch size, block, transaction, **the key that signed this batch**, and every co-signature of the receipt. The contract only stores the current key, so after a rotation this card can't be built from the chain |
| [Host profile](https://assay-ten-xi.vercel.app/app/#hosts/10278?chain=143)                                                | One query for the whole page: counts, 14 days of activity, batches with their signing keys, key history, identity and endpoints                                                                                                           |

A new receipt goes from the request to an anchor on Monad in a few seconds, and to the indexer and these pages in under a minute.

## HyperSync analytics

`indexer/scripts/hypersync_stats.py` asks HyperSync directly, with no RPC and no indexer, for every `Anchored` event and its transaction's gas, then reports per host: batches, receipts, gas per batch, MON spent and MON per receipt.

```bash
ENVIO_API_TOKEN=... python3 indexer/scripts/hypersync_stats.py
```

On Monad testnet (4 Oct 2026), host 1962 had 6 batches of 1 receipt each, at 86,581 gas billed per batch (Monad bills the gas limit). That's about 0.0088 MON per receipt at one receipt per batch, or about 0.00014 MON per receipt at 64 per batch.

Next: [Chainlink CRE](/assay-docs/integrations/chainlink-cre.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://assay.gitbook.io/assay-docs/integrations/envio.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
