Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to build a decentralized, reddit-like system using P2P. What existing p2p library should I base it on?

I want to build a decentralized, reddit-like system using P2P. Basically, I want to retain the basic capabilities of reddit, but make it decentralized, to make it more robust and immune to censorship. This will also allow people to develop different clients to match the way they want to browse it.

Could you recommend good p2p libraries to base my work on? They should be open-source, cross-platform, robust and easy to use. I don't care much about the language, I can adapt.

like image 687
static_rtti Avatar asked Apr 10 '11 14:04

static_rtti


3 Answers

Disclaimer: warning, self-promotion here !!!

Have you considered JXTA's latest release? It is probably sufficient for what you want to do. Else, we are working on a new P2P framework called Chaupal, but it is not operational yet.

EDIT

There is also what I call the quick-and-dirty UDP solution (which is not so dirty after all, I should call it minimal).

  1. Just implement one server with a public address and start listening for UPD.
  2. Peers located behind NATs contact the server which can read how their private IP address has been translated into a public IP address from the received datagrams.
  3. You send that information back to the peer who can forward it to other peers. The server can also help exchanging this information between peers.
  4. Then peers can communicate directly (one-to-one) by sending datagrams to these translated addresses.

Simple, easy to implement, but does not cover for lost datagrams, replays, out-of-order etc... (i.e., the typical stuff that TCP solves for you at the IP stack level).

like image 79
Jérôme Verstrynge Avatar answered Oct 18 '22 17:10

Jérôme Verstrynge


Check out CouchDB. It's a decentralized web app platform that uses an HTTP API. People have used it to create "CouchApps" which are decentralized CouchDB-based applications that can spread in a viral nature to other CouchDB servers. All you need to know to write CouchApps is Javascript and learn the CouchDB API. You can read this free online book to learn more: http://guide.couchdb.org

The secret sauce to CouchDB is a Master-to-Master replication protocol that lets information spread like a virus. When I attended the first CouchConf, they demonstrated how efficient this is by throwing a "Couch Party" (which is where you have a room full of people replicating to the person next to them simulating an ad hoc network).

Also, all the code that makes a CouchApp work is public by default in special entities known as Design Documents.

P.S. I've been thinking of doing a similar project, but I don't have a lot of time to devote to it at the moment. GOD SPEED MY BOY!

like image 27
pokstad Avatar answered Oct 18 '22 16:10

pokstad


I haven't had a chance to use it, but Telehash seems to have been made for this kind of application. Peer2Peer apps have a particular challenge dealing with the restrictions of firewalls... since Telehash is based on UDP, it's well suited for hole-punching through firewalls.

EDIT for static_rtti's comment:

If code velocity is a requirement libjingle has a lot of effort going into it, but is primarily geared towards XMPP. You can port off parts of the ICE code and at least get hole-punching. See the libjingle architecture overview for details about their implementation.

like image 44
Mike Pennington Avatar answered Oct 18 '22 15:10

Mike Pennington