> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seminode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Threads

> Threads are chains of quote and response events tied to an underlying listing via computed "h" tags.

A Thread is the chain of Quote and Response events that forms around a single Listing. Every event in a thread shares the same `"h"` tag — a deterministic thread ID that ties the conversation back to its root listing and the two parties involved.

## Why Thread IDs?

Listings are **replaceable events** (kind `31001`), meaning the underlying listing event ID can change when a listing is updated. A stable thread ID is needed so that the full quoting history can be queried reliably, even if the root listing has been republished.

The thread ID is also **party-specific**: two different trading partners quoting the same listing will each have their own distinct thread ID. This keeps conversations private and isolated between pairs of participants.

## Thread ID Computation

Given `event_id`, `pubkey1`, `pubkey2` (all 64-hex, lowercase), where `event_id` is the root listing event ID and `pubkey1`/`pubkey2` are the two conversation participants:

1. **Validate** `event_id` is non-empty (and 64-hex if enforcing format).
2. **Canonicalize order:** `pk_lo = min(pubkey1, pubkey2)`; `pk_hi = max(pubkey1, pubkey2)` (lexicographic).
3. **Concatenate (no delimiter):** `raw = event_id + pk_lo + pk_hi`.
4. **Hash:** `sha256(raw)`; **encode hex lowercase** → `thread_id`.

The pubkeys are sorted lexicographically before hashing so the result is identical regardless of which party computes it. Both the listing author and the quoting party will always arrive at the same thread ID for their conversation.
