Jay Taylor's notes

back to listing index

Python p2p libraries and frameworks

[web search]
Original source (blog.rfox.eu)
Tags: python library framework p2p blog.rfox.eu
Clipped on: 2021-01-22

Bystroushaak's blog / English section / Explorations / Python p2p libraries and frameworks

Python p2p libraries and frameworks

@2020/04/05

I've explored the scene of the Python libraries and frameworks for peer to peer networking.

tldr; Its not that great.

Note: asyncio-only code is considered disadvantageous. See What Color is Your Function? for explanation why. Basically it is a cancer that spreads through your whole program until everything is asyncio, and I like multiprocessing based on messages much more.

PyP2P

https://github.com/StorjOld/pyp2p

PyP2P is a simplified networking library for building peer-to-peer networks in Python. The library is designed to solve the pain of finding nodes and bypassing NATs so you can focus on writing your application code.

  • Automated port forwarding with UPnP and NATPMP
  • Support for TCP hole punching / simultaneous open
  • Reverse connect (tell a node to connect to you)
  • Fail-safe proxying (planned feature)
  • Python 2 (tested on 2.7 - experimental) & 3 (tested on 3.3)
  • Linux and Windows - yep

Somehow related to Storj.

Cons

Requires rendezvous server.

Last commit 2016

No documentation, some examples.

py-libp2p

https://github.com/libp2p/py-libp2p

Peer-to-peer networking stack (used by IPFS and others).

The one-liner pitch is that libp2p is a modular system of protocols, specifications, and libraries that enable the development of peer-to-peer network applications.

Pros

Last commit 2020.

Backed by ethereum grant.

Implementation of https://libp2p.io/, multiple languages supported.

Has some theory & capable people behind it. Looks mature enough.

Cons

Asyncio.

Not much documentation.

Some weird addressing stuff /ip4/127.0.0.1/tcp/8000/p2p/QmQn4SwGkDZKkUEpBRBvTmheQycxAHJUNmVEnjA2v1qe8Q

py-ipv8

https://github.com/tribler/py-ipv8/

What is IPv8 ?

IPv8 aims to provide authenticated communication with privacy. The design principle is to enable communication between public key pairs: IP addresses and physical network attachment points are abstracted away. This Python 2/3 package is an amalgamation of peer-to-peer communication functionality from Dispersy and Tribler, developed over the last 13 years by students and employees of the Delft University of Technology. The IPv8 library allows you to easily create network overlays on which to build your own applications.

IPv8 Objectives

  • Authentication. We offer mutual authentication using strong cryptography. During an IPv8 communication session, both parties can be sure of the other party’s identity. IPv8 users are identified by their public key. The initial key exchange is designed so that secrets are never transmitted across the Internet, not even in encrypted form. We use a standard challenge/response protocol with protection against spoofing, man-in-the-middle, and replay attacks.
  • Privacy. IPv8 is specifically designed for strong privacy protection and end-to-end encryption with perfect forward secrecy. We enhanced the industry standard onion routing protocol, Tor, for usage in a trustless environment (e.g. no trusted central directory servers).
  • No infrastructure dependency. Everybody is equal in the world of IPv8. No central web server, discovery server, or support foundation is needed.
  • Universal connectivity. IPv8 can establish direct communication in difficult network situations. This includes connecting people behind a NAT or firewall. IPv8 includes a single simple and effective NAT traversal technique: UDP hole-punching. This is essential when offering privacy without infrastructure and consumer-grade donated resources.
  • Trust. You can enhance your security if you tell IPv8 which people you know and trust. It tries to build a web-of-trust automatically.

Pros

Last commit 2020

Looks like it solves many problems.

Cons

Asyncio.

p2p-python

https://github.com/namuyan/p2p-python

I seek a library that can make a simple P2P network. This library enables you create P2P application.

Specification

  • Asynchronous IO
  • Pure Python code
  • TCP and UDP connection
  • Automatic network build
  • Python 3.6+

Pros

Last commit 2020.

Pure python code.

Cons

Asyncio based

"simple" in the description.

Not much documentation, some examples.

Looks weird and amateurish.

Zyre

https://github.com/zeromq/zyre

Zyre provides reliable group messaging over local area networks.

Pros

Last commit 2020.

Bindings for various languages.

Cons

Requires bunch of C libraries.

Looks like it is meant for the LAN networks.

devp2p / ethereum

https://github.com/ethereum/devp2p

https://github.com/ethereum/trinity

Client for the ethereum network.

Doesn't seem to be easily use-able for standalone projects.

pydevp2p

https://github.com/ethereum/pydevp2p

Old library for lowlevel ethereum p2p.

pydevp2p is the Python implementation of the RLPx network layer. RLPx provides a general-purpose transport and interface for applications to communicate via a p2p network. The first version is geared towards building a robust transport, well-formed network, and software interface in order to provide infrastructure which meets the requirements of distributed or decentralized applications such as Ethereum. Encryption is employed to provide better privacy and integrity than would be provided by a cleartext implementation.

Cons

Last commit 2018.

Tandem

https://github.com/typeintandem/tandem

Tandem is a decentralized, collaborative text-editing solution. Tandem works with native text editors, works across different editors, and uses peer-to-peer connections to facilitate communication.

Tandem exists as a set of plugins for native text editors. We currently support Sublime Text 3 and Neovim. We also unofficially support Vim.

Collaborating is as easy as installing the plugin on your editor and creating a Tandem Session. Invite other people to your session, and get typing in tandem!

Cons

Requires rendezvous server

Meant as plugin for text editors, would probably require significant amount of work.

Dispersy

https://github.com/Tribler/dispersy

The elastic database system. A database designed for P2P-like scenarios, where potentially millions of computers send database updates around.

The Distributed Permission System, or Dispersy, is a platform to simplify the design of distributed communities. At the heart of Dispersy lies a simple identity and message handling system where each community and each user is uniquely and securely identified using elliptic curve cryptography.

Cons

No longer maintaned.

Banyan

https://github.com/OpenWeavers/banyan

Banyan is a simple peer to peer application protocol for File Sharing over LAN.

The workflow is organized as follows

  1. Initialization - Peer Starts up with a friendly name, which is visible on local network
  1. Peer Discovery - Peer Sends a broadcast to all other hosts in local network. Other peers will respond to it.
  1. Synchronization - Peer Receives file list from all other Peers
  1. Transfer - Peer can receive file from any other Peer

Cons

LAN only.

Last commit 2019.

Not really mature, no longer developed.

Peerstack

https://github.com/e9k/peerstack

Python Peer-to-Peer Framework.

Cons

Amateurish stuff (3 commits), no longer developed (last commit 2017).