Introduction to libp2p

Building large scale peer-to-peer systems has presented many complex difficulties, and libp2p is a way to fix that. The libp2p projects makes it possible for a peer-to-peer applications to operate in an interface that supports many Internet protocols, with secure identities, peer routing, and content discovery.

The libp2p Roadmap

Our long term roadmap

This is the stuff that moves libp2p from “a networking toolbox to build P2P applications” to the thing that fundamentally reshapes the architecture of the Internet; our dreams and aspirations, the North star we should always keep in sight; this is what motivates us and it’s speaks intimately to our mission statement; the libp2p analogy of IPFS working on Mars.

Node data dashboard

Introduction to libp2p | David Dias

Why libp2p?

Read more about why libp2p in this blog by Pierre Kreiger on parity.io

libp2p is a network framework that allows you to write decentralized peer-to-peer applications. Originally the networking protocol of IPFS, it has since been extracted to become its own first-class project.

Objectives

All distributed peer-to-peer networks have a set of challenges that are distinct from traditional networks. libp2p is a generalized toolkit so that developers can use plug-and-play networking with their distributed application.

A fundamental shift in distributed computing is that the “client/server” paradigm no longer holds up. Let’s take a look at what your home router does.

Every device in your home network has a private IP address. When you request data from a server, your router replaces your device’s private address with your home’s public IP address, and remembers which device to send the response to.

That works fine if all your devices are clients, but what about when a request from the outside world shows up at your router? It’s not a response to a request, it is a request, so the requestor thinks that you are a server. One of your devices is acting as a server, but your router doesn’t know which one. This is a problem called NAT traversal, and libp2p provides tools to help handle it.

libp2p also handles peer discovery and handshake protocols. In a world where clients act as servers too, there will inevitably be a variety of hardware, operating systems, and communication protocols between nodes. Encryption and security underpin Web3 design, and libp2p supports both unencrypted (e.g. TCP, UDP) and encrypted protocols (e.g. TLS, Noise) out of the box.

Intro to libp2p | Encode Filecoin Club - Max Inden

In this talk by Max Inden, learn about the purpose of libp2p, which networking protocols it supports, and some of the interesting projects being built with it.

Tutorials

For those who are newer to the world of Filecoin, Web3, and storage verification, check out the Protoschool tutorials. Tutorials you should complete include:

Publish Subscribe (Pubsub) with IPFS & libp2p

In this tutorial video, you will see how you can use the publish-subscribe functionality (using the libp2p Gossipsub routing algorithm) with an IPFS node. Follow along to start an IPFS node with pubsub enabled, and send and recieve messages.

Resources:

IPFS | Docs | GitHub - IPLD | Docs | GitHub - libp2p | Docs | GitHub - Filecoin | Docs | GitHub