# How an AI agent can prove what a web page said (machine-verifiable, 2 cents)

> Source: <https://dev.to/witnessd/how-an-ai-agent-can-prove-what-a-web-page-said-machine-verifiable-2-cents-ph5>
> Published: 2026-12-06 15:34:30+00:00

**Key takeaway:** Witness a page through a third-party notary before acting on it: witnessd fetches the URL itself, signs the response and anchors a Merkle root on Base for about two cents per call via x402, giving a certificate verifiable without trusting the agent's own logs.

Your agent just paid an unfamiliar API because its pricing page said `$0.001 per call`. Tomorrow the page says `$0.10`, and the seller says it always did. What does your agent have? A log line it wrote itself. Self-serving evidence. The counterparty can say you made it up, and nobody can tell either way.

This post shows a way out that works for software, not just for lawyers: a **neutral third party fetches the URL, records exactly what it got, signs it, and anchors a fingerprint on a public blockchain**. The result is a certificate anyone can verify later without trusting you, the counterparty, or the witness. It costs two cents and one HTTP round-trip.

I'll walk through a real certificate byte by byte, show the two-line verification, and be clear about what this does *not* prove.

An agent can compute anything, but it can **witness nothing about the outside world on its own authority**. Whatever it records about what a page said is a claim made by an interested party. Screenshots are trivially edited. `archive.org` is a public good, not an API contract, and it does not sign anything. Your own logs are yours.

Three properties make evidence useful later:

Independence needs a third party. Integrity and time can come from a hash in a public ledger. Together: a notary for HTTP responses.

```
agent ──POST /api/witness {url}──▶ witnessd ──GET url──▶ the page
      ◀── 201 {id, certificate} ──┘        (fetches it itself)
                                            hourly: Merkle root → Base chain
anyone ──GET /api/certificate/{id}──▶ certificate (free, forever)
```

Call it **before** you act. A snapshot taken after a dispute starts proves much less than one taken before you paid.

Plain HTTP, no account, no API key. Payment is [x402](https://x402.org): the first request gets a `402 Payment Required` with an invoice in the `Payment-Required` header; an x402 client signs a USDC authorization (on Base; the buyer pays no gas) and retries.

```
// Any x402-capable HTTP client works. With Coinbase's x402-fetch + viem:
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY); // small dedicated wallet, a few USDC on Base
const payFetch = wrapFetchWithPayment(fetch, account);

const res = await payFetch("https://witnessd.vip/api/witness", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ url: "https://api.coinbase.com/v2/prices/BTC-USD/spot" }),
});
console.log(await res.json());
```

Response:

```
{
  "id": "ws_aa0670da7aede610de339dcd",
  "certificate_url": "https://witnessd.vip/api/certificate/ws_aa0670da7aede610de339dcd",
  "retrieve_url": "https://witnessd.vip/api/retrieve/ws_aa0670da7aede610de339dcd"
}
```

Or give the agent the tool instead of the curl:

```
{ "mcpServers": { "witnessd": {
  "command": "npx", "args": ["-y", "witnessd-mcp"],
  "env": { "EVM_PRIVATE_KEY": "0x… a small dedicated wallet with a few USDC on Base" }
}}}
```

Claude Code users: `/plugin install witnessd --marketplace jschunter/witnessd-mcp` installs the MCP server plus a skill that tells the agent *when* a witness is worth two cents (before paying an unfamiliar seller, before acting on third-party data, when asked to "prove this") and caps spending at 5 paid calls per task.

This is a real one: `GET https://witnessd.vip/api/certificate/ws_aa0670da7aede610de339dcd` (free). Trimmed only in the headers block.

```
{
  "format": "witnessd-certificate-v1",
  "manifest": {
    "v": 1,
    "id": "ws_aa0670da7aede610de339dcd",
    "url": "https://api.coinbase.com/v2/prices/BTC-USD/spot",
    "final_url": "https://api.coinbase.com/v2/prices/BTC-USD/spot",
    "redirects": [],
    "fetched_at": "2026-09-07T21:53:26.072Z",
    "status": 200,
    "headers": { "date": "Mon, 07 Sep 2026 21:53:26 GMT", "content-type": "application/json",
                 "content-length": "60", "server": "cloudflare", "cf-ray": "a378f239de0ef719-CDG", "…": "…" },
    "content_type": "application/json",
    "body_sha256": "acaf08d9c2a7545b5ce6e5bdc5c7a4eeb46d986b8aff273125b6cc8b10f85642",
    "body_bytes": 60,
    "tls": null,
    "witness": {
      "service": "https://witnessd.vip",
      "pubkey_spki_b64": "MCowBQYDK2VwAyEAZUvBUcCNcjFt+ObLt92y28xruA6Y4GcpGCNaHM+6yq8=",
      "alg": "ed25519",
      "leaf": "sha256(canonical-json(manifest))"
    }
  },
  "leaf_hash": "40933f7c91648be70b6a17d9457e79baeeadfa2e6f15e1e953039ffab2502ee7",
  "signature_ed25519_b64": "zcNHd/aRZQPj/5qBnROM/NWvAdEg+1gW8WfA728Aiandm+EHLatGObysej+npeggjzE6qlQwyQCc1mynHcVCAQ==",
  "anchor": {
    "batch_id": 12,
    "merkle_root": "40933f7c91648be70b6a17d9457e79baeeadfa2e6f15e1e953039ffab2502ee7",
    "count": 1,
    "chain": "base",
    "tx_hash": "0xa770fffa3c4eec01d400a8e251d91427dcbb99a9d4abf42e8d4a8b74049e6027",
    "anchored_at": "2026-09-07T22:24:01.717Z",
    "leaf_index": 0,
    "proof": [],
    "calldata_format": "0x77746e7331<merkle_root>"
  }
}
```

Reading it top to bottom:

`manifest``{"data":{"amount":"79175.98","base":"BTC","currency":"USD"}}`). The body itself is archived and available to any paying party via `retrieve_url`; the certificate carries only its hash, so certificates can be public without republishing content.`leaf_hash`` signature_ed25519_b64``anchor`` proof` is empty — a convenient teaching case. In a busier hour `tx_hash`` wtns1` (`0x77746e7331`) followed by the root. That transaction was mined at 22:24 UTC, so the manifest provably existed by then, 31 minutes after the fetch.

```
curl -s https://witnessd.vip/api/certificate/ws_aa0670da7aede610de339dcd > witness.json
curl -s https://witnessd.vip/verify.js > verify.js   # ~100 lines, no dependencies
node verify.js witness.json
```

You should see `PASS` for the leaf hash, the signature, and the Merkle fold, then a line telling you which Base transaction to look up. Open `0xa770fffa…049e6027` on any Base block explorer and compare its input data to `0x77746e7331` + the root. That last step is the one that does not depend on witnessd at all.

By hand, in Node:

``` js
import { createHash } from "node:crypto";
const c = JSON.parse(await (await fetch("https://witnessd.vip/api/certificate/ws_aa0670da7aede610de339dcd")).text());
const canon = o => Array.isArray(o) ? `[${o.map(canon)}]`
  : o && typeof o === "object" ? `{${Object.keys(o).sort().map(k => `${JSON.stringify(k)}:${canon(o[k])}`)}}`
  : JSON.stringify(o);
const leaf = createHash("sha256").update(canon(c.manifest)).digest("hex");
console.log(leaf === c.leaf_hash);   // true
```

A valid certificate proves: **witnessd's server received exactly these bytes from that URL at that time, and the record has not changed since the anchor transaction was mined.**

It does not prove:

Scope limits, by design: public content only (no logins — the witness would just capture the login page), no private networks, bodies up to 10 MB, `robots.txt` respected for scheduled watches.

You can hash and timestamp your own fetches, and for your own records you should. But the moment the question is *"who says?"*, a record you produced answers *"I do"*. The useful property is that the fetching party has no stake in the outcome. That is also why the certificate and the archived body are decoupled: certificates are public and free to verify forever; the body goes to whoever pays the 5-cent retrieval — including your counterparty, an auditor, or an arbitrator you never met.

*witnessd is a small independent service. Verify the certificate above yourself before you believe anything in this post — that is the point.*
