SlideShare a Scribd company logo
1 of 22
Download to read offline
Module:
Content Routing
ResNetLab on Tour
Agenda
➔ Introduction
◆ Location Addressing vs. Content Addressing
◆ The Challenge of content routing in P2P networks
➔ Content Routing Architecture
➔ Content Routing Implementation
◆ DHT-based Content Routing
◆ Gossip-based Content Routing
◆ And other Content Routing subsystems
VS
Location Addressing vs
Content Addressing
Tell me which
server you
know stores
<fileA>?
<server> has it,
here you go!
LOCATION ADDRESSING CONTENT ADDRESSING
Who has
file <CID A>?
Sure, I have it
if you want it
Me too!
And me!
Take it!
<fileA>
<fileA>
<server>
The challenge
of Content
Routing in
P2P networks
Challenges apply to...
Discovering peers
in the network
Finding peers
storing the
content
Contacting these
peers to request
the content
Doing it all in
scalable way!
● There is no central entity orchestrating the storage and
discovery of content.
● There is no central directory to find how to reach every peer in
the network.
● P2P networks present high node churn.
● Thousands of peers and millions of content!
a
CONTENT ADDRESSING CONTENT DISCOVERY
& ROUTING
CONTENT EXCHANGE
● Chunking
● Linking Chunks
in Merkle DAGs
● From Data to
Data Structures with IPLD
● Anatomy of the IPFS CID
● Routing & Provider
Records
● DHT-based Routing
● Gossip-based Routing
● Bitswap
● GraphSync
MUTABLE NAMES &
MESSAGE DELIVERY
● Dynamic Data
● IPNS
● PubSub
● CRDTs
IPFS Components
Content
Routing
Interface in
libp2p/IPFS
● Common interface for content routing:
○ Provide: Make content available for other peers in the
network
○ Resolve: Find the peers storing the content in the
network.
○ Fetch: Fetches content from a provider.
● Additional schemes are required to learn how to reach peers
in the network (peer routing).
Network
Peer
● Content | Peer
● Peer | Contact info
Content
Routing
Interface in
libp2p/IPFS
● Design goals:
○ Reliable: any content can be found.
○ Scalable and fast: The performance of queries are not
affected by the size of the network.
○ Resistant to node churn and sybil attacks.
● Two design approaches:
○ DHT-based: libp2p KadDHT
○ Gossip-based: Bitswap, PubSub.
○ Centrally governed providing subsystems.
Peer Routing
Every peer uses a cryptographic key pair,
for the purpose of
● Identity: unique name in the network
"QmTuAM7RMnMqKnTq6qH1u9JiK5LqQvUxFdnrcM4aRHxeew"
● Channel security (encryption)
Has unique ID in
the p2p network
namespace
Provides
services to
other peers
Must be
“discoverable”
(DHT)
Uses encrypted
communication
channels
Uses services
from other
peers
Must be
“routable”/
reachable
(multiaddress)
The Swarm
The Peer
a
CONTENT ADDRESSING CONTENT DISCOVERY
& ROUTING
CONTENT EXCHANGE
● Chunking
● Linking Chunks
in Merkle DAGs
● From Data to
Data Structures with IPLD
● Anatomy of the IPFS CID
● Routing & Provider
Records
● DHT-based Routing
● Gossip-based Routing
● Bitswap
● GraphSync
MUTABLE NAMES &
MESSAGE DELIVERY
● Dynamic Data
● IPNS
● PubSub
● CRDTs
IPFS Components
The DHT
● A DHT provides a 2-column table (key-value
store) maintained by multiple peers.
● Each row is stored by peers based on similarity
between the key and the peer ID. We call this
“distance”:
○ A peer ID can be “closer” to some keys
than others
○ A peer ID can be “closer” to other peers.
● The DHT is used in IPFS to provide:
○ Peer routing (PeerID, /ipv4/1.2.3.4/tcp/...)
○ Content Discovery (ContentID, PeerID)
○ IPNS Records (IPNS key, IPNS Record)
Peer 1
(key1, value1)
(key2, value2)
Peer 2
(key3, value6)
(key4, value5)
Peer 5
(key7, value7)
Peer 6
(key5, value3)
Peer 3
(key5, value5)
Peer 4
(key4,value4)
● IPFS uses an adaptation of the Kademlia DHT:
○ 256 bits address space - SHA256
○ Distance between two object through XOR
■ distance(a, b) = a XOR b = distance(b,a)
○ It uses tree-based routing (figure)
○ The binary tree is divided into a series of
successively lower subtrees. Each contain a
k-bucket (list of nodes with that prefix)
○ Initiates parallel asynchronous queries to
avoid waiting for offline nodes.
Inspired by Kademlia DHT
Providing
Content
Put content hash H
Lookup k
closest peers
to SHA256(H)
Put provider
record at
those k
closest peers
Periodically
re-publish to
accommodate
churn
● Content is not replicated or uploaded to any external server
(Provide). The content stays local on the user’s device.
● It is the Content Identifier (CID) together with a pointer to the
user’s machine that is made known to the network.
○ This tuple is called the provider record and is added to 20 peers.
■ Provide records expire (i.e. they’re not provided by peers) after 24
hours to account for provider churn.
■ Provider records are re-published after 12 hours (by providers) to
account for peer-churn (i.e. make sure close to 20 peers still
store the record).
Providing
Content
Put content hash H
Lookup k
closest peers
to SHA256(H)
Put provider
record at
those k
closest peers
Periodically
re-publish to
accommodate
churn
● Peers requesting content become temporary providers when
receiving the content.
○ Pinning content converts you in a permanent provider.
○ Content is garbage collected in temporary nodes (> 90%
datastore size; every 1h )
● Content Discovery (Resolve): Contact k closest peers to the CID. If they have the object
they send it back, if not they respond with the provider record.
● Peer Discovery: A peer may not know the multiaddress for the peer in the provider
record so it needs to perform a new DHT query to find the peer’s network addresses.
○ Routing tables refresh every 10 min. This usually determines if a new walk is
needed to get the peer’s contact information.
● Peer Routing: Use the multiaddress of the provider to contact it.
Content
Routing
(DHT-based)
Get content hash H
Lookup k closest
peers to
SHA256(H)
Request record to
peers if they have
it.
(Bitswap)
Continue until
lookup
terminates.
Multi-round iterative lookups
Including records for peers in networks not
reachable from the public (local networks,
isolated VPNs, etc.) is problematic.
● Public DHT (WAN DHT): Only
includes publicly reachable peers.
● Private DHT (LAN DHT): Only
includes peers belonging to the same
private network
A public DHT
and a private one
Pros and Cons
of using a DHT
● Fault tolerant. Resistance to churn.
● Finds peers 100% probability (as long as they are reachable).
● Ensures freshness of the routing information.
● Can be slow in network with a large number of peers.
○ Lookup O(logN), it may require several hops to find peers
if N is large.
● DHT proximity ≠ Spatial proximity
IP Network
Overlay
Network
IPFS Defaults
Metric Default
Value
IPFS
K: Size of buckets 20
Alpha (closest peers queried) 10
Beta (successful peers for
termination)
3
K-bucket refresh interval 10 min
Metric Default Value IPFS
Re-publish interval 12 hr
Provider record expiry 24 hr
Garbage collection
triggered
Every hour, if 90% of
datastore size used
(10GB)
a
CONTENT ADDRESSING CONTENT DISCOVERY
& ROUTING
CONTENT EXCHANGE
● Chunking
● Linking Chunks
in Merkle DAGs
● From Data to
Data Structures with IPLD
● Anatomy of the IPFS CID
● Routing & Provider
Records
● DHT-based Routing
● Gossip-based Routing
● Bitswap
● GraphSync
MUTABLE NAMES &
MESSAGE DELIVERY
● Dynamic Data
● IPNS
● PubSub
● CRDTs
IPFS Components
● IPFS can leverage other content routing subsystems to
discover content in the network:
○ Gossip-based:
■ Bitswap asks its neighbors for the content while
performing a DHT lookup. Gossiping is fast but
the probability of success is low.
■ PubSub protocols build swarms of peers
interested in the same content. Exchange
information about content being requested and
announced in the network.
○ External subsystems: Such as Bittorrent trackers or
DNS.
● The current implementation of IPFS uses gossip-based and
DHT-based content routing orchestrated by Bitswap (more in
Content Exchange Module)
Gossip-based
and other
content
routing
subsystems
Content Discovery in IPFS
Content Provider
Step 0: Get CID out of band.
Step 1: Bitswap asks all
“neighbours” in the peerlist:
● in case of positive response,
content is fetched and
process terminates
● in case of negative
response, proceed to Step 2:
Ask in the DHT
1 2 3
1
2
3
Content Provider
4
5
REQ(CID)
DATA
Step 5: Cache content, publish provider
record, provide content when asked
Content Discovery in IPFS
Step 2: Find provider record by
walking the DHT iteratively, in each
step getting closer to the target.
The provider record includes PeerID
and MultiAddr of provider, iff the
provider record has been updated
within the last 10 mins.
Step 3: If provider record includes
provider’s MultiAddrs, start a
Bitswap session, contact peer
directly and ask for the data -
If not, skip to Step 4. -
4 5
Step 4: “Walk” the DHT again to
map: PeerID -> MultiAddr.
Repeat: -
1 5
Thank you for watching
Reach out in case you have questions or comments!

More Related Content

What's hot

Data Versioning and Reproducible ML with DVC and MLflow
Data Versioning and Reproducible ML with DVC and MLflowData Versioning and Reproducible ML with DVC and MLflow
Data Versioning and Reproducible ML with DVC and MLflowDatabricks
 
Pinot: Near Realtime Analytics @ Uber
Pinot: Near Realtime Analytics @ UberPinot: Near Realtime Analytics @ Uber
Pinot: Near Realtime Analytics @ UberXiang Fu
 
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...DataStax
 
The Google File System (GFS)
The Google File System (GFS)The Google File System (GFS)
The Google File System (GFS)Romain Jacotin
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Ryan Blue
 
nftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewallnftables - the evolution of Linux Firewall
nftables - the evolution of Linux FirewallMarian Marinov
 
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...BIHI Oussama
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptxSurya937648
 
Using pySpark with Google Colab & Spark 3.0 preview
Using pySpark with Google Colab & Spark 3.0 previewUsing pySpark with Google Colab & Spark 3.0 preview
Using pySpark with Google Colab & Spark 3.0 previewMario Cartia
 

What's hot (20)

Unit 2
Unit 2Unit 2
Unit 2
 
HBase
HBaseHBase
HBase
 
Data Versioning and Reproducible ML with DVC and MLflow
Data Versioning and Reproducible ML with DVC and MLflowData Versioning and Reproducible ML with DVC and MLflow
Data Versioning and Reproducible ML with DVC and MLflow
 
Pinot: Near Realtime Analytics @ Uber
Pinot: Near Realtime Analytics @ UberPinot: Near Realtime Analytics @ Uber
Pinot: Near Realtime Analytics @ Uber
 
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
 
The Google File System (GFS)
The Google File System (GFS)The Google File System (GFS)
The Google File System (GFS)
 
1. Apache HIVE
1. Apache HIVE1. Apache HIVE
1. Apache HIVE
 
Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)Iceberg: A modern table format for big data (Strata NY 2018)
Iceberg: A modern table format for big data (Strata NY 2018)
 
nftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewallnftables - the evolution of Linux Firewall
nftables - the evolution of Linux Firewall
 
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...
Developing Apps with GPT-4 and ChatGPT_ Build Intelligent Chatbots, Content G...
 
Hadoop Architecture
Hadoop ArchitectureHadoop Architecture
Hadoop Architecture
 
Apache HBase™
Apache HBase™Apache HBase™
Apache HBase™
 
HDFS Erasure Coding in Action
HDFS Erasure Coding in Action HDFS Erasure Coding in Action
HDFS Erasure Coding in Action
 
Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
YARN Federation
YARN Federation YARN Federation
YARN Federation
 
CockroachDB
CockroachDBCockroachDB
CockroachDB
 
IP Multicasting
IP MulticastingIP Multicasting
IP Multicasting
 
Introduction to HDFS
Introduction to HDFSIntroduction to HDFS
Introduction to HDFS
 
Using pySpark with Google Colab & Spark 3.0 preview
Using pySpark with Google Colab & Spark 3.0 previewUsing pySpark with Google Colab & Spark 3.0 preview
Using pySpark with Google Colab & Spark 3.0 preview
 
NoSQL
NoSQLNoSQL
NoSQL
 

Similar to Module: Content Routing in IPFS

Encode club introduction_to_libp2p
Encode club introduction_to_libp2pEncode club introduction_to_libp2p
Encode club introduction_to_libp2pVanessa Lošić
 
Module: Beyond bitswap
Module: Beyond bitswapModule: Beyond bitswap
Module: Beyond bitswapIoannis Psaras
 
Module: the modular p2 p networking stack
Module: the modular p2 p networking stack Module: the modular p2 p networking stack
Module: the modular p2 p networking stack Ioannis Psaras
 
Big data at scrapinghub
Big data at scrapinghubBig data at scrapinghub
Big data at scrapinghubDana Brophy
 
The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)theijes
 
Try to implement Blockchain using libp2p
Try to implement Blockchain using libp2pTry to implement Blockchain using libp2p
Try to implement Blockchain using libp2pRyouta Kogaenzawa
 
OpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoOpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoNathaniel Braun
 
Strategies for integrating semantic and blockchain technologies
Strategies for integrating semantic and blockchain technologiesStrategies for integrating semantic and blockchain technologies
Strategies for integrating semantic and blockchain technologiesHéctor Ugarte
 
Controlling ip spoofing through inter domain packet filters(synopsis)
Controlling ip spoofing through inter domain packet filters(synopsis)Controlling ip spoofing through inter domain packet filters(synopsis)
Controlling ip spoofing through inter domain packet filters(synopsis)Mumbai Academisc
 
Frontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling frameworkFrontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling frameworkScrapinghub
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and ImplementationVarun Talwar
 
Minerva: Drill Storage Plugin for IPFS
Minerva: Drill Storage Plugin for IPFSMinerva: Drill Storage Plugin for IPFS
Minerva: Drill Storage Plugin for IPFSBowenDing4
 
Cloud Computing Concepts - Peer to peer systems- Napster - Gnutella
Cloud Computing Concepts - Peer to peer systems- Napster - GnutellaCloud Computing Concepts - Peer to peer systems- Napster - Gnutella
Cloud Computing Concepts - Peer to peer systems- Napster - GnutellaRootGate
 
UNIT III DIS.pptx
UNIT III DIS.pptxUNIT III DIS.pptx
UNIT III DIS.pptxSamPrem3
 
Introduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer versionIntroduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer versionTinaBregovi
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Lori Head
 

Similar to Module: Content Routing in IPFS (20)

Encode club introduction_to_libp2p
Encode club introduction_to_libp2pEncode club introduction_to_libp2p
Encode club introduction_to_libp2p
 
Module: Beyond bitswap
Module: Beyond bitswapModule: Beyond bitswap
Module: Beyond bitswap
 
Module: the modular p2 p networking stack
Module: the modular p2 p networking stack Module: the modular p2 p networking stack
Module: the modular p2 p networking stack
 
Big data at scrapinghub
Big data at scrapinghubBig data at scrapinghub
Big data at scrapinghub
 
The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)The International Journal of Engineering and Science (IJES)
The International Journal of Engineering and Science (IJES)
 
Introduction P2p
Introduction P2pIntroduction P2p
Introduction P2p
 
Hades
HadesHades
Hades
 
Try to implement Blockchain using libp2p
Try to implement Blockchain using libp2pTry to implement Blockchain using libp2p
Try to implement Blockchain using libp2p
 
OpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoOpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ Criteo
 
Strategies for integrating semantic and blockchain technologies
Strategies for integrating semantic and blockchain technologiesStrategies for integrating semantic and blockchain technologies
Strategies for integrating semantic and blockchain technologies
 
Controlling ip spoofing through inter domain packet filters(synopsis)
Controlling ip spoofing through inter domain packet filters(synopsis)Controlling ip spoofing through inter domain packet filters(synopsis)
Controlling ip spoofing through inter domain packet filters(synopsis)
 
Frontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling frameworkFrontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling framework
 
Web technology Unit I Part C
Web technology Unit I  Part CWeb technology Unit I  Part C
Web technology Unit I Part C
 
gRPC Design and Implementation
gRPC Design and ImplementationgRPC Design and Implementation
gRPC Design and Implementation
 
Minerva: Drill Storage Plugin for IPFS
Minerva: Drill Storage Plugin for IPFSMinerva: Drill Storage Plugin for IPFS
Minerva: Drill Storage Plugin for IPFS
 
Cloud Computing Concepts - Peer to peer systems- Napster - Gnutella
Cloud Computing Concepts - Peer to peer systems- Napster - GnutellaCloud Computing Concepts - Peer to peer systems- Napster - Gnutella
Cloud Computing Concepts - Peer to peer systems- Napster - Gnutella
 
UNIT III DIS.pptx
UNIT III DIS.pptxUNIT III DIS.pptx
UNIT III DIS.pptx
 
Zipkin
ZipkinZipkin
Zipkin
 
Introduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer versionIntroduction to IPFS & Filecoin - longer version
Introduction to IPFS & Filecoin - longer version
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207
 

Recently uploaded

Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...sonatiwari757
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
horny (9316020077 ) Goa Call Girls Service by VIP Call Girls in Goa
horny (9316020077 ) Goa  Call Girls Service by VIP Call Girls in Goahorny (9316020077 ) Goa  Call Girls Service by VIP Call Girls in Goa
horny (9316020077 ) Goa Call Girls Service by VIP Call Girls in Goasexy call girls service in goa
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 

Recently uploaded (20)

Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
10.pdfMature Call girls in Dubai +971563133746 Dubai Call girls
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
horny (9316020077 ) Goa Call Girls Service by VIP Call Girls in Goa
horny (9316020077 ) Goa  Call Girls Service by VIP Call Girls in Goahorny (9316020077 ) Goa  Call Girls Service by VIP Call Girls in Goa
horny (9316020077 ) Goa Call Girls Service by VIP Call Girls in Goa
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 

Module: Content Routing in IPFS

  • 2. Agenda ➔ Introduction ◆ Location Addressing vs. Content Addressing ◆ The Challenge of content routing in P2P networks ➔ Content Routing Architecture ➔ Content Routing Implementation ◆ DHT-based Content Routing ◆ Gossip-based Content Routing ◆ And other Content Routing subsystems
  • 3. VS Location Addressing vs Content Addressing Tell me which server you know stores <fileA>? <server> has it, here you go! LOCATION ADDRESSING CONTENT ADDRESSING Who has file <CID A>? Sure, I have it if you want it Me too! And me! Take it! <fileA> <fileA> <server>
  • 4. The challenge of Content Routing in P2P networks Challenges apply to... Discovering peers in the network Finding peers storing the content Contacting these peers to request the content Doing it all in scalable way! ● There is no central entity orchestrating the storage and discovery of content. ● There is no central directory to find how to reach every peer in the network. ● P2P networks present high node churn. ● Thousands of peers and millions of content!
  • 5. a CONTENT ADDRESSING CONTENT DISCOVERY & ROUTING CONTENT EXCHANGE ● Chunking ● Linking Chunks in Merkle DAGs ● From Data to Data Structures with IPLD ● Anatomy of the IPFS CID ● Routing & Provider Records ● DHT-based Routing ● Gossip-based Routing ● Bitswap ● GraphSync MUTABLE NAMES & MESSAGE DELIVERY ● Dynamic Data ● IPNS ● PubSub ● CRDTs IPFS Components
  • 6. Content Routing Interface in libp2p/IPFS ● Common interface for content routing: ○ Provide: Make content available for other peers in the network ○ Resolve: Find the peers storing the content in the network. ○ Fetch: Fetches content from a provider. ● Additional schemes are required to learn how to reach peers in the network (peer routing). Network Peer ● Content | Peer ● Peer | Contact info
  • 7. Content Routing Interface in libp2p/IPFS ● Design goals: ○ Reliable: any content can be found. ○ Scalable and fast: The performance of queries are not affected by the size of the network. ○ Resistant to node churn and sybil attacks. ● Two design approaches: ○ DHT-based: libp2p KadDHT ○ Gossip-based: Bitswap, PubSub. ○ Centrally governed providing subsystems.
  • 8. Peer Routing Every peer uses a cryptographic key pair, for the purpose of ● Identity: unique name in the network "QmTuAM7RMnMqKnTq6qH1u9JiK5LqQvUxFdnrcM4aRHxeew" ● Channel security (encryption) Has unique ID in the p2p network namespace Provides services to other peers Must be “discoverable” (DHT) Uses encrypted communication channels Uses services from other peers Must be “routable”/ reachable (multiaddress) The Swarm The Peer
  • 9. a CONTENT ADDRESSING CONTENT DISCOVERY & ROUTING CONTENT EXCHANGE ● Chunking ● Linking Chunks in Merkle DAGs ● From Data to Data Structures with IPLD ● Anatomy of the IPFS CID ● Routing & Provider Records ● DHT-based Routing ● Gossip-based Routing ● Bitswap ● GraphSync MUTABLE NAMES & MESSAGE DELIVERY ● Dynamic Data ● IPNS ● PubSub ● CRDTs IPFS Components
  • 10. The DHT ● A DHT provides a 2-column table (key-value store) maintained by multiple peers. ● Each row is stored by peers based on similarity between the key and the peer ID. We call this “distance”: ○ A peer ID can be “closer” to some keys than others ○ A peer ID can be “closer” to other peers. ● The DHT is used in IPFS to provide: ○ Peer routing (PeerID, /ipv4/1.2.3.4/tcp/...) ○ Content Discovery (ContentID, PeerID) ○ IPNS Records (IPNS key, IPNS Record) Peer 1 (key1, value1) (key2, value2) Peer 2 (key3, value6) (key4, value5) Peer 5 (key7, value7) Peer 6 (key5, value3) Peer 3 (key5, value5) Peer 4 (key4,value4)
  • 11. ● IPFS uses an adaptation of the Kademlia DHT: ○ 256 bits address space - SHA256 ○ Distance between two object through XOR ■ distance(a, b) = a XOR b = distance(b,a) ○ It uses tree-based routing (figure) ○ The binary tree is divided into a series of successively lower subtrees. Each contain a k-bucket (list of nodes with that prefix) ○ Initiates parallel asynchronous queries to avoid waiting for offline nodes. Inspired by Kademlia DHT
  • 12. Providing Content Put content hash H Lookup k closest peers to SHA256(H) Put provider record at those k closest peers Periodically re-publish to accommodate churn ● Content is not replicated or uploaded to any external server (Provide). The content stays local on the user’s device. ● It is the Content Identifier (CID) together with a pointer to the user’s machine that is made known to the network. ○ This tuple is called the provider record and is added to 20 peers. ■ Provide records expire (i.e. they’re not provided by peers) after 24 hours to account for provider churn. ■ Provider records are re-published after 12 hours (by providers) to account for peer-churn (i.e. make sure close to 20 peers still store the record).
  • 13. Providing Content Put content hash H Lookup k closest peers to SHA256(H) Put provider record at those k closest peers Periodically re-publish to accommodate churn ● Peers requesting content become temporary providers when receiving the content. ○ Pinning content converts you in a permanent provider. ○ Content is garbage collected in temporary nodes (> 90% datastore size; every 1h )
  • 14. ● Content Discovery (Resolve): Contact k closest peers to the CID. If they have the object they send it back, if not they respond with the provider record. ● Peer Discovery: A peer may not know the multiaddress for the peer in the provider record so it needs to perform a new DHT query to find the peer’s network addresses. ○ Routing tables refresh every 10 min. This usually determines if a new walk is needed to get the peer’s contact information. ● Peer Routing: Use the multiaddress of the provider to contact it. Content Routing (DHT-based) Get content hash H Lookup k closest peers to SHA256(H) Request record to peers if they have it. (Bitswap) Continue until lookup terminates. Multi-round iterative lookups
  • 15. Including records for peers in networks not reachable from the public (local networks, isolated VPNs, etc.) is problematic. ● Public DHT (WAN DHT): Only includes publicly reachable peers. ● Private DHT (LAN DHT): Only includes peers belonging to the same private network A public DHT and a private one
  • 16. Pros and Cons of using a DHT ● Fault tolerant. Resistance to churn. ● Finds peers 100% probability (as long as they are reachable). ● Ensures freshness of the routing information. ● Can be slow in network with a large number of peers. ○ Lookup O(logN), it may require several hops to find peers if N is large. ● DHT proximity ≠ Spatial proximity IP Network Overlay Network
  • 17. IPFS Defaults Metric Default Value IPFS K: Size of buckets 20 Alpha (closest peers queried) 10 Beta (successful peers for termination) 3 K-bucket refresh interval 10 min Metric Default Value IPFS Re-publish interval 12 hr Provider record expiry 24 hr Garbage collection triggered Every hour, if 90% of datastore size used (10GB)
  • 18. a CONTENT ADDRESSING CONTENT DISCOVERY & ROUTING CONTENT EXCHANGE ● Chunking ● Linking Chunks in Merkle DAGs ● From Data to Data Structures with IPLD ● Anatomy of the IPFS CID ● Routing & Provider Records ● DHT-based Routing ● Gossip-based Routing ● Bitswap ● GraphSync MUTABLE NAMES & MESSAGE DELIVERY ● Dynamic Data ● IPNS ● PubSub ● CRDTs IPFS Components
  • 19. ● IPFS can leverage other content routing subsystems to discover content in the network: ○ Gossip-based: ■ Bitswap asks its neighbors for the content while performing a DHT lookup. Gossiping is fast but the probability of success is low. ■ PubSub protocols build swarms of peers interested in the same content. Exchange information about content being requested and announced in the network. ○ External subsystems: Such as Bittorrent trackers or DNS. ● The current implementation of IPFS uses gossip-based and DHT-based content routing orchestrated by Bitswap (more in Content Exchange Module) Gossip-based and other content routing subsystems
  • 20. Content Discovery in IPFS Content Provider Step 0: Get CID out of band. Step 1: Bitswap asks all “neighbours” in the peerlist: ● in case of positive response, content is fetched and process terminates ● in case of negative response, proceed to Step 2: Ask in the DHT
  • 21. 1 2 3 1 2 3 Content Provider 4 5 REQ(CID) DATA Step 5: Cache content, publish provider record, provide content when asked Content Discovery in IPFS Step 2: Find provider record by walking the DHT iteratively, in each step getting closer to the target. The provider record includes PeerID and MultiAddr of provider, iff the provider record has been updated within the last 10 mins. Step 3: If provider record includes provider’s MultiAddrs, start a Bitswap session, contact peer directly and ask for the data - If not, skip to Step 4. - 4 5 Step 4: “Walk” the DHT again to map: PeerID -> MultiAddr. Repeat: - 1 5
  • 22. Thank you for watching Reach out in case you have questions or comments!