tags : Distributed Systems, Networking, NAT, File Sharing, Alternative Internet
Basics
What are P2P networks?
- I am not sure of the theoretical definitions but out in the wild, the main thing to understand is that this can happen at different levels(L3/Network, L7/Application), sometimes together!
- Different ppl can mean different things when they say P2P.
- P2P networks generally implement some kind of overlay network(L7) on top of the physical network topology. Eg. The Internet was originally built as an overlay upon the telephone network, while today (through the advent of VoIP), the telephone network is increasingly turning into an overlay network built on top of the Internet.
- Identity is usually cryptographically managed at some level in P2P systems.
Discovery of peers
As mentioned above this P2P networks can exist at different levels so the discovery mechanisms can also be implemented at different levels.
Examples
- DHT. See Bittorrent
- Broadcast search (gnutella)
- SuperNodes (Nodes that collect info about other nodes)
- Search Filter
- Minigroups
- Social graph
- out-of-band sharing
- More and your imagination
DHT
- How Distributed Hash Table in IPFS and Bittorrent prevent abuse?
- Theseus DHT Protocol | Lobsters
- Theseus DHT Protocol (2018) | Hacker News
- Usually we have to know the address of the DHT by some means. Usually that’s centralized but you could technically use something like
zmap
/massscan
and end up discovering DHTs.
-
Implementing security for a DHT
- Usually you’d want to implement DHT on top of stateless protocol. It needs to be cheap to operate. Having state means you’re more prone to resource exhaustion attacks.
- You can restrict DHTs to accept well-formed requests and further restrict them using a web of trust.
Gossip Protocol
- See </ox-hugo/epidemic-broadcast-trees.pdf> (Epidemic Broadcast Trees)
- https://highscalability.com/gossip-protocol-explained/
- https://www.bartoszsypytkowski.com/hyparview/
- https://www.bartoszsypytkowski.com/make-your-cluster-swim/
- https://systemdesign.one/gossip-protocol/
- https://github.com/hashicorp/memberlist
Example of some P2P software
SSB
- It is a P2P protocol but does not use DHT or NAT traversal.
- It uses no-trust “pubs”/relays which enable gossip and uses cryptography for its operations.
- It does it things
- LAN: multicast UDP
- Internet: In some overlay fashion
- There are dumb relays and there are relays which store user data etc. but all of this is implementation details.
- Every node has a partial view of the network, which makes it hard to get a count of how many total users there are.
- SSB technical summary
- Secure Scuttlebutt is a cool idea whose realization has fatal flaws ⁑ Derctuo
Bittorrent
See Bittorrent
Software using NAT
See NAT
Willow
- Willow Specifications - Comparison to Other Protocols (see nostr vs willow)
- Willow Specifications - Willow Sideloading Protocol
Nostr
See nostr