"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 (kind31001), 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
Givenevent_id, pubkey1, pubkey2 (all 64-hex, lowercase), where event_id is the root listing event ID and pubkey1/pubkey2 are the two conversation participants:
- Validate
event_idis non-empty (and 64-hex if enforcing format). - Canonicalize order:
pk_lo = min(pubkey1, pubkey2);pk_hi = max(pubkey1, pubkey2)(lexicographic). - Concatenate (no delimiter):
raw = event_id + pk_lo + pk_hi. - Hash:
sha256(raw); encode hex lowercase →thread_id.

