# timestamped.io proof formats

This document specifies, byte for byte, everything timestamped.io has ever written to the BSV blockchain or handed to a user as a proof. Anyone can verify a timestamp from this document, the raw transaction from any public explorer, and nothing else. `verifier/timestamped_verify.py` is a stdlib-only reference implementation.

**Spec version 1.3** (2026-11-14). Version 1.0 described the on-chain formats; 1.1 adds envelope certificates (section 5), block inclusion with TSC and BUMP Merkle proofs (section 7), offline evidence (section 8) and the trust model (section 9). 1.2 adds agent records, Merkle batches and streams (section 10). No existing byte layout changed. Changes are listed under Changelog.

**Frozen.** Every format below is immutable: a change to any of them would break timestamps already issued. A new format gets a new magic or version string and a new parser; the old parsers are kept forever. The test file `tests/test_golden_formats.py` pins the expected bytes and is never edited.

Notation: byte strings are hex; `"abc"` means the UTF-8 bytes of `abc`; `len8(x)` is one byte holding the length of `x`; `len16be(x)` is a two-byte big-endian length.

## 1. Public mode (API value `verifiable`)

Written by `HashStorageService.build_pushdata_script` with the payload from `build_structured_proof_payload`. One output of the transaction carries the locking script below; the output is a normal spendable payment to a service address, so the data is kept by every node.

### 1.1 Payload

```
"timestamped.io/v1"          17 bytes   protocol magic
"1.0"                         3 bytes   protocol version
len8(algo) + algo             1 + 6     algo = "SHA256"
hash                         32 bytes   the file's SHA-256 digest
len8(mode) + mode             1 + 10    mode = "verifiable"
len16be(meta) + meta          2 + n     meta = compact JSON of the user metadata, or n = 0
```

`meta` is `json.dumps(metadata, separators=(",", ":"))`, truncated to 200 bytes. Without metadata the payload is exactly 72 bytes.

### 1.2 Locking script

```
20 <hash (32 bytes)>                  direct push of the hash
<push: payload>                       0x01..0x4b direct, 4c nn (PUSHDATA1) if ≤ 255 bytes, 4d nnnn (PUSHDATA2) otherwise
75 75                                 OP_DROP OP_DROP
76 a9 14 <20-byte pubkey hash> 88 ac  standard P2PKH
```

### 1.3 Worked example (golden vector)

hash = `aa…aa` (32 bytes of `0xaa`), no metadata, destination `1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa`:

```
20 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4c 48
   74696d657374616d7065642e696f2f7631      "timestamped.io/v1"
   312e30                                  "1.0"
   06 534841323536                         "SHA256"
   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   0a 76657269666961626c65                 "verifiable"
   0000                                    no metadata
75 75
76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac
```

With metadata `{"k":"v"}` the push becomes `4c 51` and the tail of the payload reads `0009 7b226b223a2276227d`.

### 1.4 Verification

1. Compute `hash = SHA-256(file)`.
2. Fetch the raw transaction for the txid from any explorer (`https://api.bitails.io/download/tx/<txid>/hex` or `https://api.whatsonchain.com/v1/bsv/main/tx/<txid>/hex`) and check that `SHA-256(SHA-256(raw))`, byte-reversed, equals the txid, so a wrong or dishonest explorer response is rejected.
3. For each output, list the data pushes of the locking script in order.
4. The timestamp is valid if some output's first push equals `hash` and its second push starts with `"timestamped.io/v1"` and contains `hash` at offset `17 + 3 + 1 + len(algo)`.
5. Prove that the transaction is in a block (section 7). The block gives the time; a transaction that is not in a block proves nothing about time.

Live examples: record 10, hash `a4b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1`, txid `f2834b8d7754267c4b27aa77ba887e4b7d298487597c677ff59ab3c5c77ee499`, block 930470.

### 1.5 Early layout (January 2026, before the structured payload)

Records created before the structured payload existed (for example live records 10 and 14) carry the same `storage_type` (`op_pushdata`) and mode (`verifiable`) but a simpler script, built by the `use_structured_payload=False` branch of `build_pushdata_script`:

```
20 <hash (32 bytes)>
0e "timestamped.io"                   14-byte prefix (NUL-padded if shorter)
[<push: metadata>]                    optional, UTF-8 "k:v" pairs and "Signature: …", at most 75 bytes
6d 75                                 OP_2DROP OP_DROP
76 a9 14 <20-byte pubkey hash> 88 ac  standard P2PKH
```

Live example, record 14 (hash `a70545a35d40f79769630f3ae7e5f3adc6639d993cc2549a823dac5ab96b160e`, txid `27dda16448a2ddd518bab9f68a3b5af5ffb05e9ad2c1dcf1a3e8267482d511b4`):

```
20 a70545a35d40f79769630f3ae7e5f3adc6639d993cc2549a823dac5ab96b160e
0e 74696d657374616d7065642e696f
6d 75
76a9144e9a33b57dc1a33374fe9956511fca9a78bd693388ac
```

Verification: as in 1.4, but step 4 also accepts an output whose first push equals `hash` and whose second push is the 14-byte prefix `timestamped.io`.

## 2. Private mode (API value `silent`) and Anonymous mode (API value `stealth`)

Nothing identifying goes on-chain. The user holds a **proof blob**; the transaction pays at least one satoshi to an address that only that blob can reproduce. Private mode builds the blob on the server for a logged-in user and keeps it for re-download. Anonymous mode builds it in the browser and sends only the derived address (`POST /v1/timestamp/stealth/broadcast`), so the server never sees the hash or the proof. The deprecated server-built endpoint `POST /v1/timestamp/stealth` returns the blob once without storing it, but it does record the hash, the notes and the derived address; treat it as Private without an account, not as anonymous.

### 2.1 Proof blob (`SilentTimestampService.create_canonical_proof_blob`)

```
"timestamped.io/silent"      21 bytes   protocol magic
"1.0"                         3 bytes   protocol version
len8(algo) + algo             1 + 6     algo = "SHA256"
hash                         32 bytes   the file's SHA-256 digest
len8(mode) + mode             1 + 6     mode = "silent"
len8(notes) + notes           1 + n     user notes in UTF-8, n = 0 when absent (at most 255 bytes)
```

### 2.2 Address derivation (`derive_address_from_proof`)

```
k        = SHA-256(proof blob)                       32-byte secp256k1 private key
pubkey   = compressed public key of k                33 bytes (02/03 || x)
address  = Base58Check(0x00 || RIPEMD-160(SHA-256(pubkey)))   mainnet P2PKH
```

The transaction has one output paying `≥ 1` satoshi to `76 a9 14 <RIPEMD-160(SHA-256(pubkey))> 88 ac`. The service can never spend that output and does not need to.

### 2.3 Worked examples (golden vectors)

hash `aa…aa`, notes `golden`:

```
74696d657374616d7065642e696f2f73696c656e74 312e30 06 534841323536 aa×32 06 73696c656e74 06 676f6c64656e
→ 1AtMmTfx4VfNgwMCfrv4v8q3t5EgCSPxMe
```

hash `aa…aa`, no notes:

```
74696d657374616d7065642e696f2f73696c656e74 312e30 06 534841323536 aa×32 06 73696c656e74 00
→ 1HbeXpMKrZ6WAkmX7UWtVNtMkxisyYkukA
```

Live fixture (an Anonymous timestamp created by the operator for the test suite; the proof is not a user's secret):

```
hash     a58c533c42f8a9bbe656935cf1f9ed1994502ed3333008e76bf6d734dbf73a0f
notes    golden-live
blob     74696d657374616d7065642e696f2f73696c656e74312e3006534841323536
         a58c533c42f8a9bbe656935cf1f9ed1994502ed3333008e76bf6d734dbf73a0f
         0673696c656e740b676f6c64656e2d6c697665
address  1DfE22QhdyFNt4xr1HjQM6Tz1K5ZuyepWx
txid     e51a492c96f868932f7af40f625aa0929096b45d4cd13a3fc156764518ced31f
         output 0: 1 satoshi to 76a9148adc2ebb83d3671cf2ce71f44e161ce0e49a7c1a88ac
```

### 2.4 Verification

1. Check the blob starts with `"timestamped.io/silent"` and parse it as in 2.1; confirm the embedded hash equals `SHA-256(file)`.
2. Derive the address as in 2.2.
3. Fetch the raw transaction for the txid.
4. The timestamp is valid if some output pays `≥ 1` satoshi to the P2PKH script of that address.

Because the address is a one-way function of the blob, a transaction that pays it proves the blob (and therefore the hash) existed when the transaction was mined. Changing one byte of the file or of the notes changes the address.

## 3. Legacy OP_RETURN (storage type `op_return`)

Used before Public mode existed. Written by `build_op_return_payload` and broadcast with an unspendable output:

```
00 6a <push: payload>                 OP_FALSE OP_RETURN, push rules as in 1.2
payload = "timestamped.io" " " <hash as 64 ASCII hex chars> [" " <"k:v" pairs joined by spaces> [" " "Signature: " <signature>]]
```

Golden vector (hash `aa…aa` written as ASCII `a`×64, metadata `desc:x`, signature `sig`):

```
74696d657374616d7065642e696f 20 61×64 20 646573633a78 20 5369676e61747572653a20736967
```

Verification: find an output whose script starts `00 6a`, take its single push, split on spaces; valid if the first field is `timestamped.io` and the second equals the hex of `SHA-256(file)` (case-insensitive).

## 4. URL timestamps (proof package)

A URL timestamp captures a page, hashes the visible text and the screenshot, and anchors a combined hash in **Public mode** (section 1) with metadata `{"type":"url_timestamp","url":<url, first 200 chars>}`.

```
text_content_hash = SHA-256(visible text, UTF-8)                       hex
screenshot_hash   = SHA-256(screenshot PNG bytes)                      hex
combined_hash     = SHA-256(text_content_hash || screenshot_hash)      the two 64-char hex strings concatenated, as ASCII
```

The downloadable proof package is JSON, `version` `"1.0"`:

```json
{
  "version": "1.0", "service": "timestamped.io", "type": "url_timestamp",
  "url": "...", "final_url": "...", "page_title": "...", "privacy_mode": "public|private",
  "timestamped_at": "<ISO-8601>",
  "hashes": {"text_content_hash": "...", "screenshot_hash": "...", "combined_hash": "..."},
  "blockchain": {"network": "BSV", "txid": "...", "explorer_url": "...", "block_height": 0, "block_time": "...", "merkle_proof": null},
  "verification": {"instructions": "...", "verify_url": "..."}
}
```

Verification: re-hash the screenshot PNG from the download, take `text_content_hash` from the package (the service keeps only the hash of the visible text, not the text; if you captured the page text yourself, hash it instead), recompute `combined_hash` and check it matches, then verify `combined_hash` as a Public-mode hash (1.4) against the txid. What the chain proves is therefore: this screenshot, together with a text whose hash the package states, existed at that time.

This holds for every `privacy_mode`: the anchor is always Public mode, so the URL (first 200 characters) is readable on-chain even for `private` URL timestamps; `privacy_mode` only controls who can see the record and screenshot on timestamped.io.

`blockchain.merkle_proof` is reserved for a TSC proof (section 7). As of 2026-11-10 the service never fills it (it is always `null`), and `block_height`/`block_time` are the service's own record; fetch the proof and header as in section 8. `GET /v1/url-timestamps/{id}/proof` returns this JSON; the ZIP with the screenshot is assembled by the website.

Live example: txid `6de0e3d5a873d9ddb1cb11b97e424e7128b953b76a5fd5ea7e53d43b9955b163`, combined hash `35eeb99fd771e5f75a11e553fcff25ba45ff68a432ff56af2677f7f37a2f698e`.

## 5. Signature envelopes

A signature envelope has two signers (slots 1 and 2) and a notary. Each of the three signs a canonical text message with RSA-PSS, and each signature is followed by one Public-mode anchor of the **document hash** (section 1). The signatures themselves are not on-chain; they are in the certificate, `GET /v1/envelopes/{id}/certificate`.

### 5.1 Canonical messages

UTF-8, every line ending in `\n`. `file_hash` is used verbatim as the certificate states it (envelopes do not normalise its case):

```
timestamped.io/v1/envelope-sign          signer (slot 1 or 2)
envelope_id:<envelope id>
file_hash:<file hash>
slot:<1 | 2>

timestamped.io/v1/envelope-notarize      notary
envelope_id:<envelope id>
file_hash:<file hash>
signer_1_pubkey_fpr:<fingerprint of signer 1's key>
signer_1_txid:<signer 1's anchor txid>
signer_2_pubkey_fpr:<fingerprint of signer 2's key>
signer_2_txid:<signer 2's anchor txid>
```

`fingerprint = hex(SHA-256(SubjectPublicKeyInfo DER))[:16]`, the first 16 hex characters.

### 5.2 Signatures

RSASSA-PSS (RFC 8017) with SHA-256, MGF1-SHA-256 and a 32-byte salt, over the UTF-8 bytes of the canonical message. Public keys are PEM `BEGIN PUBLIC KEY` (SubjectPublicKeyInfo), as browsers export them; signatures are hex.

### 5.3 Anchors

Each signature is followed by a Public-mode timestamp (section 1.1) of the envelope's `file_hash`, with metadata `{"envelope_id":"<id>","envelope_role":"<signer_1 | signer_2 | notary>"}`. The certificate lists each anchor's txid (`signers[].txid`, `notary_txid`).

### 5.4 Certificate (JSON)

```json
{
  "id": "...", "file_hash": "...", "title": "...", "status": "notarized",
  "signers": [{"slot": 1, "claimed_name": "...", "claimed_email": "...", "public_key_pem": "...",
               "signature_hex": "...", "canonical_message": "...", "authenticated_via": "email_otp",
               "txid": "...", "signed_at": "<ISO-8601>"}, {"slot": 2, "...": "..."}],
  "notary_public_key_pem": "...", "notary_signature_hex": "...", "notary_canonical_message": "...",
  "notary_txid": "...", "notarized_at": "<ISO-8601>"
}
```

### 5.5 Verification

1. Optionally, check `SHA-256(document) == file_hash`.
2. For each signer, rebuild the message (5.1); it must equal `canonical_message`. Verify `signature_hex` with `public_key_pem` (5.2).
3. A notarized certificate must have exactly two signers, slots 1 and 2, each with a key, a signature and an anchor txid; otherwise it is invalid. Rebuild the notary message from the signers' keys and txids; it must equal `notary_canonical_message`. Verify `notary_signature_hex`.
4. For each anchor txid, verify `file_hash` as a Public-mode hash (1.4) and check that the metadata names this envelope and role. Prove block inclusion (section 7).

What this proves: these keys signed this document hash, the notary signed after both signer anchors existed (their txids are inside the notary message), and each anchor is in a block. Signer anchors may share a block, so block times alone do not order them. What it does not prove: `claimed_name`, `claimed_email` and `authenticated_via` are statements by timestamped.io, not by the chain or the signatures.

## 6. Versioning rule

- `"timestamped.io/v1"` + `"1.0"`, `"timestamped.io/silent"` + `"1.0"`, the legacy OP_RETURN prefix, and proof package `"version": "1.0"` are final.
- Any new field, encoding, or hash algorithm ships under a new magic or version string, with its own section in this document and its own parser; existing parsers are never changed or removed.
- Migrations never rewrite `file_hash`, `txid`, `proof_blob`, `derived_address`, `storage_type`, `timestamp_mode`, `protocol_version`, or `combined_hash`.

## 7. Block inclusion (Merkle proof and block header)

Every check above shows that a transaction *commits to* a claim. To show *when*, prove that the transaction is in a block:

1. `txid = reverse(SHA-256(SHA-256(raw transaction)))`. Reject a 64-byte transaction, which is ambiguous with an inner Merkle node.
2. Walk the Merkle proof from the txid to a Merkle root. A parent is `reverse(SHA-256(SHA-256(reverse(left) || reverse(right))))`, with hashes written in display order, as explorers show txids.
3. Take the 80-byte block header. Its hash is `reverse(SHA-256(SHA-256(header)))`, its Merkle root is bytes 36–67 reversed, and its time is bytes 68–71 (little-endian Unix time).
4. The proof's root must equal the header's Merkle root. The header hash must be at or below the target encoded in its `bits` (bytes 72–75).
5. The header's difficulty (`0xffff·2^208 / target`) must be at least a floor; the reference verifier uses 10^9. Proof of work alone only shows that *some* work was done, and a header at the 2009 minimum difficulty can be forged in minutes. Real BSV blocks since the first timestamped.io record have difficulty around 3·10^10. The floor makes a forged header cost real mining; it does not replace checking the block hash (section 9).

### 7.1 Format in use: TSC (BRC-10), not BUMP

Proofs come from public explorers (Bitails, WhatsOnChain: `GET /tx/<txid>/proof/tsc`) and from `GET /v1/proof/{txid}` as `merkle_proof`, in the **TSC Merkle proof standardised format** (BRC-10), single-branch form:

```json
{"index": 69, "txOrId": "<txid>", "target": "<block hash>", "nodes": ["<hash>", "*", "..."]}
```

- `index` is the transaction's position in the block. At level `i`, bit `i` of the index says whether the working hash is the right child (1) or the left child (0).
- `"*"` means "repeat the working hash" (the last node of an odd level); it is only valid when the working hash is the left child.
- `targetType` is absent and defaults to `"hash"`: `target` is the block hash. `"header"` (the header in hex) and `"merkleRoot"` are also accepted. `composite` proofs and `proofType: "tree"` are rejected.

Live vector: record 10 (txid `f2834b8d…e499`) is at index 69 of block 930470, `00000000000000000f7c910df47de8a4640f59e368f2a4586951cdbda4afe931`. The test file `tests/test_ar3_verifier.py` pins the proof, the raw transaction and the header.

### 7.2 BUMP (BRC-74)

BUMP encodes the block height and the needed hashes of each tree level, for one or many transactions of a block, in a binary form (hashes stored in internal byte order) and a JSON form (`{"blockHeight", "path": [[{"offset", "hash" | "duplicate", "txid"?}]]}`). It is what current BSV wallets and SDKs exchange (SPV/BEEF). The height is a claim of the BUMP's producer: a header does not contain its height, so check it with your header source.

The service does not produce BUMP today. Support, in order of cost:

1. **Verifier (done):** accepts BUMP in both encodings, and converts a TSC proof to a single-transaction BUMP when the block height is known (`tsc_to_bump`). Checked against the BRC-74 test vector and the real header of block 813706.
2. **API (proposed, additive):** `GET /v1/proof/{txid}?format=bump` returns `{"txid", "raw_transaction_hex", "merkle_proof": <BUMP JSON>, "format": "bump"}`, converted from the TSC proof with the block height. Without `format`, the response stays as it is.
3. **Batches (AR-2):** a batched anchor needs two proofs, the item's path inside our own batch tree and the transaction's BUMP. The batch format will be specified here as a new versioned section before it is built.

## 8. Offline evidence

To verify without any network access later, keep three files per transaction, from any source:

```
<txid>.rawtx.hex     the raw transaction, hex
<txid>.proof.json    a TSC proof, a BUMP (JSON, or binary in hex), or a saved GET /v1/proof/{txid} response
<txid>.header.hex    the 80-byte header of the block the proof points at, hex
```

`timestamped_verify.py fetch --txid <txid> --out <folder>` writes them from public explorers. Every check takes `--evidence <folder> --offline`.

Since spec 1.2, the service checks and stores the raw transaction, TSC proof and header of every hash stamp and agent-record anchor mined after that release, and `/v1/proof/{txid}` serves the stored copy. Older stamps and URL timestamps are still fetched from Bitails on request, and Bitails prunes. Keep your own copy of anything you rely on either way.

## 9. Trust model

- The verifier needs nothing from timestamped.io. Raw transactions are checked against their txid, and Merkle proofs against the header.
- A block header with valid proof of work shows that work was spent on that block. It does not show that the block is on the main chain. Compare the block hash with a header source you trust: your own node, a headers-only client, or two independent explorers.
- The block time is set by the miner. Consensus keeps it within about two hours of real time and above the median of the previous 11 blocks.
- What each format proves is stated in its section. In short: the chain proves a hash existed by a time. Names, emails and page text are proven only as far as their hashes are.
- **Nothing here shows who made an anchor.** Anyone can broadcast a transaction in these formats, with any tag. A valid receipt or certificate proves that its content existed by the block time; it does not prove that timestamped.io issued it. If that matters, check the receipt's service signature (10.8) when it has one, or ask the service: `GET /v1/records/{record_id}` and `GET /v1/envelopes/{id}/certificate` return what it issued.

## 10. Agent records, Merkle batches and streams (`POST /v1/timestamp/batch`)

An **agent record** is a small binary structure that binds a document hash to an optional private metadata commitment and an optional position in a stream. Its SHA-256 (the **digest**) is anchored on-chain, either alone or as a leaf of a Merkle batch. Every anchor uses the Public-mode layout of section 1.1 unchanged, so no new on-chain byte format exists. What is new is how the anchored hash is derived; this section defines it.

### 10.1 Record

```
"timestamped.io/record"      21 bytes   magic
"1.0"                         3 bytes   version
nonce                        32 bytes   random, fresh per record
file_hash                    32 bytes   the SHA-256 being recorded
metadata_commitment          32 bytes   10.2, or 32 zero bytes when there is no metadata
len8(stream_id) + stream_id   1 + n     n = 0 without a stream; 1..64 bytes of [A-Za-z0-9._:-]
sequence                      8 bytes   big-endian; 0 without a stream, 1, 2, 3, … within a stream
prev_digest                  32 bytes   digest of the previous record in the stream; zero for sequence 1 and without a stream
digest = SHA-256(record)
```

The nonce makes the digest unlinkable to the file hash: anchoring the digest of a guessable document reveals nothing.

### 10.2 Private metadata

The metadata is a JSON object. The service serialises it once (`json.dumps(obj, sort_keys=True, separators=(",", ":"), ensure_ascii=False)`, UTF-8), stores those bytes encrypted (AES-256-GCM) and returns them with a random 32-byte salt:

```
metadata_commitment = SHA-256("timestamped.io/metadata/1.0" || salt || metadata_bytes)
```

Verification hashes the exact bytes returned, never a re-serialisation. Neither the metadata nor the commitment goes on-chain in readable form; only the record digest (or a batch root) does. The salt stops anyone from confirming a guessed value such as an `agent_id`.

### 10.3 Merkle batch

Leaves are record digests in request order. The tree is the RFC 9162 (Certificate Transparency) Merkle tree: domain-separated, odd nodes are never duplicated.

```
leaf(d)    = SHA-256(0x00 || d)
node(l, r) = SHA-256(0x01 || l || r)
MTH([d])   = leaf(d)
MTH(D[n])  = node(MTH(D[0:k]), MTH(D[k:n]))   k = the largest power of two smaller than n
```

An item's inclusion proof is `(index, size, path)`: the RFC 9162 audit path, a list of 32-byte hashes from the leaf level upwards. It is checked with the RFC 9162 section 2.1.3.2 algorithm.

### 10.4 Anchors

| Method | Anchored hash (section 1.1 `hash`) | On-chain metadata |
|---|---|---|
| `single` | the record digest | `{"t":"record","v":"1.0"}` |
| `merkle` | the batch root | `{"t":"batch","v":"1.0","n":<number of leaves>}` |

### 10.5 Receipt (JSON)

The service returns one receipt per record. It holds everything needed to verify offline. Keep it.

```json
{
  "format": "timestamped.io/receipt", "version": "1.0",
  "record": {"nonce": "<hex>", "file_hash": "<hex>", "metadata_commitment": "<hex>|null",
             "stream_id": "<str>|null", "sequence": 0, "prev_digest": "<hex>|null"},
  "digest": "<hex>",
  "anchor": {"method": "single|merkle", "txid": "<hex>|null",
             "merkle": {"index": 0, "size": 1, "path": ["<hex>"], "root": "<hex>"} },
  "metadata": {"json": "<the exact metadata bytes as a string>", "salt": "<hex>"}
}
```

`anchor.merkle` is null for `single`. `metadata` is null without metadata and is only returned to the record's owner. `txid` is null until the anchor is broadcast.

### 10.6 Verification

1. Rebuild the record bytes (10.1) from `record`; `SHA-256` must equal `digest`.
2. With `metadata`: recompute the commitment (10.2) from `metadata.json` (UTF-8) and `metadata.salt`; it must equal `record.metadata_commitment`.
3. `single`: verify `digest` as a Public-mode hash (1.4) in `txid`. `merkle`: compute the root from `digest`, `index`, `size` and `path` (10.3); it must equal `merkle.root`; verify `merkle.root` as a Public-mode hash in `txid`.
4. Prove block inclusion (section 7).

### 10.7 Streams

Records with the same `stream_id` (per account) form a hash chain: sequence numbers increase by one from 1, and each record's `prev_digest` is the previous record's digest. Given the receipts of a stream, a verifier checks those links. Then:

- a deleted or reordered record breaks a link or the sequence;
- a changed record changes its digest, which breaks the next link and its anchor;
- **removing records from the end cannot be detected from the chain alone**: only someone holding a later receipt (or the last sequence number) can tell. Keep the latest receipt, or periodically publish it.

- **a second branch cannot be detected offline from unsigned receipts**: someone holding the account can anchor different records under the same sequence numbers, and both branches verify. Only one branch can carry the service signature for a given account (10.8). `GET /v1/streams/{stream_id}/verify` reports the one stream the service holds.

The chain is fixed when a record is created, before it is anchored. If an anchor fails, the record keeps its place and its link; the stream verify endpoint reports it as unanchored.

### 10.8 Service signature (optional)

Everything above shows that a record existed by a block time. It does not show who anchored it (section 9). When the service signs receipts, a receipt has one more object:

```json
"issuer": {"key_id": "<16 hex>", "account": "<32 hex>", "signature": "<hex>"}
```

- `signature` is RSASSA-PSS with SHA-256, MGF1-SHA-256 and a 32-byte salt (the same scheme as 5.2) over the UTF-8 bytes of:

  ```
  timestamped.io/v1/receipt-issue\n
  account:<account>\n
  commitment:<hex>\n
  ```

  `commitment` is what the anchor commits to: the record's `digest` for `single`, the Merkle `root` for `merkle`. One signature therefore serves every receipt of a Merkle batch.
- `account` is the same for every receipt the service issues for one account, and says nothing else about the account.
- `key_id` is the first 16 hex characters of SHA-256 over the public key's SubjectPublicKeyInfo DER (as in 5.1). The public key is served at `GET /v1/receipt-key`; keep a copy to verify offline.

Verification: take the public key whose id is `key_id` from a source you trust (the verifier never fetches it), rebuild the message from `issuer.account` and the commitment found in step 2 of 10.6, and verify the signature. For several receipts of one stream, `account` must be the same in all of them; if you know which account the records should come from, compare `account` with that.

What it adds: the holder of that key issued this record for that account. The service issues one record per account, stream and sequence, so within one account two branches of a stream cannot both carry its signature. Another account can use the same stream name and get signed receipts with a different `account`, which is why the tag is compared. What it does not add: anything about the content, or about who an account belongs to.

A receipt without `issuer` is still a valid receipt; it just carries no such statement. The signature is made each time a receipt is returned and is not deterministic, so two copies of one receipt can differ in `signature` and both verify.

## Changelog

- **1.3 (2026-11-14):** section 10.8, an optional `issuer` object on receipts (service signature). No existing field or byte layout changed; receipts without it, and verifiers that ignore it, work as before.
- **1.2.1 (2026-11-14):** no format changed. 5.5 step 3 now says that a notarized certificate with a missing or unanchored signer is invalid (the verifier used to accept one). Sections 9 and 10.7 now say what offline verification cannot show: who made an anchor, and a second branch of a stream.
- **1.2 (2026-11-10):** section 10 (agent records, private metadata commitments, Merkle batches, receipts, streams). No existing format changed.
- **1.1 (2026-11-10):**
  - Added sections 5 (envelope certificates, previously one paragraph), 7, 8 and 9.
  - 1.4 step 5 now requires block inclusion.
  - Section 4 now states that URL anchors are Public in every privacy mode, and that `merkle_proof` is not filled.
  - No format changed.
- **1.0:** on-chain formats of sections 1–4.
