Skip to content
On this page

Specification

OC Chat is a mode of OC Lock, not a new verb. This page is the normative reference, condensed and cross-linked to the concept pages. The base cryptography — X25519 ECDH + HKDF-SHA256 + AES-256-GCM, RFC 8785 canonicalization, BIP-322 identity binding — is unchanged from OC Lock and not restated here. Read the OC Lock spec first.

Normative source · v0.4.0

This page mirrors the structure of the full normative document, which lives in the spec repo.

oc-chat-protocol/SPEC.md (opens in a new tab)

The key words MUST, MUST NOT, SHOULD, MAY are per RFC 2119.

Status: 0.4.0 (2026-10-27). Before 1.0, a minor version can change the wire, and the spec's CHANGELOG says when it does. New kind values and new optional blocks (postage, seal sub-fields) are additive; clients MUST preserve unknown fields when relaying and MAY ignore them when decrypting. Incompatible changes increment OC Lock's envelope.v (currently 2).

What OC Chat adds (§1)Link to this section

OC Lock operating continuously over a thread, plus three things the base protocol does not have:

  1. A recipient-independent content id so a held envelope can be re-keyed after the fact (§3).
  2. Three canonical send modes — speak-now, pay-to-reach, seal-til-block (§4) — each adding exactly one Bitcoin-unique property.
  3. Encrypted threading with a verifiable hash-chain (§5).

Everything else (group keys, double-ratchet forward secrecy, the CLTV-witness seal) is a registry extension under reserved kinds (§10), not a canonical surface.

Envelope kinds (§2)Link to this section

kindModeNew fields
"chat"speak-now / pay-to-reachoptional postage (§6)
"chat-seal"seal-til-blockseal (§7)
"chat-channel"public channel post (§8.3)channel_id, write_proof

A conforming OC Lock implementation that does not understand these kinds MUST reject them rather than mis-decrypt. A chat-channel post is public — recipients[] MUST be empty (E_CHANNEL_RECIPIENTS otherwise). Detail: Envelope.

v0 status. @orangecheck/lock-core has no chat or chat-seal kind, so a v0 message — what chat.ochk.io sends — goes out as a base OC Lock identity envelope with hint: "oc-chat/v1", base OC Lock content addressing (recipients[] inside the id and the AAD), and postage / seal inside the encrypted body. The spec's §7.6 profile is normative for v0. The chat and chat-seal kinds and the §3 rule below are the upgrade target (vectors vc03, vc04).

Content addressing — the recipient-exclusion rule (§3)Link to this section

In the upgrade target, for kind ∈ { "chat", "chat-seal" }, recipients[] is delivery routing, not content, and is excluded from both the id and the AAD:

Code
chat_aad         = SHA-256( canonical( env | id="", ciphertext="", sig.value="", recipients=[] ) )
chat_envelope_id = SHA-256( canonical( env | id="", sig.value="", recipients=[] ) )

A holder MAY replace recipients[] (a re-wrap) and the id, sig, and ciphertext tag remain valid — the re-wrap output is a detached recipients[] entry merged locally, never a recompute of the signed id. Proven by vector vc04. Full rule: Envelope & content addressing.

The three send modes (§4)Link to this section

  • speak-now (§4.1) — kind="chat", no postage/seal. Per-device X25519 authenticates the send; BIP-322 is not signed per message. Free-tier anti-spam is recipient policy (mutual contact OR a BIP-322 UTXO floor). A non-clearing first message is delivered to a filtered/pending state, never dropped; acceptance is a private, revocable allowlist.
  • pay-to-reach (§4.2) — kind="chat" + a postage block. A stranger's first message must carry a valid Lightning preimage paid direct to the recipient.
  • seal-til-block (§4.3) — kind="chat-seal" + a seal block. The key is wrapped to a named beacon, released only after the chain passes unlock_block. Beacon-enforced, not consensus — "trustless" is forbidden.

In v0 the three modes share the identity kind, and postage and seal ride inside the encrypted body. Detail: The three send modes.

Threading (§5)Link to this section

Thread state is inside the encrypted payload: {body, conversation_id, seq, parent_id, recv_queue?}. parent_id MUST equal the chat_envelope_id of the parent (or null); clients order by the hash-chain and MUST NOT trust created_at. Attachments (§5.1) ride E2EE inside the payload (inline v0 profile: readers accept up to ~100 KiB, chat.ochk.io sends up to 32 KiB; blob-store upgrade for larger). Detail: Threading & attachments.

Postage (§6)Link to this section

A recipient publishes a floor_sats + an identity-signed Lightning endpoint (LNURL + LUD-18 in v0; BOLT12 recommended). The sender's postage block rides inside the encrypted payload (§6.2). The recipient runs the six-step offline verification (§6.3): settlement, the re-derived description-hash binding, recipient and payee (the invoice is signed by one of the recipient's own nodes), amount, nonce, and a local spent-ledger. No OC payment rail (§6.4); zap receipts are forbidden as proof. A named-Fedimint custodial fallback (§6.5) is gated on a money-transmitter analysis. Detail: Postage.

Seal (§7)Link to this section

The seal block carries unlock_block, anchor (beacon|cltv), beacon_id, beacon_url, redundant_beacon, confirmations. v0 ships the in-ciphertext drand-tlock profile (§7.6): the body is locked under a reveal secret tlock'd to a drand round, with a hard chain gate (the recipient MUST independently confirm chain_tip ≥ unlock_block + confirmations before surfacing the body). The beacon-device re-wrap path (§7.2–7.3) is the named upgrade target. Standing delivery (§7.7) is a max-wins composition. The anchor="cltv" consensus path (§7.4) is reserved. Detail: Seal-til-block.

Transport (§8)Link to this section

The envelope travels as the inner blob of a Nostr kind-1059 gift-wrap signed by an ephemeral key. The v2 encrypted wrap (§8, ct="oc-chat/v2") encrypts the content to the recipient inbox key, closing the social-graph leak. A durable inbox (§8.1) uses opaque per-conversation queue_ids (HMAC(HKDF(device_sk), conversation_id)) + a derivable bootstrap queue. NIP-42 relay AUTH (§8.4, kind-22242) is the institutional metadata hardening; chat.ochk.io does not support AUTH relays. Detail: Transport & durable inbox.

Directory (§8.2)Link to this section

A kind-30114 opt-in, addressable listing keyed by a salted handle hash. A handle belongs to the earliest claim anchored in Bitcoin that still stands. A resolver honors a claim only if all four hold: signed by inbox_pubkey; inbox_pubkey device-bound (kind-30078) to address; the claim's coin cleared the UTXO floor at its anchor and still stands; and the claim is anchored (OpenTimestamps, 6 confirmations). A read that gets no answer ends the walk with E_DIR_UNRESOLVED. The social-graph firewall (§8.2.3) keeps any edge metadata out. Revocation is by tombstone, forward-effective only. Detail: Discoverability directory.

Channels (§8.3)Link to this section

A kind-30110 founder-rooted governance descriptor + kind-30111 posts + a Bitcoin-priced write gate. v1 ships public channels. Exactly one write.policy with a matching rooted flag; only utxo-floor is Bitcoin-load-bearing. Five roles enforced offline by signature; moderation by forward-effective tombstone. Private channels (§8.3.7) are reserved behind the same descriptor. Source-intake (§8.5) is a composition. Detail: Channels.

Session devices (§8.6)Link to this section

A did:oc identity (the ochk.io session bridge) publishes a kind-30078 session device record, bound to its did:oc only by the ochk.io auth host's vouch, the named trust anchor. That bind is not offline-verifiable, so a receiver renders the device's messages as session ("via ochk.io").

Revocation. A session device is revoked by its own key, or by the ochk.io auth host with a signed oc-chat:device-revoke:v1 statement dated by the host. The host that vouches for a device can revoke it: the same named trust anchor. A revocation seen on any relay counts. ochk.io keeps keys it rotated out in its JWKS, marked retired, and a retired key verifies only what it signed before it retired (OC Chat 0.3.0). The host never vouches again for a device it revoked, and revoking a device ends the ochk.io sign-in that set it up (every other sign-in of the account when the host cannot tell which), with an offer to end the rest. A device that reads its own revocation asks for no new vouch and stops sending (OC Chat 0.3.1).

Stepping up. The same device key may also be bound to a Bitcoin address by an OC Lock device record it publishes (BIP-322 over a v3 statement that signs the key). A receiver looks up the kind-30078 records the signing key published and resolves each address as it resolves any address: the BIP-322 signature verifies, the record binds the key, and no revocation retires it. When one resolves, the message reads "verified · address"; otherwise it stays session. The sender is still the did:oc, and ochk.io is still its trust anchor; the step-up adds only the offline-verifiable link from the address to the key. An address merely linked to the account, or bound to a different key, never steps a message up. Vector vc18. Normative text: SPEC §8.6 (opens in a new tab).

Errors (§9)Link to this section

In addition to OC Lock §6 codes:

CodeMeaning
E_BLOCK_UNMETSeal release requested before unlock_block + confirmations confirmed.
E_BEACON_UNAVAILABLESeal beacon did not respond or could not be reached.
E_NO_POSTAGEA pay-to-reach envelope from a non-contact lacked valid postage for the floor.
E_BAD_POSTAGESHA-256(preimage) != payment_hash, the nonce/recipient/amount binding did not match, or the invoice was not signed by one of the recipient's own nodes.
E_THREAD_GAPparent_id does not resolve to a held parent envelope id.
E_QUEUE_ROUTEA durable-inbox deposit/drain referenced a queue_id the caller is not entitled to, or a malformed queue id.
E_DIR_UNVERIFIEDNo claim for the handle passes the §8.2.2 gate (unanchored claim / signature / kind-30078 binding / coin floor at the anchor).
E_DIR_UNRESOLVEDThe read could not settle the handle: a read before the holder got no answer, or the walk reached a bound. The client offers the address route.
E_DIR_REVOKEDThe resolved listing is a tombstone or absent — the handle is not discoverable.
E_CHANNEL_RECIPIENTSA chat-channel envelope carried a non-empty recipients[].
E_CH_POLICY_INVALIDA descriptor's write.rooted flag did not match its write.policy.
E_CH_UNAUTHORIZEDA descriptor replacement or moderation tombstone was signed by an out-of-roster address.
E_CH_WRITE_DENIEDA channel post failed the channel's write.policy gate.
E_CH_NOT_WRITERThe post author holds a reader-only role on the channel.
E_CHAN_FLOORA utxo-floor post's write_proof failed (bad control_sig, below value, or under age).
E_CH_CLOSEDThe channel is closed: new posts are denied; only removal tombstones are accepted.
E_RELAY_AUTH_REQUIREDAn auth-required relay rejected a publish/subscribe pending NIP-42 AUTH.
E_FEDIMINT_UNAVAILABLEA named-Fedimint postage endpoint did not respond.
E_FEDIMINT_BINDING_MISMATCHA federation-fronted postage invoice failed the §6.3 binding.

Nostr kind registry (§10)Link to this section

OC Chat claims 30110–30115. d-tags are verb-rooted (oc-lock-chat-*) because chat is a mode of the lock verb. The transport gift-wrap stays kind-1059 (NIP-59); device records stay kind-30078; relay AUTH uses kind-22242 (NIP-42, ephemeral, never stored).

KindObjectd-tag prefixStatus
30110channel descriptor (addressable)oc-lock-chat-ch:v1
30111channel post (chat-channel, addressable)oc-lock-chat-msg:v1
30112seal / block-height anchor descriptoroc-lock-chat-seal:draft
30113group-key rotation (private channels)oc-lock-chat-*:reserved
30114discoverability directory (addressable)oc-lock-chat-dir:v1
30115postage-policy record (pay-to-post)oc-lock-chat-*:reserved

The family registry is the public Nostr kind registry. This spec (§10 and §14) is the source for chat's own kinds.

Compliance checklist (§11)Link to this section

A client is OC Chat v0 compliant iff it:

  • Reuses OC Lock §4.2 wrapping verbatim for content_key.
  • Sends speak-now, pay-to-reach and seal-til-block messages as base OC Lock "identity" envelopes carrying hint: "oc-chat/v1", with base content addressing: recipients[] is inside both the id and the AAD. The recipient-exclusion rule (chat_aad, chat_envelope_id, vc03/vc04) belongs to the upgrade target.
  • Delivers a first message that does not clear the recipient's policy into the filtered/pending state, never dropping it; keeps the approval allowlist on the client, never published or carried on the wire; and emits no acceptance receipt: a reply is the only acceptance a sender sees (§4.1, S19).
  • Carries conversation_id/seq/parent_id inside the encrypted payload and orders by the parent_id hash-chain, never by created_at.
  • If it offers durable store-and-forward: derives queue_id/bootstrap_id per §8.1, routes solely on those opaque ids, stores the blob byte-for-byte, gates a proven bootstrap queue on §8.1.5 proofs, and reproduces vc06 and vc21.
  • If it offers the directory: publishes a kind-30114 listing only on explicit opt-in (default invisible), derives the salted-handle d-tag (vc07), orders claims by anchor and resolves a handle only when the §8.2.2 gate passes (signature, kind-30078 binding, a coin that cleared the floor at the anchor, an anchor with 6 confirmations), stops with E_DIR_UNRESOLVED rather than pass over a claim whose read got no answer, pins each contact to the address its handle resolved to, reads directory relays completely and runs the public audit, anchors before publishing, follows and makes re-points, enforces the social-graph firewall, honors tombstones (vc08), and exposes no bulk-dump endpoint (vc22–vc25).
  • For pay-to-reach: carries postage in the payload and runs the full §6.3 verification (re-deriving the description-hash binding itself, over verbatim bytes, and checking the preimage, amount, identifier and the local spent-ledger), routes a failing/replayed message to filtered/pending (never dropped), and never claims transferable third-party proof.
  • For seal-til-block: follows the v0 drand-tlock profile (§7.6). The seal block rides inside the encrypted body, the reveal secret is timelocked to the quicknet round derived from unlock_block, and the body is never shown before the client has itself confirmed chain_tip ≥ unlock_block + confirmations. It caps the horizon, states the Ed25519 verdict on every seal surface, reproduces vc10–vc13, and never labels a v0 beacon seal "trustless." The beacon-device wrap and release re-wrap (§7.2–7.3) belong to the upgrade target.
  • If it offers standing delivery (§7.7): carries standing_id inside the encrypted seal body, opens only the check-in with the highest unlock_block for a standing_id, and tells the author that a second check-in channel is recommended and not enforced.
  • Surfaces every trust anchor (beacon id/url, relay, any redundant beacon) and the early-release / brick risks at compose time.
  • Operates no OC payment rail for postage.
  • If it offers public channels: publishes a founder-rooted descriptor with one write.policy + matching rooted flag, publishes each version with its t, s and binding tags, fetches every version by #t (plus the legacy d-tag), reads every key the founder and admins have bound, revoked ones included, one key per read, walks forward by #s only from versions those reads returned, reports a read cut off at its bound as not read unless those reads were complete, validates the governance hash-chain over them (earlier versions by their binding, the last version only while its binding is live; status and successor_channel_id changed by the founder only), picks the tip as §8.3.1 orders it, re-signs before revoking a device, rejects a non-empty recipients[] channel post, verifies utxo-floor proofs against public chain data (deduped per outpoint, failing closed), renders non-rooted channels in the muted "via ochk.io" tier, honors tombstones, and reproduces vc14–vc17, vc19 and vc20.
  • If it supports an auth-required relay: completes the kind-22242 handshake, signs with a fresh per-connection ephemeral key by default, surfaces the relay as a named trust anchor, and never presents AUTH as making a relay trustless.
  • If it offers source-intake: warns the source the post is public + permanent, defaults to a fresh throwaway identity, never claims SecureDrop-grade anonymity.
  • If it offers a named-Fedimint postage fallback: surfaces the federation as a named custodian before the sender pays, lets the sender decline, keeps OC out of custody, and gates on a money-transmitter analysis.
  • If it accepts did:oc session devices: binds a session record only through a vouch that verifies against the ochk.io JWKS, renders it as session, and steps a message up to "verified · address" only when the signing key resolves to that address (vc18), and never asks for a new vouch for a device it has read a revocation of.
  • Emits the §9 + OC Lock §6 error codes.

Source documentsLink to this section