Tech and Media Labs
This site uses cookies to improve the user experience.




Booting and Joining a P2P Network

Jakob Jenkov
Last update: 2014-05-23

Until now I haven't talked much about how the peers in the network maintain their routing tables, and how the the peers in the network are wired together. In this text I will show how a P2P network boots.

The network starts with a single peer. I will call this the boot peer. The same peer does not have to be the boot peer always, but when the P2P network boots for the first time, some peer must be the boot peer.

When the boot peer is running, joining peers can join the network, so the peers can get connected. This process is called "booting" the network. The boot process consists of a lot of joining peers which join the network via the boot peer. Here is the join process:

  1. Joining peer sends a "join" request to the boot peer, and gets a GUID back.
  2. Joining peer sends a "copy routing table" to the boot peer.
  3. Joining peer finds the correct peers it should have in its own routing table.

The Join Request

The first peer to join the network apart from the boot peer, will connect to the boot peer and send a "join" message. The boot peer responds with a new GUID to the joining peer. This is illustrated here:

A peer contacting the boot peer to join the network.
A peer contacting the boot peer to join the network.

The Copy Routing Table Request

After getting a GUID, the joining peer requests to get a copy of the boot peers routing table. This is illustrated here:

A joining peer requesting a copy of a routing table.
A joining peer requesting a copy of a routing table.

Finding the correct Peers for the Routing Table

After having received a copy of the boot peers routing table, the joining peer uses this routing table to find the peers it should really have in its routing table.

Remember, a peer should keep other peers in its routing table which are closest to certain GUID distances (20, 21, 22 etc.) from its own GUID. The routing table received from the boot peer will thus be correct for the boot peer's GUID, but not for the joining peer.

The find process for updating the routing table is illustrated here:

A joining peer finding the correct peers to keep in its routing table.
A joining peer finding the correct peers to keep in its routing table.

If the joining peer is the first peer in the network after the boot peer, the routing table it receives from the boot peer will only containt the joining peers GUID. Thus, the "find" process is skipped, because there are no other peers to contact, except itself and the boot peer.

Jakob Jenkov




Copyright  Jenkov Aps
Close TOC