SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
Module:
The modular P2P
networking stack
ResNetLab on Tour
➔ Why libp2p? Decentralized Process Addressing
➔ libp2p: From modules to innovation
➔ libp2p modules
◆ Transports
◆ Multiplexers
◆ Secure Channels
◆ Peer Discovery
◆ Content and Peer Routing
◆ NAT Traversal
◆ PubSub
➔ Pluggable modules
Agenda
Composable building blocks to assemble future-proof p2p networking layers
Runs on many runtimes: browser, mobile, embedded.
Substrate for innovation on new protocols (composable modules)
Implemented in 7+ languages
A modular peer-to-peer networking stack
Decentralized Process Addressing
Why?
● Ability to locate, connect, authenticate, negotiate and interact
efficiently with any process in the world
○ Independent of the runtime
○ In a seamless manner (NAT-traversal, heterogeneous networks,
relays).
○ Fully operational even in a case of mobility, relocation, roam, etc.
○ Every peer is uniquely identified.
● Network- and topology-independent alternative to endpoint addressing
(e.g. IP networks)
Where does libp2p live?
Where?
Data-link Layer
Physical Layer
Transport
Networking
Innovation
● libp2p’s modular protocol stack
fosters innovation through the design
of new protocols and layers.
● It provides all the interfaces required
for fast implementation.
● The substrate for new applications
and protocols.
● Recent example: Compression in
libp2p
From modules to innovation
(and back)
libp2p protocol layers
Security (Noise / TLS)
Transport (TCP / UDP /
QUIC)
Muxer (yamux / multiplex)
Application protocols
https://github.com/adlrocha/go-libp2p-c
ompression-examples
Security (Noise / TLS)
Transport (TCP / UDP /
QUIC)
Muxer (yamux / multiplex)
Application protocols
Compression (gzip)
Decentralized Process Addressing
Peer Identity
● Uniquely identifies peers
● IDs derived from their public key
○ Four key types: RSA, Ed25519, SEC256k1, ECDSA
○ Multihash representation
■ Identity multihash (i.e. no hash) if public key < 48 bytes
■ SHA-256 of multihash if > 48 bytes
Multiaddress
/ip4/1.2.3.4/tcp/5001/p2p/<peer_id>
● Network processes are named as filepaths.
● Specify available processes in a peer in a single address
● Used for dialing peer
Hash code Hash bytes
QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
Transports
● Transports are core abstractions of libp2p
○ Connection factories for communication
between peers (i.e. establish new connections
over specific protocol)
○ Dialing and listening
○ They produce raw connections, socket,
sessions - the “L4” of libp2p
● Current transports:
○ TCP, QUIC, WebSockets, WebRTC
● Connection bootstrapping takes a raw connection, created by a
transport, and “upgrades it” to use a secure channel and multiplexer.
○ The secure channel and multiplexer are negotiated dynamically
to create a capable connection between two peers.
● Some transports don’t need upgrading.
○ QUIC handles multiplexing and encryption itself.
● All of this negotiation is done to bootstrap a connection using a
protocol called multistream-select.
Connection Bootstrapping
Connection
Bootstrapping
If the two peers do not
support the same
protocols, the connection
is terminated.
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
Multiplexing
● Establishing a P2P connection may not be cheap or easy (e.g. hole punching,
negotiation, handshake, etc.)
● Re-use established connections for several protocols.
○ Applications can leverage already established connections.
● Streams are uniquely identified based on its multiplexer specification.
● Several implementations of multiplexers available:
○ Language specific libraries for stream multiplex (Yamux, Mplex)
○ Transport protocol native multiplexing capabilities (QUIC)
Protocol Negotiation
● Multistream-select is the protocol negotiation scheme. Blind
scheme used for connection upgrade.
● We can also identify the protocols other peers are running with:
○ Identify protocol which is run after connection upgrade.
Returns list of supported protocols
○ Multistream list (ls) protocol
>>> /multistream/1.0.0 (1)
<<< /multistream/1.0.0 (2)
>>> /foo/A (3)
<<< na (4)
>>> /foo/B (5)
<<< /foo/B (6)
>>> /ls
● Protocol IDs
○ Analogous to REST endpoints. Serve for routing and handling
○ As simple as mounting handlers for additional protocols
• /floodsub/1.0.0
•/ipfs/bitswap/1.0.0
•/eth2/beacon_chain/req/..
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
Secure Channels
● Peer authentication and transport encryption.
● Transmission integrity. Non repudiation.
Message authentication
○ Does not preclude from
encrypting/signing application data
● Several security protocols supported:
○ Noise: Security framework. Handshake
and negotiate primitives.
○ TLS 1.3
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
Peer Discovery
● Two discovery interfaces:
○ Advertiser to announce services
to other peers
○ Discoverer to find peers
supporting certain services
● Implementations
○ MDNS
○ Kademlia DHT
// Advertiser is an interface for advertising services
type Advertiser interface {
// Advertise advertises a service
Advertise(ns string, opts ...Option) (time.Duration, error)
}
// Discoverer is an interface for peer discovery
type Discoverer interface {
// FindPeers discovers peers providing a service
FindPeers(ns string, opts ...Option) (peer.AddrInfo, error)
}
// Discovery is an interface that combines service advertisement
and peer discovery
type Discovery interface {
Advertiser
Discoverer
}
Content and Peer Routing
● Interfaces to find and advertise
○ Content-addressed chunks of data in a p2p network
○ Peer multiaddrs: libp2p-kad-dht
● This interface could implement other protocols:
○ DNS
○ BitTorrent trackers
○ Any other providing subsystems
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
NAT Traversal
● Goal: Achieve global connectivity in heterogeneous networks.
● AutoNAT
○ Request information from other peers to identify how is my network
observed from the outside.
○ It determines if we’re actually reachable and reports a routability:
PUBLIC, PRIVATE, UNKNOWN.
● AutoRelay
○ If a peer is not reachable from a public network:
■ It tries to discover relay peers automatically
■ It connects to them, and advertises the relays addresses as part
of their own address (so others know how to reach it)
■ From there on other know how to contact me through the relay
○ Doesn’t scale well.
● Hole punching
○ Use relay servers as a conduit for hole punching signalling and
sync.
○ Find close peers to our target to create temporary relayed
connections.
○ Detect NAT type and use hole punching to try to upgrade to direct
connection
NAT Traversal
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
● PubSub is a message-oriented communication pattern.
● M:N interaction model. Asynchronous communication.
● Peers congregate around topics. Some processes publish messages and
others listen to them. Common in enterprise software with decentralized
brokers.
PubSub Interface
PubSub Interface
● Decentralized P2P PubSub.
○ Brokerless, self-regulating, no global knowledge
○ Constructed as overlay networks collaborating for message deliverability
● Several available protocols
○ GossipSub
○ FloodSub
● Use cases: IPNS, content-addressing, blockchain consensus, message
dissemination, etc.
Transports
Multiplexers
Secure Channels
Peer Discovery
Peer Routing
Content Routing
NAT Traversal
Pubsub
● libp2p modules are “plug and play”, they can be easily be added in an
application with a few lines of code.
○ Create libp2p node is simple
■ Supported transports, muxer, security channel
Pluggable modules
● If my application needs additional capabilities like peer discovery, routing, etc. we
don’t have to implement it from scratch:
host, err := libp2p.New(
context.Background(),
libp2p.ListenAddrs(sourceMultiAddr),
libp2p.Identity(prvKey),
)
// Instantiate DHT protocol (analogous for other modules).
newDHT, _ := kaddht.New(host)
host, err := libp2p.New(
context.Background(),
libp2p.ListenAddrs(sourceMultiAddr),
libp2p.Identity(prvKey),
libp2p.Routing(newDHT)
)
Thank you for watching
Reach out in case you have questions or comments!

Más contenido relacionado

La actualidad más candente

netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
Kernel TLV
 
Porting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt projectPorting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt project
Macpaul Lin
 

La actualidad más candente (20)

Linux Initialization Process (1)
Linux Initialization Process (1)Linux Initialization Process (1)
Linux Initialization Process (1)
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
 
eStargzイメージとlazy pullingによる高速なコンテナ起動
eStargzイメージとlazy pullingによる高速なコンテナ起動eStargzイメージとlazy pullingによる高速なコンテナ起動
eStargzイメージとlazy pullingによる高速なコンテナ起動
 
Git
GitGit
Git
 
A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
 
Memory model
Memory modelMemory model
Memory model
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to love
 
仮想化技術によるマルウェア対策とその問題点
仮想化技術によるマルウェア対策とその問題点仮想化技術によるマルウェア対策とその問題点
仮想化技術によるマルウェア対策とその問題点
 
An introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable serviceAn introduction to Jupyter notebooks and the Noteable service
An introduction to Jupyter notebooks and the Noteable service
 
集約署名
集約署名集約署名
集約署名
 
netfilter and iptables
netfilter and iptablesnetfilter and iptables
netfilter and iptables
 
Q2.12: Debugging with GDB
Q2.12: Debugging with GDBQ2.12: Debugging with GDB
Q2.12: Debugging with GDB
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
Goでかんたんソースコードの静的解析
Goでかんたんソースコードの静的解析Goでかんたんソースコードの静的解析
Goでかんたんソースコードの静的解析
 
Porting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt projectPorting a new architecture (NDS32) to open wrt project
Porting a new architecture (NDS32) to open wrt project
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
 
Linux boot process
Linux boot processLinux boot process
Linux boot process
 
データセンターネットワークでのPrometheus活用事例
データセンターネットワークでのPrometheus活用事例データセンターネットワークでのPrometheus活用事例
データセンターネットワークでのPrometheus活用事例
 
Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?
 
Git_GitHub 入門者向けスライド.pdf
Git_GitHub 入門者向けスライド.pdfGit_GitHub 入門者向けスライド.pdf
Git_GitHub 入門者向けスライド.pdf
 

Similar a Module: the modular p2 p networking stack

(Current22) Let's Monitor The Conditions at the Conference
(Current22) Let's Monitor The Conditions at the Conference(Current22) Let's Monitor The Conditions at the Conference
(Current22) Let's Monitor The Conditions at the Conference
Timothy Spann
 
Princeton Dec 2022 Meetup_ NiFi + Flink + Pulsar
Princeton Dec 2022 Meetup_ NiFi + Flink + PulsarPrinceton Dec 2022 Meetup_ NiFi + Flink + Pulsar
Princeton Dec 2022 Meetup_ NiFi + Flink + Pulsar
Timothy Spann
 
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a TeamNYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
Timothy Spann
 

Similar a Module: the modular p2 p networking stack (20)

Encode club introduction_to_libp2p
Encode club introduction_to_libp2pEncode club introduction_to_libp2p
Encode club introduction_to_libp2p
 
Try to implement Blockchain using libp2p
Try to implement Blockchain using libp2pTry to implement Blockchain using libp2p
Try to implement Blockchain using libp2p
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
Module: Content Routing in IPFS
Module: Content Routing in IPFSModule: Content Routing in IPFS
Module: Content Routing in IPFS
 
AMQP with RabbitMQ
AMQP with RabbitMQAMQP with RabbitMQ
AMQP with RabbitMQ
 
Module: Mutable Content in IPFS
Module: Mutable Content in IPFSModule: Mutable Content in IPFS
Module: Mutable Content in IPFS
 
Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017Messaging-as-a-Service Rivieradev 2017
Messaging-as-a-Service Rivieradev 2017
 
Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...
Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...
Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...
 
(Current22) Let's Monitor The Conditions at the Conference
(Current22) Let's Monitor The Conditions at the Conference(Current22) Let's Monitor The Conditions at the Conference
(Current22) Let's Monitor The Conditions at the Conference
 
Princeton Dec 2022 Meetup_ NiFi + Flink + Pulsar
Princeton Dec 2022 Meetup_ NiFi + Flink + PulsarPrinceton Dec 2022 Meetup_ NiFi + Flink + Pulsar
Princeton Dec 2022 Meetup_ NiFi + Flink + Pulsar
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
 
Osacon 2021 hello hydrate! from stream to clickhouse with apache pulsar and...
Osacon 2021   hello hydrate! from stream to clickhouse with apache pulsar and...Osacon 2021   hello hydrate! from stream to clickhouse with apache pulsar and...
Osacon 2021 hello hydrate! from stream to clickhouse with apache pulsar and...
 
WebCamp 2016: Python. Вячеслав Каковский: Real-time мессенджер на Python. Осо...
WebCamp 2016: Python. Вячеслав Каковский: Real-time мессенджер на Python. Осо...WebCamp 2016: Python. Вячеслав Каковский: Real-time мессенджер на Python. Осо...
WebCamp 2016: Python. Вячеслав Каковский: Real-time мессенджер на Python. Осо...
 
WebCamp Ukraine 2016: Instant messenger with Python. Back-end development
WebCamp Ukraine 2016: Instant messenger with Python. Back-end developmentWebCamp Ukraine 2016: Instant messenger with Python. Back-end development
WebCamp Ukraine 2016: Instant messenger with Python. Back-end development
 
Modern Distributed Messaging and RPC
Modern Distributed Messaging and RPCModern Distributed Messaging and RPC
Modern Distributed Messaging and RPC
 
Go at uber
Go at uberGo at uber
Go at uber
 
Building a Messaging Solutions for OVHcloud with Apache Pulsar_Pierre Zemb
Building a Messaging Solutions for OVHcloud with Apache Pulsar_Pierre ZembBuilding a Messaging Solutions for OVHcloud with Apache Pulsar_Pierre Zemb
Building a Messaging Solutions for OVHcloud with Apache Pulsar_Pierre Zemb
 
RPC in Smalltalk
 RPC in Smalltalk RPC in Smalltalk
RPC in Smalltalk
 
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a TeamNYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
 
CN 6131(15) Module IV.pdf
CN 6131(15) Module IV.pdfCN 6131(15) Module IV.pdf
CN 6131(15) Module IV.pdf
 

Más de Ioannis Psaras

Más de Ioannis Psaras (6)

Module: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness BeaconModule: drand - the Distributed Randomness Beacon
Module: drand - the Distributed Randomness Beacon
 
Module: Beyond bitswap
Module: Beyond bitswapModule: Beyond bitswap
Module: Beyond bitswap
 
Module: InterPlanetary Linked Data (IPLD)
Module: InterPlanetary Linked Data (IPLD)Module: InterPlanetary Linked Data (IPLD)
Module: InterPlanetary Linked Data (IPLD)
 
Module: Welcome to Web 3.0
Module: Welcome to Web 3.0Module: Welcome to Web 3.0
Module: Welcome to Web 3.0
 
Module: Content Exchange in IPFS
Module: Content Exchange in IPFSModule: Content Exchange in IPFS
Module: Content Exchange in IPFS
 
Module: Content Addressing in IPFS
Module: Content Addressing in IPFSModule: Content Addressing in IPFS
Module: Content Addressing in IPFS
 

Último

💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
JOHNBEBONYAP1
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Último (20)

All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 

Module: the modular p2 p networking stack

  • 1. Module: The modular P2P networking stack ResNetLab on Tour
  • 2. ➔ Why libp2p? Decentralized Process Addressing ➔ libp2p: From modules to innovation ➔ libp2p modules ◆ Transports ◆ Multiplexers ◆ Secure Channels ◆ Peer Discovery ◆ Content and Peer Routing ◆ NAT Traversal ◆ PubSub ➔ Pluggable modules Agenda
  • 3. Composable building blocks to assemble future-proof p2p networking layers Runs on many runtimes: browser, mobile, embedded. Substrate for innovation on new protocols (composable modules) Implemented in 7+ languages A modular peer-to-peer networking stack
  • 4. Decentralized Process Addressing Why? ● Ability to locate, connect, authenticate, negotiate and interact efficiently with any process in the world ○ Independent of the runtime ○ In a seamless manner (NAT-traversal, heterogeneous networks, relays). ○ Fully operational even in a case of mobility, relocation, roam, etc. ○ Every peer is uniquely identified. ● Network- and topology-independent alternative to endpoint addressing (e.g. IP networks)
  • 5. Where does libp2p live? Where? Data-link Layer Physical Layer Transport
  • 6. Networking Innovation ● libp2p’s modular protocol stack fosters innovation through the design of new protocols and layers. ● It provides all the interfaces required for fast implementation. ● The substrate for new applications and protocols. ● Recent example: Compression in libp2p From modules to innovation (and back) libp2p protocol layers Security (Noise / TLS) Transport (TCP / UDP / QUIC) Muxer (yamux / multiplex) Application protocols https://github.com/adlrocha/go-libp2p-c ompression-examples Security (Noise / TLS) Transport (TCP / UDP / QUIC) Muxer (yamux / multiplex) Application protocols Compression (gzip)
  • 7. Decentralized Process Addressing Peer Identity ● Uniquely identifies peers ● IDs derived from their public key ○ Four key types: RSA, Ed25519, SEC256k1, ECDSA ○ Multihash representation ■ Identity multihash (i.e. no hash) if public key < 48 bytes ■ SHA-256 of multihash if > 48 bytes Multiaddress /ip4/1.2.3.4/tcp/5001/p2p/<peer_id> ● Network processes are named as filepaths. ● Specify available processes in a peer in a single address ● Used for dialing peer Hash code Hash bytes QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM
  • 8. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 9. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 10. Transports ● Transports are core abstractions of libp2p ○ Connection factories for communication between peers (i.e. establish new connections over specific protocol) ○ Dialing and listening ○ They produce raw connections, socket, sessions - the “L4” of libp2p ● Current transports: ○ TCP, QUIC, WebSockets, WebRTC
  • 11. ● Connection bootstrapping takes a raw connection, created by a transport, and “upgrades it” to use a secure channel and multiplexer. ○ The secure channel and multiplexer are negotiated dynamically to create a capable connection between two peers. ● Some transports don’t need upgrading. ○ QUIC handles multiplexing and encryption itself. ● All of this negotiation is done to bootstrap a connection using a protocol called multistream-select. Connection Bootstrapping
  • 12. Connection Bootstrapping If the two peers do not support the same protocols, the connection is terminated.
  • 13. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 14. Multiplexing ● Establishing a P2P connection may not be cheap or easy (e.g. hole punching, negotiation, handshake, etc.) ● Re-use established connections for several protocols. ○ Applications can leverage already established connections. ● Streams are uniquely identified based on its multiplexer specification. ● Several implementations of multiplexers available: ○ Language specific libraries for stream multiplex (Yamux, Mplex) ○ Transport protocol native multiplexing capabilities (QUIC)
  • 15. Protocol Negotiation ● Multistream-select is the protocol negotiation scheme. Blind scheme used for connection upgrade. ● We can also identify the protocols other peers are running with: ○ Identify protocol which is run after connection upgrade. Returns list of supported protocols ○ Multistream list (ls) protocol >>> /multistream/1.0.0 (1) <<< /multistream/1.0.0 (2) >>> /foo/A (3) <<< na (4) >>> /foo/B (5) <<< /foo/B (6) >>> /ls ● Protocol IDs ○ Analogous to REST endpoints. Serve for routing and handling ○ As simple as mounting handlers for additional protocols • /floodsub/1.0.0 •/ipfs/bitswap/1.0.0 •/eth2/beacon_chain/req/..
  • 16. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 17. Secure Channels ● Peer authentication and transport encryption. ● Transmission integrity. Non repudiation. Message authentication ○ Does not preclude from encrypting/signing application data ● Several security protocols supported: ○ Noise: Security framework. Handshake and negotiate primitives. ○ TLS 1.3
  • 18. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 19. Peer Discovery ● Two discovery interfaces: ○ Advertiser to announce services to other peers ○ Discoverer to find peers supporting certain services ● Implementations ○ MDNS ○ Kademlia DHT // Advertiser is an interface for advertising services type Advertiser interface { // Advertise advertises a service Advertise(ns string, opts ...Option) (time.Duration, error) } // Discoverer is an interface for peer discovery type Discoverer interface { // FindPeers discovers peers providing a service FindPeers(ns string, opts ...Option) (peer.AddrInfo, error) } // Discovery is an interface that combines service advertisement and peer discovery type Discovery interface { Advertiser Discoverer }
  • 20. Content and Peer Routing ● Interfaces to find and advertise ○ Content-addressed chunks of data in a p2p network ○ Peer multiaddrs: libp2p-kad-dht ● This interface could implement other protocols: ○ DNS ○ BitTorrent trackers ○ Any other providing subsystems
  • 21. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 22. NAT Traversal ● Goal: Achieve global connectivity in heterogeneous networks. ● AutoNAT ○ Request information from other peers to identify how is my network observed from the outside. ○ It determines if we’re actually reachable and reports a routability: PUBLIC, PRIVATE, UNKNOWN. ● AutoRelay ○ If a peer is not reachable from a public network: ■ It tries to discover relay peers automatically ■ It connects to them, and advertises the relays addresses as part of their own address (so others know how to reach it) ■ From there on other know how to contact me through the relay ○ Doesn’t scale well.
  • 23. ● Hole punching ○ Use relay servers as a conduit for hole punching signalling and sync. ○ Find close peers to our target to create temporary relayed connections. ○ Detect NAT type and use hole punching to try to upgrade to direct connection NAT Traversal
  • 24. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 25. ● PubSub is a message-oriented communication pattern. ● M:N interaction model. Asynchronous communication. ● Peers congregate around topics. Some processes publish messages and others listen to them. Common in enterprise software with decentralized brokers. PubSub Interface
  • 26. PubSub Interface ● Decentralized P2P PubSub. ○ Brokerless, self-regulating, no global knowledge ○ Constructed as overlay networks collaborating for message deliverability ● Several available protocols ○ GossipSub ○ FloodSub ● Use cases: IPNS, content-addressing, blockchain consensus, message dissemination, etc.
  • 27. Transports Multiplexers Secure Channels Peer Discovery Peer Routing Content Routing NAT Traversal Pubsub
  • 28. ● libp2p modules are “plug and play”, they can be easily be added in an application with a few lines of code. ○ Create libp2p node is simple ■ Supported transports, muxer, security channel Pluggable modules ● If my application needs additional capabilities like peer discovery, routing, etc. we don’t have to implement it from scratch: host, err := libp2p.New( context.Background(), libp2p.ListenAddrs(sourceMultiAddr), libp2p.Identity(prvKey), ) // Instantiate DHT protocol (analogous for other modules). newDHT, _ := kaddht.New(host) host, err := libp2p.New( context.Background(), libp2p.ListenAddrs(sourceMultiAddr), libp2p.Identity(prvKey), libp2p.Routing(newDHT) )
  • 29. Thank you for watching Reach out in case you have questions or comments!