From Organic Design wiki
Cone.png This article or section is a stub. Stubs are articles that have not yet received substantial attention from the authors. They are short or insufficient pieces of information and require additions to further increase the article's usefulness. The project values stubs as useful first steps toward complete articles.

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:


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.


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.


Libp2p has created Testground for testing their protocols. Testground can be scaled from 2 to 10000 nodes.






Peer Discovery



Connection Protector

Connection Timeout

The js libp2p has a connection timeout where it will drop a connection if it doesn't get used in a certain timeframe (< 60s). One way to get around this is to enable PubSub peer discovery and set the interval to a shorter time. It seems there is another way to prevent the connections dropping by tagging that peer:

import { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags'

await peerStore.tagPeer(peerId, KEEP_ALIVE)


Peer Discovery

PubSub peer discovery will broadcast the announce addresses to the topic _peer-discovery._p2p._pubsub every interval ms.