Freenet
The Freenet file sharing network stores documents and allows them to be retrieved later by an associated key, as is now possible with protocols such as HTTP. The network is designed to be highly survivable, with all internal processes completely anonymized and decentralized across the network. The system has no central servers and is not subject to the control of any one individual or organization. Even the designers of Freenet do not have any control over the overall system. The stored information is encrypted and replicated across participating computers around the world, which are anonymized and intended to be many and continuously-changing. It is theoretically difficult for anyone to find out which participants are hosting a given file, since the contents of each file are encrypted, and may be broken into pieces that are distributed over many different computers. Even for a participant, effort is required to learn what he/she is storing.
The network consists of a number of nodes that pass messages among themselves. Typically, a host computer on the network runs the software that acts as a node, and it connects to other hosts running that same software to form a large distributed network of peer nodes. Some nodes are end user nodes, from which documents are requested and presented to human users. Other nodes serve only to route data. All nodes communicate with each other identically — there are no dedicated "clients" or "servers". It is not possible for a node to rate another node except by its capacity to insert and fetch data associated with a key. This is unlike most other P2P networks where node administrators can employ a ratio system, where users have to share a certain amount of content before they can download.
Freenet can also be viewed as a small world network.
The Freenet protocol is intended to be used on a network of complex topology, such as the Internet (Internet Protocol). Each node knows only about some number of other nodes that it can reach directly (its conceptual "neighbors"), but any node can be a neighbor to any other; no hierarchy or other structure is intended. Each message is routed through the network by passing from neighbor to neighbor until it reaches its destination. As each node passes a message to a neighbor, it does not know or care whether the neighbor will forward the message to another node, or is the final destination or original source of the message. This is intended to protect the anonymity of users and publishers.
Each node maintains a data store containing documents associated with keys, and a routing table associating nodes with records of their performance in retrieving different keys.
The Freenet protocol uses a key based routing protocol. The algorithm is similar to that of distributed hash tables (DHTs), although the idea emerged independently. The main differences are that Freenet nodes do not have fixed specialisations, and the routing algorithm is heuristic. Therefore, it does not guarantee that it will find a given piece of data.
To find a document in the network given a key, a user sends a message to a node (probably one running on the same machine as the client program) requesting the document, providing it with the key. If the document is not found in the local data store, the node finds the node in its routing table that it thinks will be able to locate the key most quickly, and forwards the request to that node, remembering that it has done so. This is a change from the behavior of earlier versions of Freenet nodes: it represents the "Next Generation Routing" (NGR) protocol. The old behavior was to remember which keys were retrieved from what nodes, and to route based on which node gave the key closest to the one being looked for. The effect is largely the same, but NGR has better overall performance.
The node to which the request was forwarded repeats the process until either the key is found or the request passes through a set maximum of nodes, known as the "Hops To Live" value. If a node is visited more than once, it realizes it has already forwarded the request, and sends a message to the node that sent the second request telling it to send to its next-best neighbour. This avoids sending messages in loops.
Eventually, either the document is found or the hop limit is exceeded. The terminal node sends a reply that makes its way back to the originator along the route specified by the intermediate nodes' records of pending requests. The intermediate nodes may choose to cache the document along the way. Besides saving bandwidth, this also makes documents harder to censor as there is no one "source node."
Freenet does not employ broadcast searches as used by Gnutella and other similar file sharing protocols.
Essentially, the same path-finding process is used to insert a document into the network. A request for the document is made, and if it fails, the document is sent along the same path as the request. This ensures that documents are inserted into the network in the same place as requests will look for it. If the initial request succeeds, then the data already existed, and the insert "collides."
See also:
Anonymous P2P