LibP2P
Private Networks
LibP2P has the concept of private networks that are created by a pre-shared secret key (PSK) which encrypts all traffic leaving the nodes. (This is underneath the standard LibP2P stack so traffic is encrypted twice.) This PSK is also called a swarm key and is also used by IPFS. The swarm key can have the following text format:
/key/swarm/psk/1.0.0/
/base16/
0ff05394c733304ec26b3861ef23a4ffef9cd2e7d2040e028e5e9bb321d2eea3
The first line is the codec of the key, the second line is the format of the key and the last line is the key itself.
- Specification: Private Networks PSK V1
PubSub
LibP2P currently has two implementations of PubSub, a naive FloodSub and a GossipSub. FloodSub just floods the network without doing anymore work to reduce waste where GossipSub as the name suggest uses gossip.
Peer Discovery
LibP2P's PubSub has a special topic for peer discovery this works by each peer publishing their own addresses every so often.




