Rendezvous hashing for chat threads, replica count scaling, media cache lifecycle, and the critical independence of PSBT shards.
Not all data is replicated to every node. Chat messages and media cache entries are sharded across the network using rendezvous hashing to distribute storage and query load. Protocol data (listings, orders, governance) remains fully replicated.
Chat threads are assigned to nodes using rendezvous hashing (also called highest random weight hashing):
For each node in the ring:
score = SHA256(nodeId + ":" + threadId)
Sort all nodes by score descending.
The top R nodes are shard owners for this thread.This approach has a critical advantage over consistent hashing: when a node joins or leaves, only the minimum number of threads need to be reassigned. There is no "virtual node" complexity.
The number of replicas per thread scales with network size:
| Network Size | Replica Count | Formula |
|---|---|---|
| 1-3 nodes | 1 | Every node stores everything |
| 4-6 nodes | 2 | ceil(4/3) = 2 through ceil(6/3) = 2 |
| 7-9 nodes | 3 | ceil(N/3) |
| 10+ nodes | ~33% of nodes | ceil(N/3) |
The formula is ceil(nodeCount / 3). Each individual thread is cloned to about one third of the live mesh, while rendezvous hashing spreads ownership across the whole network as item keys change.
When FULL_NODE_CHAT=1 is set, the shard ownership check (isShardOwner) always returns true for the local node. This means:
The node still participates in the shard ring normally from other nodes' perspective. Other nodes do not know (or care) that this node is in full-node mode.
Media cache entries are sharded separately from chat threads. A media entry's shard assignment is determined by its own shard key, independent of the chat thread it may be associated with.
The FULL_NODE_MEDIA=1 environment variable works the same way as FULL_NODE_CHAT -- it overrides shard ownership so the node stores all media cache entries locally.
Each media cache entry has a status that tracks its lifecycle:
| Status | Meaning |
|---|---|
PENDING | Entry created, content not yet fetched or processed |
READY | Content successfully cached and available for serving |
ERROR | Fetch or processing failed (retryable) |
TOO_LARGE | Content exceeded size limits, will not be cached |
MISSING | Source content no longer available at origin |
Media entries are typed by kind:
| Kind | Description |
|---|---|
IMAGE | JPEG, PNG, WebP, GIF, SVG |
VIDEO | MP4, WebM |
AUDIO | MP3, WAV, OGG |
HTML | Embedded HTML content (previews, iframes) |
MODEL | 3D model files (GLB, GLTF) |
FILE | Generic file attachments |
This is critical to understand: PSBT (Partially Signed Bitcoin Transaction) shares are completely independent of the chat and media sharding system.
PSBT shares are distributed using the MPC threshold scheme:
SHA256(nodeId:threadId) or the shard ringFULL_NODE_CHAT and FULL_NODE_MEDIA have NO effect on PSBT share storageConflating PSBT shares with data shards is a common misconception. They are entirely separate systems with different distribution algorithms, different storage backends, and different security properties.