Skip to content
On this page

How it works

OC Chat is OC Lock operating continuously over a thread. The cryptography is unchanged from OC Lock; what changes is that the same seal/unseal primitive runs in a loop, over a persistent transport, with thread state inside the ciphertext. This page is the mental model end to end.

One binding, then zero-click foreverLink to this section

Code
  one binding per device: ochk.io's vouch, or a BIP-322 signature
        │
        ▼
  device_pk (X25519) ──published──▶ Nostr kind-30078  (find me by did:oc or bitcoin address)
        │                                   │
        │ inbox pubkey = HKDF(device_sk)     │ fetch by addr
        ▼                                   ▼
  every message: seal an OC Lock envelope ─▶ gift-wrap (kind-1059) ─▶ relay ─▶ recipient
                 (no per-message wallet popup)

The recipient's inbox pubkey is derived from the device key (HKDF(device_sk)), so publishing a device record is creating an inbox. Once the device is bound, sending and receiving are zero-click — the device key signs every send, and no wallet is asked per message. This is the single decision that takes the send loop from the old chat's 5–10s wallet popup to sub-second. (Why.)

The four moving partsLink to this section

1. Identity — a Bitcoin addressLink to this section

On chat.ochk.io your identity is your orangecheck account (a did:oc), and the protocol is built around a Bitcoin address you can bind to it. Every device you set up is a session device: ochk.io vouches that its key belongs to your account, so others see your messages "via ochk.io". (Session devices.)

Bind a Bitcoin address in Settings → Identity, one BIP-322 signature per device. A kind-30078 device record then binds that device's X25519 device_pk to the address, published to Nostr. Anyone can fetch it by address and verify the binding offline — no server is trusted. Each device is bound by its own record, and once that binding reaches their relays your messages read "verified · your address".

chat.ochk.io writes a device record, a Bitcoin binding and every revocation to your relays and to nostr-core's five (chat's own four relays are among them). It calls one done only once 2 of the five serve it back, each asked on its own: the family's write quorum. Below that it says "Not in effect yet", and Try again sends the same signed event again. A device lookup always asks the five, as well as chat's four. What a lookup did not return (no revocation, no device) counts only at the family's read floor: 4 of the five read in full, and none cut off partway (a relay that sends nothing is just silent). A revocation any relay returns counts at once. Below the floor chat sends nothing and says "Too few relays answered to check" the recipient's devices; your message is kept.

2. Discovery — fetch a device key by addressLink to this section

To message someone you know, you enter their did:oc or Bitcoin address; the client fetches their device records and verifies them. To be findable by a handle instead, opt in to the directory (kind-30114) — strictly optional, UTXO-gated, and revocable. The default is invisible.

3. Transport — gift-wrap that leaks nothingLink to this section

Each message is a sealed OC Lock envelope carried as the inner blob of a Nostr kind-1059 gift-wrap, signed by an ephemeral, discarded Schnorr key, with created_at rounded to the minute and the recipient inbox pubkey in the p tag. The v2 wrap encrypts its content to the inbox key, so a relay — or a durable-inbox operator — sees only:

The relay seesThe relay does not see
an ephemeral pubkeywho sent the message (fresh throwaway key every time)
an inbox pubkeythe sender's Bitcoin address or stable device pubkey
a minute timestampthe recipient's Bitcoin address or device set
ciphertextthe body, the conversation, or anything inside the envelope

Full transport detail, including the v2 wrap construction and the durable inbox, is in Transport & durable inbox.

4. Threading — a hash-chain inside the ciphertextLink to this section

Thread state never touches the plaintext envelope. The decrypted payload is JSON carrying conversation_id, a per-sender seq, and a parent_id that MUST equal the content-addressed id of the message it replies to. That makes each thread a tamper-evident hash-chain; clients order and validate by the chain and never trust created_at (which is plaintext). A missing parent is a detectable gap. See Threading & attachments.

Sending, step by stepLink to this section

  1. You enter a did:oc or Bitcoin address (or resolve a handle) and a message.
  2. The client fetches the recipient's device record(s) and verifies each binding: BIP-322 for an address, ochk.io's vouch for a did:oc.
  3. It builds the payload {body, conversation_id, seq, parent_id}, seals it to the recipient's device key(s) with a fresh content_key, and computes the envelope id. v0 uses base OC Lock addressing, with recipients[] inside the id; the re-wrap-safe rule that excludes them is the spec's upgrade target (§3).
  4. No wallet popup — the device key signs the envelope id.
  5. The envelope is gift-wrapped (fresh ephemeral key, minute-rounded created_at) and published to the relay pool.

Receiving, step by stepLink to this section

  1. Your device subscribes to kind-1059 events tagged with your inbox pubkey (and drains your durable queues).
  2. For each event, the client decrypts the v2 wrap, parses the envelope, finds your device_id, unwraps the content_key, and decrypts.
  3. The client checks the device signature and that the sender's key is bound to the address it names (a BIP-322 record, or ochk.io's vouch for a did:oc); the message chains by parent_id.
  4. By default anyone reaches your inbox. Under "Contacts only" or "Bitcoin floor", or once you charge postage, a first message from a non-contact that does not clear it lands in Requests (filtered/pending), never dropped — you approve the sender to let them through thereafter, and may revoke at any time. A first message whose checks cannot run, for instance because the device cannot read your inbox settings, also waits in Requests, marked that a check couldn't run; it never reaches the inbox unchecked.
  5. While the device cannot read its list of forgotten threads, new messages wait and the message list says so, so a thread you forgot does not come back. A message that waits is not lost: the durable inbox keeps it for the next drain, and relays send it again on the next start.

Multi-deviceLink to this section

Each of your devices has its own device key and its own kind-30078 record. A sender's client wraps the one content_key once per active device, so a message fans out to your laptop and phone alike. The portability cliff, disclosed: a message sent before a device existed was never wrapped to it, so a newly added device cannot read it without a backfill (the old device re-wraps the key, or a sealed key-bundle is retrieved by BIP-322 proof from the same address). A deployment promising "multi-device history" must implement one of these and state the limit.

Where it differs from the old lock.ochk.io chatLink to this section

Concernlock.ochk.io chat (v0 prototype)OC Chat
SendBIP-322 wallet popup every message (5–10s)sub-second; the device key signs, no popup
Orderingsorts by untrusted minute-rounded created_athash-chain parent_id
Offline deliverymessage can vanish if the relay GC's itbest-effort store-and-forward, free tier
Anti-spamnonepostage (paid) or a free BIP-322 UTXO floor
Future deliverynoneseal-til-block
Re-keying a held envelopebreaks id + tagsame in v0; the upgrade target is re-wrap safe

NextLink to this section