Protocol reference
This page is a quick reference for integrating. How a receipt is verified is the open HardState Receipt Format, and the machine-readable API contract is openapi.yaml, rendered endpoint by endpoint in the HTTP API reference.
Encoding
Section titled “Encoding”| Thing | Rule |
|---|---|
| Hashes | SHA-256, written as lowercase hex (64 characters). |
| Binary in JSON | base64url, no padding (signatures, keys, WebAuthn data). |
| Canonical JSON | RFC 8785 (JCS). canonical(x) is the UTF-8 bytes of the JCS serialization. |
| Times | RFC 3339 UTC strings, e.g. 2026-10-20T15:18:38.955Z. |
{ "hss": 1, "issuer": "esperanza-demo", "seq": 5, "prev": "09f54f6f…69b9ab", "type": "case.inspect", "case": "BP-2026-4077", "ts": "2026-10-20T15:18:39.120Z", "public": { "result": "pass", "inspector": "Unit 3" }, "docs": [{ "label": "Inspection report", "commitment": "…", "mime": "application/pdf", "size": 812 }], "actor": "ed25519:4be1…"}| Field | Rule |
|---|---|
hss |
MUST be 1. |
issuer |
Lowercase slug ^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$. Stable for the life of the log. |
seq |
0 for the first event, then exactly previous seq + 1. |
prev |
null at seq 0; otherwise the event hash of seq - 1. |
type |
^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$. Types below are reserved. |
case |
OPTIONAL, up to 128 characters. Groups the events of one procedure. |
ts |
When the issuer states the act happened. Untrusted; the Bitcoin anchor bounds it from above. |
public |
JSON object, published as-is. Never put personal data here. |
docs |
Array of document references (may be empty). |
actor |
Key id of the signer. |
The event hash is SHA-256(canonical(event)); the signature is not part of the event. A serialized event MUST NOT
exceed 64 KiB, and unknown top-level fields are rejected under hss: 1.
Signed event
Section titled “Signed event”{ "event": { … }, "sig": { "kind": "passkey" | "ed25519", … } }ed25519(system-to-system):sig.signatureis the signature over the 32 raw bytes of the event hash.passkey(people): a WebAuthn assertion (authenticatorData,clientDataJSON,signature) produced withchallenge = event_hash, verified as the Receipt Format describes.
Keys live in the issuer’s own log; there is no separate key registry.
{ "id": "…", "kind": "passkey" | "ed25519", "alg": -7 | -257 | -8, "publicKey": "<SPKI DER, base64url>", "role": "admin" | "official" | "system" | "session", "label": "Ana López — Building inspector", "rpId": "app.hardstate.net", "scope": { "types": ["case.*", "fee.paid"], "expires": "2026-10-20T20:00:00Z" } }- Passkeys:
idis the WebAuthn credential id (base64url);rpIdis REQUIRED;algis-7(ES256) or-257(RS256). - Ed25519 keys:
algMUST be-8;idis"ed25519:" + hex(SHA-256(spki))[0:32]. scope.types: exact types or a trailing wildcard ("case.*"); MUST NOT grant system types.scope.expires: the lastevent.tsthe key may sign.- Roles:
adminandofficialare people;systemis a person-less process and MUST carryscope.types;sessionkeys exist only throughsession.open.systemandsessionkeys MUST NOT signissuer.*,key.*, orsession.open.
Reserved system event types
Section titled “Reserved system event types”| Type | What it does | Signed by |
|---|---|---|
issuer.create |
seq 0. Declares public.name, optional jurisdiction / location / website, and public.key (the founding admin key). |
the key it declares |
key.add |
Adds a key in public.key. |
an active admin |
key.revoke |
Revokes public.keyId. The last active admin MUST NOT be revoked. |
an active admin |
issuer.update |
Merges profile changes into the issuer’s profile. | an active admin |
session.open |
Declares a session key in public.key; scope.expires ≤ 30 days. |
an active admin or official |
session.close |
Closes the session named by public.keyId. |
the opener, the session itself, or an admin |
Every other event type is the issuer’s own vocabulary (domain.action).
AI records
Section titled “AI records”A recommended vocabulary, not a protocol change: ai is an issuer domain like any other. The AI system signs with a
system key scoped to ai.decision, ai.run and ai.heartbeat; a person signs the review (never the system’s key). Contents are only ever salted commitments in docs.
| Type | Signed by | public |
|---|---|---|
ai.decision |
the AI system | system, model, version, config?, outcome, oversight (required | none), score?, explanation? |
ai.run |
the AI system | system, model, version, steps, root (one seal over the run’s steps), outcome? |
ai.review |
a person | decision (event hash), action (confirm | override | reject), outcome? |
ai.heartbeat |
the AI system | every (seconds), decisions, runs, failures, since (seq of the previous beat), instance, digest |
See AI decisions for how to record them over HTTP and what each field is for.
Documents
Section titled “Documents”commitment = SHA-256("hardstate/doc/v1" ‖ salt ‖ SHA-256(file)) salt: 32 random bytesPublishing a document reveals its salt and SHA-256(file) and makes the bytes available. Receipts carry salts in
the URL fragment (/r/<event_hash>#k=<commitment[0:16]>.<salt>,…), which browsers never send to a server.
Anchoring
Section titled “Anchoring”| Layer | Fact |
|---|---|
| Batches | RFC 9162 (CT v2) Merkle tree; leaf data 0x01 ‖ event_hash (events) or 0x02 ‖ digest (stamps), reference interval 10 minutes. |
| OpenTimestamps | Every batch root → ≥ 2 public calendars; a standard detached .ots (ots verify -d <root> <file>.ots). |
| HardState Anchor | OP_RETURN PUSH36("HSS" ‖ 0x01 ‖ root), script 6a 24 48 53 53 01 <32 bytes>. Anchor-tree leaf data is 0x03 ‖ batch_root. |
Signet anchors are labelled as tests and never count as a Bitcoin proof.
HTTP API
Section titled “HTTP API”Base URL https://api.hardstate.net (http://localhost:8787 locally). Reads are open and keyless. Writes need no API
key — an event is accepted only if it extends its issuer’s log and is signed by an authorized key.
Every endpoint, with its parameters, responses and code samples, is in the HTTP API reference, generated from the OpenAPI contract the API itself follows.
POST /v1/events status codes
Section titled “POST /v1/events status codes”| Code | Meaning |
|---|---|
201 |
Appended: { hash, issuer, seq, status: "queued", proof, receipt }. |
404 |
The issuer does not exist and the event is not issuer.create. |
409 |
The log head moved: { error, head }. Rebuild on the returned head and sign again. |
422 |
Shape, chain, authorization, or signature check failed. |
429 |
Rate limited. |
HardState is a Zevlat Intelligence venture. © 2026 Zevlat Intelligence.