Friday, July 29, 2011

Bit Chat: A Peer-to-Peer Instant Messaging Concept Using BitTorrent Trackers

UPDATE: 5 Jan, 2015
Technitium Bit Chat (alpha version) is now available for download at https://bitchat.im

Bit Chat is a concept that I got while thinking about having a instant messaging (IM) system which would be completely decentralized, peer-to-peer and friend-to-friend and would provide confidentiality and optionally authentication. In this regards, BitChat can be considered a darknet system. BitChat takes many of the BitTorrent concepts and uses them to provide an instant messaging (IM) system instead of file sharing.

The classic problem faced in peer-to-peer system is to find IP address of peers who want to communicate together privately in a group. BitChat concept finds solution for it by using existing BitTorrent trackers and forming a peer-to-peer network by connecting to the nodes which are being tracked by the same infohash. DHT can also be used with trackers.

The current concept allows to use channels (similar to IRC channels) over which peers can communicate. Each channel has its own unique infohash. The topology currently thought is a full mesh network between small number of peers.

Each peer starts with a .chat file (just like a .torrent file) which contains infohash and tracker list. The file can be exchanged by email or any other way (even offline). BitChat client would use this file and get an IP address list of all the peers from the trackers mentioned in the file.

For providing privacy, BitChat would fake user agent info of popular BitTorrent clients so that even tracker servers dont know the intentions of the users. The client then maintains a peer list and connects to each of them in a full mesh.

Every connection to another peer is done with a brief handshake in which each peer exchange their identifiers, public keys and a list of peers that each one of them have (similar to peer exchange). Any new peer found from another peer is immediately connected in order to have a full mesh network. Each connection to a peer can be using TCP if directly feasible or UDP in case of client being behind NAT. UDP would punch holes in NAT allowing direct communication between peers possible. The client will have to implement a TCP like retransmission mechanism to solve problems with dropped UDP packets.

A client behind a http proxy can be supported such that it creates outbound connections to rest of the peers. Two peers behind http proxy will not have a direct link in such case and messages between them will have to be routed through other willing peers.

Authentication can be done with the help of public key cryptographic algorithms like RSA. The public key of peers can be exchanged online/offline and a small address book be maintained by BitChat clients to identify friends. The public key exchanged during peer-to-peer handshake will be matched with the address book to verify identity of known contacts.

A channel can be open ended or invite only. If the channel is only for closed group, the BitChat client can reject peer request from unknown contacts. In any case, only users who have the .chat file (or the infohash) can join the network in first place.

Confidentiality can be achieved by using public key cryptography. The public key of each peer will be used to do a key exchange for an agreed upon symmetric key algorithm. Each connection to a peer will have a separate key and it can be renewed with a handshake at regular intervals.

The system would allow for a common chat for all peers in a channel as well as private one-to-one chat. A group chat with only selected peers can be made with the group chat initiator deciding on whom to invite from the peers.

A simple client would implement text chat with a simple one-to-one file sharing. While, clients which can support voice and video chat can be developed.

Security issues which affect BitTorrent also apply to BitChat. The IP address of all peers is open to anyone knowing the infohash being used. Mitigation can be done by use of VPN or proxy services.

There are lot of peer-to-peer projects already being developed and used. BitChat concept is about using an existing infrastructure provided by BitTorrent and using it for a secure, private and user friendly instant messaging system.

A prototype or a working proof of concept client in .NET is being developed by Pratik Patil. The final client too will be made in .NET using .NET Framework 2.0 such that it would run on Mono Framework which supports Linux as well as MAC.

The protocol specification is under development and will be made public so that anyone can make their own BitChat client. Any inputs and queries are most welcomed. Post comments or send an email to me (shreyas at technitium dot com) or Pratik (pratik at technitium dot com).

16 comments:

  1. Any progress here?

    ReplyDelete
  2. The Proof-Of-Concept was made and the concept is practical and amazing.
    Now the prototype is being worked on, which will have basic text chat and file transfer features.
    The prototype will be released in few days.
    Just keep watching this blog.

    ReplyDelete
  3. This is a great concept! Has the prototype been released yet?

    ReplyDelete
    Replies
    1. Ya the concept is quite nice. But, unfortunately, the time is not permitting quick release. Its being worked on, especially the protocol part is taking time to finalize. I hope it gets done as early as possible.

      Delete
  4. Great..... great concept.... Wanna use if getting completed soon... what abt AV no updates bro.

    ReplyDelete
    Replies
    1. Thanks. I hope the beta version will be completed soon and released. Dont know about the AV project, not getting time to code yaar.

      Delete
  5. What's the status on this? I'm thinking it could be useful in places like Turkey.

    ReplyDelete
    Replies
    1. It could be useful in many places indeed. The software is not currently in a state to be released. It requires crypto implementation to secure the communication channels. I hope all things will sort out soon.

      Delete
  6. Hi there,

    sounds really cool what you are trying to achieve. Will you eventually think of opening that to the public, e.g. publish some of the ideas in a document, few graphs, eventually specs so this can be worked out by other people too?

    thanks

    ReplyDelete
    Replies
    1. thanks. a better design has been made now which would be more efficient than the one described in the post. more info on it will be posted in coming months.

      Delete
    2. Hi,
      it gets more and more interesting indeed. As I'm looking into such stuff around, e.g. new ways of messaging around my researches, would you be able to at least share some parts of what is being done, whatever it is would be really helpful around?

      Thanks

      Delete
    3. Hi Tchomir,

      The new design is in progress now with major parts completed and tested. The above description of BitChat has one major change that entire communication will be UDP based.

      A mobile app is also in planing and having used UDP, it would enable to have an always available system like most mobile messaging systems have (like Google hangout).

      The major benefit of the service is privacy with strong cryptography. And this is the main selling point for the messaging system.

      I will share more details as the software gets ready.

      Delete
  7. BitChat (alpha version) is available to download at http://bitchat.im

    ReplyDelete
  8. thank you tmac has helped me eliminate my internet bill for 6 months!

    ReplyDelete