![Page 1: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/1.jpg)
A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table
![Page 2: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/2.jpg)
Overview
History Distributed Hash Tables
IRC
Design
Demo
![Page 3: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/3.jpg)
Distributed Hash Tables (DHTs)
Operations get(key) put(key, value)
How do you find information in a p2p network?
How do peers locate eachother?
Who’s responsible for what?
Generally decentralized
Fault tolerance is important
Must scale well
![Page 4: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/4.jpg)
DHTs– What are they good for?
Web caching and CDNs
Distributed file systems
DNS
Instant messaging
P2P file sharing
![Page 5: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/5.jpg)
History of DHTs - Centralized
Napster
Peers sent local files upon join
Central point of failure
Can only grow as much as central server can
![Page 6: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/6.jpg)
History of DHTs - Gnutella
Flooding
Avoided central point of failure
O(n) look up
Inefficient Extensive modification by devs made it much more
efficient
![Page 7: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/7.jpg)
History of DHTs - Chord
Peers and keys share 160-bit key-space (SHA-1)
Logical ring of keys and peers
successor(k) indicates node responsible for a key k
Each node keeps track of nodes ahead of you in the ring O(n) look up
Finger table improves look up speed Peers keep table of m other peers ith entry contains successor((n+2^(i-1)) mod2^m) O(logn) look up
![Page 8: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/8.jpg)
Kademlia
Peers and keys share 160-bit key-space (SHA-1)
Use XOR to determine distance between peers/keys Symmetric distance measure Satisfies triangle inequality Hashes with long shared prefixes considered close
If local lookup fails, ask peers with IDs closer to key by XOR
O(logn) look up
![Page 9: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/9.jpg)
Kademlia
Peers keep up to 160 buckets of peers called k-buckets Initially one bucket Buckets split into two once they contain k peers
Peers ping peers in k-buckets and remove stale peers to make room for new peers
How do new peers find out about others? Bootstrap nodes
![Page 10: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/10.jpg)
Kademlia
KRPC protocol ping(node_id) find_node(node_id)
If node_id isn’t in your local list, find nodes closer to it than you are (if any) and send find_node(node_id) to them.
get(key) Keep track of peers already queried. Stop the query once
the value is found or no nodes closer to the value is found put(key,value)
Similar to get(key)
![Page 11: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/11.jpg)
IRC
Internet Relay Chat
Servers host channels
Clients connect to servers, join channels and send eachother messages
RFC 2810,2811,2812,2813
RFC 1459
![Page 12: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/12.jpg)
![Page 13: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/13.jpg)
![Page 14: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/14.jpg)
![Page 15: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/15.jpg)
![Page 16: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/16.jpg)
![Page 17: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/17.jpg)
![Page 18: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/18.jpg)
![Page 19: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/19.jpg)
![Page 20: A P2P IRC Network Built on Top of the Kademlia Distributed Hash Table](https://reader035.vdocuments.net/reader035/viewer/2022062802/56649e915503460f94b95d15/html5/thumbnails/20.jpg)