Peers in the Wild (Part 1)

The complexities of peer-to-peer communication in the real world

Paul Freeman
5 min readJun 30, 2020

For the past year or so, my amazing team at Sylo has been developing the next iteration of the Sylo Network. I’m really excited about the technologies we have been using in this area, as they allow us to create some amazing experiences for our users.

One of the core decentralisation technologies under the hood of this new network is peer-to-peer communication. I’m often asked if all communication on the Sylo Network is peer-to-peer. The answer to this question is both complicated and interesting, so I thought I’d try to explain it in detail, once and for all.

The (Short) History of Peer-to-Peer

Peer-to-peer technology gained popularity at the turn of the century as residential internet speeds became fast enough to share multimedia files.
This opposed the more common client/server model because there was no centralised location storing all the data — peers must work together to provide whatever is requested by other peers.

Peer-to-peer is often misunderstood to imply that messages go directly from one peer to another, with no infrastructure in the middle. The truth is that messages are still handled by many routers and switches along the path to a peer, and encryption is still vital to secure communication. So, peer-to-peer is more of a philosophical term for working together to share the files we need to avoid storing it all in one central place.

Is the Sylo Network a P2P Network?

Yes!

The Sylo Network is built on top of the peer-to-peer technology in the libp2p networking stack. For each message sent, the peer that should receive the message is dialed directly. The message is sent over an encrypted connection so that only they can read it.

Does this mean that when I message my friend on Sylo, the message is sent directly to them?

Well, it’s complicated…

The (Short) Definition of Network Address Translation

A network address is essentially your device’s internal phone number for the Internet. If a device wants to dial you, it needs to know your network address.

Network Address Translation, usually just NAT, is a technology that manipulates these network addresses. It has a variety of legitimate uses, but can complicate peer-to-peer communication.

Most devices connected to the Internet are part of a smaller local network (like the network created by the router in your home). Many of these networks use NAT technology.

NAT technology basically says, ‘Why don’t you leave the message with me and I’ll make sure they get it.’ Some NATs can be convinced to let you give messages directly to a device, but with many this isn’t possible.

Service Peers support the P2P Sylo Network

Many Sylo devices operate from a mobile network and it is simply a fact that mobile networks almost always use NATs. When I’m on my mobile network and my friend is on their mobile network, it is likely impossible that we will establish a peer-to-peer connection by any means.

The Sylo Network provides peer-to-peer service to NAT’d users by using a decentralised network of Service Peers.

Service Peers are peers on the network that are willing and able to provide additional service to improve the experiences of their peers. Currently, one of the most important services provided by Service Peers is the establishment of peer-to-peer circuits between peers on mobile networks.

A peer-to-peer circuit is formed when peers who do not have NAT restrictions agree to relay messages for peers who otherwise could not communicate.
And just like the routers and hardware in regular peer-to-peer connections, Service Peers cannot read the information sent over a peer-to-peer circuit.

P2P, or not P2P, that is the question

Given all the technological hoop-jumping, can we nail down specific situations where users will communicate directly versus through a P2P relay?

Mobile networks are basically a no-go (for now). We can attempt to get a network address, but it is pretty unlikely to succeed. Increased adoption of decentralised technology will drive technological advances in this area, so supporting apps like the Sylo Smart Wallet is a great way anyone can help out.

Connect a device to WiFi and suddenly making those direct peer-to-peer connections becomes a lot easier, but there are still caveats.

The biggest challenge is that network addresses are usually assigned automatically. They aren’t made readily available to applications or users. Service Peers can help here as well! When a Service Peer gets a connection from a device, the device is informed of its current network address, if one is available.

This means that connecting to a Service Peer from a wireless network can be enough to learn your network address, which can then be used to make direct communication with your peers.

Cutting out the Service Peer completely is also possible! By using technology like MDNS or Bluetooth, local peers can be discovered who can then reply with your network address. Savvy users could also input their network address directly into apps for immediate access to the Sylo Network without a Service Peer or relays.

The development team at Sylo is looking into all these technologies (and maybe even a few other) in our ongoing efforts to lead the development of decentralised peer-to-peer networks.

Embracing the Spirit of Peer-to-Peer

The Sylo Network is designed to embrace the latest peer-to-peer technologies that exist while overcoming the peer-to-peer challenges we still face.
Our development uses a “P2P first” approach, meaning direct connections are always the first choice for sending messages.

As development continues, we will always make if possible for all Sylo Protocol services to be provided by as many peers as possible — and no service should be provided exclusively by a single centralised authority.

The Sylo Network is a network built by peers and for peers, in the true spirit of peer-to-peer technologies.

Keen to try decentralised?

Download the Sylo Smart Wallet from the Google Play or Apple App stores

--

--

Paul Freeman

Bread baker for Sylo. Occasionally I write some code.