Is I2P better than Tor?
I2P, short for the Invisible Internet Project, is an anonymous network built on top of the Internet. It provides its users with a secure network infrastructure within which they can freely communicate and share data both privately and anonymously.
I2P first began as a proposed modification to freenet (an old, similar privacy-focused network) in Feb 2003. However, in April of the same year, I2P grew to become a project of its own with the initial name of "anonCommFramework". The project ultimately started being developed in August 2003 with the current name of I2P.
To many's surprise, even though I2P has been in active development since 2003, it's still in beta version. Perhaps the reason for this is because I2P's roadmap is very extensive, with many planned security features regularly being added along the way. Regardless of whether I2P is beta or not, the code now is believed to be reasonably stable and well-developed.
As an interesting aside, most of the people who develop and manage I2P are anonymous. Having said that, it's important to remember that I2P is an open-source project, meaning that any programmer around the world can contribute and view the code. Therefore, the anonymous nature of the developers is not something to worry about. In fact, this has some advantages, such as the lack of a central figure for governments to pressure or harass.
How I2P Works
The I2P network allows end-to-end encryption between users, and with the use of distributed hash tables, it effectively hides and disregards the IP addresses of the computers that make up the network. The network is comprised of nodes, commonly called "routers". If you're familiar with Tor, "routers" in I2P are equivalent to "nodes" in Tor. These routers are simply personal computers with the I2P router software installed and run on them voluntarily by their owners.
Each router is identified by a cryptographic 'RouterIdentity'. Client applications also have cryptographic identifiers, which enables them to send and receive messages anonymously.
An analogy would help greatly in understanding how traffic routing takes place on the I2P network: Imagine a neighborhood where each house has a set of two mailboxes; One for sending letters (outbound tunnel) and one for receiving letters (inbound tunnel). Also imagine that each mailbox has two postmen (routers) hired specifically for that mailbox. When Bob wishes to send a letter to Alice, he would first query the post office (distributed hash table) for information about Alice's receiving mailbox (inbound tunnel) and its associated postmen. After acquiring the needed info, Bob would then place his letter in three envelopes, one inside another (encryption layers). Subsequently, Bob would place his letter inside his sending mailbox (outbound tunnel).
Afterwards, the first postman of the two that were hired for Bob's mailbox would take the envelopes from Bob's mailbox and rip off (decryption) the outer envelope, and in doing so, he discovers the name of the next postman (router) to which he should hand the rest of the envelopes. The second postman then takes the envelopes from the first one and rips off the now top layer. Up to this point, we've been in Bob's side of the communication.
What comes next is Alice's side of the communication; specifically, her receiving mailbox (inbound tunnel) with its two associated postmen (routers). Bob's second postman, based on the name he discovered after ripping off his pertaining envelope, hands the envelope to Alice's first postman. Alice's first postman then wraps a new envelope (encryption) around the old one and then hands it to Alice's second postman. The second postman then does exactly the same and places the envelopes inside Alice's receiving mailbox. Finally, Alice picks up the envelopes, rips all layers off (decryption), and sees Bob's original letter.
In our analogy, the receiving and sending mailboxes are inbound tunnels and outbound tunnels, respectively. A tunnel is a set of routers chosen by a user's client to relay packets; the postmen in our analogy represented the routers that make up a tunnel. Upon connecting to the I2P network, every client would choose a set of routers to serve as its inbound tunnel and another set of routers to serve as its outbound tunnel. The number of routers allocated for a single tunnel is optional and depends on the user's preference between anonymity and latency. Furthermore, a client could set multiple inbound tunnels and multiple outbound tunnels.
After the client sets its tunnels, it updates the distributed hash table with this info so that other clients wishing to communicate could look up contacting info. In the entire process of the transmission, each router only knew about the existence of the immediate preceding and following routers. The message has been encrypted all the time, with encryption layers being ripped off and added along the way by the routers.
I2P vs Tor
If you happen to be already familiar with Tor you will notice that I2P is very similar. In fact, a debate that is brought up often revolves around which of the two is better? The answer to this question is not simple, as each of the two has its own distinct features and characteristics. Comparing the two is like comparing an apple to an orange.
I2P aims to create its own internal network inside the Internet. That is, it aims to make all communication happen inside the I2P network without leaving to the clearnet. Tor, on the other hand, is mainly intended to allow people to reach the regular internet (clearnet) anonymously. Although Tor does allow hidden services that are hosted inside the network, that's I2P's main purpose.
Aside from the difference in how the two networks are intended to function, the two differ in many other aspects. First, When a client connects to the Tor network it allocates a single tunnel of nodes to serve both incoming and outgoing traffic. I2P, on the other hand, allocates at least two separate tunnels, one for incoming traffic and one for outgoing traffic. This makes traffic monitoring extremely hard for third parties. Second, when a client uses the I2P network to communicate, it may be simultaneously serving as a router for someone else's inbound or outbound tunnel. Therefore, third party monitors will not be able to discern whether a client is communicating with another or simply just passing on someone else's packets. Third, unlike Tor, which uses a centralized directory to manage the network database, I2P uses a fully distributed hash table.
While it may seem here that I2P surpasses Tor, it's not necessarily true. There are different circumstances in which one of the two might outperform the other and attempts to compare the two in absolute terms would be futile.