Download presentation
Presentation is loading. Please wait.
1
@chrispacia - Lead backend dev OpenBazaar
How to Leverage Libp2p for blockchain applications @chrispacia - Lead backend dev OpenBazaar
2
What
3
Common Needs Identity Peer discovery Routing
Wire encryption/authentication Multi-transport Nat traversal Stream/protocol multiplexing Relaying Common Needs
4
Languages
5
Architecture Transport agnostic
transports: TCP, UDP, SCTP, UDT, uTP, QUIC, SSH, etc. authenticated transports: TLS, DTLS, CurveCP, SSH Architecture
6
Multiaddr Support addresses for any network protocol.
Are self-describing. Conform to a simple syntax, making them trivial to parse and construct. Have human-readable and efficient machine-readable representations. Encapsulate well, allowing trivial wrapping and unwrapping of encapsulation layers. /ip6/fe80::8823:6dff:fee7:f172/tcp/4001 /ip4/ /udp/4001/utp /onion/erhkddypoy6qml6h:4003 /ip6/2601:9:4f81:9700:803e:ca65:66e8:c21/udp/1234/quic Multiaddr
8
Multihash Format Examples
<varint hash function code><varint digest size in bytes><hash function output> Examples # sha1 - 0x11 - sha1("multihash") c2f11fb2ce392acb5b2986e640211c e # sha1 in hex CEKIRQXRD6ZM4OJKZNNSTBXGIAQRYRUQA47A==== # sha1 in base32 5dsgvJGnvAfiR3K6HCBc4hcokSfmjj # sha1 in base58 ERSIwvEfss45KstbKYbmQCEcRpAHPg== # sha1 in base64 # sha x12 - sha2-256("multihash") cbc07c3f a3aa2a581ca aa420b9d99bc0e131d9f3e2cbe47 # sha2-256 in hex CIQJZPAHYP4ZC4SYG2R2UKSYDSRAFEMYVJBAXHMZXQHBGHM7HYWL4RY= # sha256 in base32 QmYtUc4iTCbbfVSDNKvtQqrfyezPPnFvE33wFmutw9PBBk # sha256 in base58 EiCcvAfD+ZFyWDajqipYHKICkZiqQgudmbwOEx2fPiy+Rw== # sha256 in base64 Multihash
10
Architecture Multiplexing
can multiplex multiple listen network interfaces can multiplex multiple transport protocols can multiplex multiple connections per peer can multiplex multiple client protocols can multiplex multiple streams per protocol, per connection (SPDY, HTTP2, QUIC, SSH) has flow control (backpressure, fairness) encrypts each connection with a different ephemeral key Architecture
11
Protocol Muxing
12
Architecture Encryption Communications on libp2p may be: encrypted
signed (not encrypted) clear (not encrypted, not signed) Architecture
14
Architecture Nat Traversal / Relay Multiaddr Format
[<relay peer multiaddr>]/p2p-circuit/<destination peer multiaddr> Examples /p2p-circuit/p2p/QmVT6GYwjeeAF5TR485Yc58S3xRF5EFsZ5YAF4VcP3URHt - Arbitrary relay node /ip4/ /tcp/5002/p2p/QmdPU7PfRyKehdrP5A3WqmjyD6bhVpU1mLGKppa2FjGDjZ/p2p- circuit/p2p/QmVT6GYwjeeAF5TR485Yc58S3xRF5EFsZ5YAF4VcP3URHt - Specific relay node Architecture
15
Routing Kademlia DHT Supernode MDNS Other Architecture
16
Routing Lightning Network Libp2p
Libp2p QmYMR9kDCSF3yBVVyhsRepJC4Byx6TrYGbjZsBgzVP9rG2 [ “/ip4/ /tcp/4001”, “/ip4/ /tcp/9005/ws” “/ip4/ /tcp/4001”, “/ip4/ /tcp/4001/ws”, “/ip6/::1/tcp/4001”, “/ip6/::1/tcp/9005/ws”, “/ip6/Fe80::8823:6dff:fee7:f172/tcp/9005/ws”, “/onion/erhkddypoy6qml6h:4003” ] Routing
17
Pubsub Propagate information throughout the network in a structured manner, with or without guarantees like: order, delivery, efficiency, fault tolerance and so on. floodsub multicast Architecture
18
Identity DHT Protocol multiplexing Wire encryption Pubsub Example
19
Further Reading https://libp2p.io/ https://github.com/libp2p
@chrispacia Further Reading
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.