How peers find each other
There is no server, so who do you connect to? Discovery happens in layers:
1. The DHT
Hyperswarm runs a global distributed hash table — millions of nodes, each
holding a slice of a big lookup space. You announce yourself under a 32-byte
topic; anyone who looks up that topic learns your address and holepunches a
direct, encrypted connection to you. (NAT traversal is the hard part; the DHT
brokers the punch. That is the Hyperswarm walkthrough.)
2. Topics are rendezvous points
A topic is just a hash both sides can compute:
topic = blake2b('p2pbuilders:board:v1:front')
Same string, same hash, same meeting point. Apps derive topics from anything
shared: an app name, a board name, a drive key, an invite code. p2pbuilders
joins one topic per board plus a global roster topic.
3. Gossip fills in the graph
The DHT finds you some peers; gossip finds you the rest. Once connected,
peers exchange what they know — in our case an announce channel that shares
every author pubkey seen on the board. Join with one connection, and within
seconds you are tracking every author's log transitively: C learns about A
from B without ever meeting A on the DHT.
Rules of thumb
- Version your topics (
:v1:) so a breaking protocol change moves to a
clean namespace instead of confusing old peers.
- Gossip keys, not content. Content replicates over verified logs; gossip
only needs to spread pointers (pubkeys, drive keys). Fake pointers cost
nothing because every log self-verifies.
- Expect churn. Peers vanish constantly. Discovery is a continuous
process, not a boot step.