> 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/monad.md).

# Monad

How Assay uses Monad's P256 precompile and the ERC-8004 registries, and how to check both yourself.

**Where:** `ReceiptAnchor` and `VerifierRegistry` on Monad mainnet (chain 143) since 5 Oct, and on testnet (chain 10143). The precompile is at `0x0100`. ERC-8004 IdentityRegistry is at `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` on mainnet and `0x8004A818BFB912233c491871b3d84c89A494BD9e` on testnet. Addresses: [Network and contracts](/assay-docs/getting-started/network-and-contracts.md).

Assay needs three things from a chain: cheap P-256 checks, a shared identity registry, and gas low enough to anchor small batches often. Monad has all three natively.

## Problem

Hosts sign with P-256 because that is what cloud KMS, HSMs, Intel TEEs and passkeys use. Without a precompile, OpenZeppelin's Solidity fallback costs about 250,000 gas per check, which makes every anchor and co-sign expensive. Hosts and verifiers also need an identity that isn't an account system Assay runs itself.

## Why Monad

| Feature                                                                    | What it gives Assay                                                                                                                     |
| -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| P256VERIFY at `0x0100` (EIP-7951)                                          | A P-256 check for 6,900 gas. Host anchors and passkey co-signs are verified onchain directly                                            |
| ERC-8004 IdentityRegistry                                                  | Every host and verifier is an ERC-8004 agent. The contracts call `ownerOf` on it                                                        |
| ERC-8004 ReputationRegistry (`0x8004B663056A597Dffe9eCcC1965A193B7388713`) | A place for verifier feedback. It blocks an agent's owner from rating itself, so the verifier uses a separate wallet                    |
| Low gas                                                                    | One `anchor` is about 61,000 gas, about 0.006 MON at the minimum base fee. Over a 64-receipt batch that is about 0.0001 MON per receipt |

## What we built

| Piece               | Detail                                                                                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `ReceiptAnchor`     | Host keys, anchors, `verifyReceipt`, `cosign`, `cosignK`                                                                       |
| `VerifierRegistry`  | Open verifiers, grades and `gradeOf`                                                                                           |
| Precompile canaries | `test_precompile_knownVector_returnsOne` and `test_valid_usesPrecompile_gasBound` fail if the precompile ever stops being used |
| Fork tests          | Three tests against the real ERC-8004 registry on a fork of Monad testnet                                                      |
| Testnet evidence    | `docs/evidence/day1-precompile-testnet.txt`: a valid vector returns `1`, a tampered one returns empty                          |

## How to try it

1. Call the precompile directly through the contract tests:

```bash
cd contracts && forge test --match-test test_precompile_knownVector_returnsOne -vv
```

2. Run the fork tests against the live registry:

```bash
forge test --match-path "test/fork/*" --fork-url monad_testnet -vv
```

3. Read the first anchor, whose host signature the precompile checked in a real transaction:

```bash
cast call 0x63e4F42E6d254ed6aAE735F9F4169BbFd12c1a24 "anchors(uint256,bytes32)(uint32,uint64)" 1962 \
  0x5594c31b47c59350e82e11a4161b629c03ac85a36c02dc74c2630fde01086e57 --rpc-url https://testnet-rpc.monad.xyz
```

## Where else this shows up

| Place                                                                         | What it covers                |
| ----------------------------------------------------------------------------- | ----------------------------- |
| [Network and contracts](/assay-docs/getting-started/network-and-contracts.md) | Every address and transaction |
| [Contracts reference](/assay-docs/for-developers/contracts.md)                | Gas per function              |
| [Design decisions](/assay-docs/security/decisions.md)                         | Why `osaka` is pinned         |

{% hint style="warning" %}
Monad bills the gas limit, not the gas used. Send transactions with `gas = estimate × 1.2`, as the host does, instead of a large fixed limit.
{% endhint %}

Next: [Envio](/assay-docs/integrations/envio.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/monad.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.
