SlideShare a Scribd company logo
1 of 19
Kademlia
A distributed hash table for decentralized
peer-to-peer network
By
Priyabrata Dash (AKA Priyab Satoshi)
Twitter: twitmyreview
Medium: medium/Crypt-Bytes-Tech
Agenda
ā€¢ What is Peer to Peer Network
ā€¢ What is DHT
ā€¢ Introduction to Kademlia
ā€¢ System Design
ā€¢ Academic Significance
ā€¢ Uses
ā€¢ Implementations
What is Peer to Peer
Network
ā€¢ P2P computing is the sharing of computer resources and services
by direct exchange between systems.
ā€¢ Peers are equally privileged
ā€¢ Resources
ā€¢ processing power
ā€¢ disk storage or network bandwidth
ā€¢ A distributed system architecture
ā€¢ No centralized control
ā€¢ Typically many nodes, but unreliable and heterogeneous
ā€¢ Nodes are symmetric in function
ā€¢ Take advantage of distributed, shared resources
(bandwidth, CPU, storage) on peer-nodes
ā€¢ Fault-tolerant, self-organizing
ā€¢ Operate in dynamic environment, frequent join and leave
is the norm
PEER-TO-
PEER VS
CLIENT-
SERVER
Types & Categories of
P2P Systems
Types
ā€¢ Pure P2P system: a P2P system that has no central service of any
kind
ā€¢ Hybrid P2P system: a P2P system which depends partially on
central servers or allocates selected functions to a subset of
dedicated peers
Categories
ā€¢ Unstructured
ā€¢ No restriction on overlay structures and data placement
ā€¢ Napster, Gnutella, Kazza, Freenet, Bit torrent
ā€¢ Structured
ā€¢ Distributed hash tables (DHTs)
ā€¢ Place restrictions on overlay structures and data placement
ā€¢ Chord, Pastry, Tapestry, CAN
What is DHT (Distributed Hash
table)
ā€¢ A distributed hash table (DHT) is a class of a decentralized distributed system that provides a
lookup service similar to a hash table: (key, value) pairs are stored in a DHT, and any
participating node can efficiently retrieve the value associated with a given key.
ā€¢ Responsibility for maintaining the mapping from keys to values is distributed among the
nodes, in such a way that a change in the set of participants causes a minimal amount of
disruption.
ā€¢ This allows a DHT to scale to extremely large numbers of nodes and to handle continual node
arrivals, departures, and failures.
ā€¢ Distribute data over a large P2P network
ā€¢ Quickly find any given item
ā€¢ Can also distribute responsibility for data storage
ā€¢ Whatā€™s stored is key/value pairs
ā€¢ The key value controls which node(s) stores the value
ā€¢ Each node is responsible for some section of the space
ā€¢ Basic operations
ā€¢ Store(key, val)
ā€¢ val = Retrieve(key)
Introduction to Kademlia
ā€¢ Distributed Hash Table for decentralized peer to peer
computer network designed by Petar Maymounkov and
David MaziĆØres in 2002
ā€¢ Specifies the structure of the network and the exchange of
information through node lookups.
ā€¢ Kademlia nodes communicate among themselves using
UDP.
ā€¢ Each node is identified by a number or node ID
ā€¢ The node ID serves not only as identification, but the
Kademlia algorithm uses the node ID to locate values
(usually file hashes or keywords).
ā€¢ The Kademlia network is made up of a wide range of nodes,
which interact with each other through User Datagram
Protocol (UDP). Each node on the network is identified by a
unique binary number called node ID. The node ID is used
to locate values (block of data) in the Kademlia algorithm.
The values are also interlinked within a Kademlia network
with a specific valueā€™s key, a binary number of fixed length.
ā€¢ One major goal of P2P systems is object lookup: Given a
data item X stored at some set of nodes in the system, find
it. Unlike Chord, CAN, or Pastry Kademlia uses Tree-based
routing.
Kademlia
Binary Tree
ā€¢ Treat nodes as leaves of a binary
tree.
ā€¢ Start from root, for any given node,
dividing the binary tree into a
series of successively lower
subtrees that donā€™t contain the
node.
ā€¢ Every node keeps touch with at
least one node from each of its
subtrees. (if there is a node in that
subtree.) Corresponding to each
subtree, there is a k-bucket.
ā€¢ Every node keeps a list of (IP-
address, Port, Node id) triples, and
(key, value) tuples for further
exchanging information with
others
Kad System Design- Distance Calculation
ā€¢ Kademlia uses a "distance" calculation between two
nodes
ā€¢ The closeness between two objects measured as their
bitwise XOR interpreted as an integer.
distance(a, b) = a XOR b
ā€¢ Distance is computed as the (XOR) of the two node IDs
ā€¢ Keys and Node IDs have the same format and length
ā€¢ Exclusive or was chosen because it acts as a distance
function between all the node IDs.
ā€¢ Specifically:
ā€¢ The distance between a node and itself is zero
ā€¢ It is symmetric: the "distances" calculated from
A to B and from B to A are the same
ā€¢ It follows the triangle inequality: given A, B and
C are vertices (points) of a triangle, then the
distance from A to B is shorter than (or equal to)
the sum of the distance from A to C and the
distance from C to B.
ā€¢ A basic Kademlia network with 2n nodes will only take
n steps (in the worst case) to find that node.
Kad System Design- Routing tables
ā€¢ Nodes, files and key words, deploy SHA-1 hash
into a 160 bits space.
ā€¢ Every entry in a list holds the necessary data
to locate another node. Every node maintains
information about files, key words close to
itself.
ā€¢ Data in list contains
IP address, port, and node ID of another node
ā€¢ The nth list must have a differing nth bit from
the node's ID
ā€¢ The first n-1 bits of the candidate ID must
match those of the node's ID
ā€¢ First list as 1/2 of the nodes in the network are
far away candidates
ā€¢ The next list can use only 1/4 of the nodes in
the network (one bit closer than the first), etc.
Kad System Design- Protocol messages
ā€¢ Kademlia has four messages
ā€¢ PING ā€” used to verify that a node is still alive.
ā€¢ STORE ā€” Stores a (key, value) pair in one node.
ā€¢ FIND_NODE ā€” The recipient of the request will return the k nodes in his own buckets that
are the closest ones to the requested key.
ā€¢ FIND_VALUE ā€” Same as FIND_NODE, but if the recipient of the request has the requested
key in its store, it will return the corresponding value.
ā€¢ Each RPC message includes a random value from the initiator. This ensures that
when the response is received it corresponds to the request previously sent
ā€¢ Every node keeps touch with at least one node from each of its subtrees. (if
there is a node in that subtree.) Corresponding to each subtree, there is a k-
bucket.
ā€¢ Every node keeps a list of (IP-address, Port, Node id) triples, and (key, value)
tuples for further exchanging information with others
Kad System Design-
Locating nodes
ā€¢ The most important is to locate the k closest nodes to some given
node ID.
ā€¢ Kademlia employs a recursive algorithm for node lookups. The
lookup initiator starts by picking a nodes from its closest non-
empty k-bucket.
ā€¢ The initiator then sends parallel, asynchronous FIND_NODE to the
Ī± nodes it has chosen.
ā€¢ Ī± is a system-wide concurrency parameter, such as 3.
ā€¢ the initiator resends the FIND_NODE to nodes it has learned about
from previous RPCs.
ā€¢ If a round of FIND_NODES fails to return a node any closer than
the closest already seen, the initiator resends the FIND_NODE to
all of the k closest nodes it has not already queried.
ā€¢ The lookup could terminate when the initiator has queried and
gotten responses from the k closest nodes it has seen.
Kad System Design- Locating resources
ā€¢ Information is located by mapping it to a key. A hash is typically used for the map. The storer
nodes will have information due to a previous STORE message. Locating a value follows the
same procedure as locating the closest nodes to a key, except the search terminates when a
node has the requested value in his store and returns this value.
ā€¢ The values are stored at several nodes (k of them) to allow for nodes to come and go and still
have the value available in some node. Periodically, a node that stores a value will explore the
network to find the k nodes that are close to the key value and replicate the value onto them.
This compensates for disappeared nodes.
ā€¢ Also, for popular values that might have many requests, the load in the storer nodes is
diminished by having a retriever store this value in some node near, but outside of, the k
closest ones. This new storing is called a cache. In this way the value is stored farther and
farther away from the key, depending on the quantity of requests. This allows popular
searches to find a storer more quickly. Because the value is returned from nodes farther away
from the key, this alleviates possible "hot spots". Caching nodes will drop the value after a
certain time depending on their distance from the key.
ā€¢ Some implementations (e.g. Kad) do not have replication nor caching. The purpose of this is
to remove old information quickly from the system. The node that is providing the file will
periodically refresh the information onto the network (perform FIND_NODE and STORE
messages). When all of the nodes having the file go offline, nobody will be refreshing its
values (sources and keywords) and the information will eventually disappear from the
network.
Kad System Design- Joining the network
ā€¢ A node that would like to join the net must first go through a bootstrap process. In this phase,
the joining node needs to know the IP address and port of another nodeā€”a bootstrap node
(obtained from the user, or from a stored list)ā€”that is already participating in the Kademlia
network. If the joining node has not yet participated in the network, it computes a random ID
number that is supposed not to be already assigned to any other node. It uses this ID until
leaving the network.
ā€¢ The joining node inserts the bootstrap node into one of its k-buckets. The joining node then
does a FIND_NODE of its own ID against the bootstrap node (the only other node it knows).
The "self-lookup" will populate other nodes' k-buckets with the new node ID, and will
populate the joining node's k-buckets with the nodes in the path between it and the
bootstrap node. After this, the joining node refreshes all k-buckets further away than the k-
bucket the bootstrap node falls in. This refresh is just a lookup of a random key that is within
that k-bucket range.
ā€¢ Initially, nodes have one k-bucket. When the k-bucket becomes full, it can be split. The split
occurs if the range of nodes in the k-bucket spans the node's own id (values to the left and
right in a binary tree). Kademlia relaxes even this rule for the one "closest nodes" k-bucket,
because typically one single bucket will correspond to the distance where all the nodes that
are the closest to this node are, they may be more than k, and we want it to know them all. It
may turn out that a highly unbalanced binary sub-tree exists near the node. If k is 20, and
there are 21+ nodes with a prefix "xxx0011....." and the new node is "xxx000011001", the
new node can contain multiple k-buckets for the other 21+ nodes. This is to guarantee that
the network knows about all nodes in the closest region.
Academic Significance & benefits
ā€¢ While the XOR metric is not needed to understand Kademlia, it is critical in the analysis of the protocol.
ā€¢ The XOR arithmetic forms an abelian group allowing closed analysis. Other DHT protocols and algorithms
require simulation or complicated formal analysis in order to predict network behavior and correctness.
ā€¢ Using groups of bits as routing information also simplifies the algorithms.
ā€¢ Since the network is distributed, by definition, there's no one master table of ID->address mappings.
ā€¢ Nodes don't have to (and usually don't) know about all the other nodes.
ā€¢ The process of "finding" a node is basically to ask known nodes "closest" to the target not so much about
the target node directly, but about what nodes are closer to the target.
ā€¢ The result of that query gives you the next group of nodes to query, and the process repeats -- and because
a node would return results that are closer than it is, each iteration tends to find nodes closer and closer to
the target till you finally reach a node that can say "Oh, node X? He's right over there.ā€œ
ā€¢ The nodes in the k-buckets are the stepping stones of routing.
ā€¢ By relying on the oldest nodes, k-buckets promise the probability that they will remain online.
ā€¢ DoS attack is prevented since the new nodes find it difficult to get into the k-bucket
Uses
ā€¢ Some of the Use cases of Kademlia are given below:
ā€¢ File Sharing
ā€¢ Botnet
ā€¢ File System
ā€¢ IP Overlay Routing
ā€¢ P2P Network Discovery
ā€¢ Peer to Peer Messaging
ā€¢ Kademlia is used in file sharing networks.
ā€¢ If a node wants to share a file, it processes the contents of the file, calculating from it a
number (hash) that will identify this file within the file-sharing network
ā€¢ Hashes and the node IDs must be of the same length
ā€¢ It then searches for several nodes whose ID is close to the hash
ā€¢ A searching client will use Kademlia to search the network for the node whose ID has the
smallest distance to the file hash, then will retrieve the sources list that is stored in that node
Implementation
ā€¢ I2P[7]
ā€¢ Kad Network ā€” developed originally by the eMule community to replace the server-based architecture of the eDonkey2000
network.
ā€¢ Ethereum ā€” The node discovery protocol in Ethereum's blockchain network stack is based a slightly modified implementation of
Kademlia.[8]
ā€¢ Overnet network: With KadC a C library for handling its Kademlia is available. (development of Overnet is discontinued)
ā€¢ BitTorrent Uses a DHT based on an implementation of the Kademlia algorithm, for trackerless torrents.
ā€¢ Osiris sps (all version): used to manage distributed and anonymous web portal.
ā€¢ Retroshare ā€” F2F decentralised communication platform with secure VOIP, instant messaging, file transfer etc.
ā€¢ Tox - A fully distributed messaging, VoIP and video chat platform
ā€¢ Gnutella DHT ā€” Originally by LimeWire[9][10] to augment the Gnutella protocol for finding alternate file locations, now in use by
other gnutella clients.[11]
ā€¢ IPFS āˆ’ A peer-to-peer distributed filesystem.[12]
ā€¢ TeleHash is a mesh networking protocol that uses Kademlia to resolve direct connections between parties.[13]
ā€¢ IPFS
ā€¢ OpenDHT
Reference
ā€¢ Pease refer below link to access some of the references I used for this
presentation:
https://www.reddit.com/r/indiacryptogrp/comments/8ej9zv/reading
_list_kademlia/
Thank You & QA

More Related Content

What's hot

Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocolN.Jagadish Kumar
Ā 
Routing algorithms
Routing algorithmsRouting algorithms
Routing algorithmsMoctardOLOULADE
Ā 
Computer Network Topologies (with animations)
Computer Network Topologies (with animations)Computer Network Topologies (with animations)
Computer Network Topologies (with animations)Damian T. Gordon
Ā 
OSI model and TCP/IP model
OSI model and TCP/IP modelOSI model and TCP/IP model
OSI model and TCP/IP modelRubal Sagwal
Ā 
Ch 20 UNICAST ROUTING SECTION 2
Ch 20   UNICAST ROUTING  SECTION  2Ch 20   UNICAST ROUTING  SECTION  2
Ch 20 UNICAST ROUTING SECTION 2Hossam El-Deen Osama
Ā 
Congestion control
Congestion controlCongestion control
Congestion controlAman Jaiswal
Ā 
Presentation Routing algorithm
Presentation Routing algorithmPresentation Routing algorithm
Presentation Routing algorithmBasit Hussain
Ā 
Classless inter domain routing
Classless inter domain routingClassless inter domain routing
Classless inter domain routingVikash Gangwar
Ā 
difference between hub, bridge, switch and router
difference between hub, bridge, switch and routerdifference between hub, bridge, switch and router
difference between hub, bridge, switch and routerAkmal Cikmat
Ā 
Tapestry
TapestryTapestry
TapestrySutha31
Ā 
IP tables and Filtering
IP tables and FilteringIP tables and Filtering
IP tables and FilteringAisha Talat
Ā 
TCP congestion control
TCP congestion controlTCP congestion control
TCP congestion controlShubham Jain
Ā 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptxAcad
Ā 
Transport layer
Transport layerTransport layer
Transport layerreshmadayma
Ā 
Multithreading
Multithreading Multithreading
Multithreading WafaQKhan
Ā 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCPselvakumar_b1985
Ā 

What's hot (20)

Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
Ā 
Routing algorithms
Routing algorithmsRouting algorithms
Routing algorithms
Ā 
Computer Network Topologies (with animations)
Computer Network Topologies (with animations)Computer Network Topologies (with animations)
Computer Network Topologies (with animations)
Ā 
OSI model and TCP/IP model
OSI model and TCP/IP modelOSI model and TCP/IP model
OSI model and TCP/IP model
Ā 
Ch 20 UNICAST ROUTING SECTION 2
Ch 20   UNICAST ROUTING  SECTION  2Ch 20   UNICAST ROUTING  SECTION  2
Ch 20 UNICAST ROUTING SECTION 2
Ā 
DHCP
DHCPDHCP
DHCP
Ā 
Congestion control
Congestion controlCongestion control
Congestion control
Ā 
Presentation Routing algorithm
Presentation Routing algorithmPresentation Routing algorithm
Presentation Routing algorithm
Ā 
Classless inter domain routing
Classless inter domain routingClassless inter domain routing
Classless inter domain routing
Ā 
Overlay networks
Overlay networksOverlay networks
Overlay networks
Ā 
Bridge
BridgeBridge
Bridge
Ā 
Trace route
Trace routeTrace route
Trace route
Ā 
difference between hub, bridge, switch and router
difference between hub, bridge, switch and routerdifference between hub, bridge, switch and router
difference between hub, bridge, switch and router
Ā 
Tapestry
TapestryTapestry
Tapestry
Ā 
IP tables and Filtering
IP tables and FilteringIP tables and Filtering
IP tables and Filtering
Ā 
TCP congestion control
TCP congestion controlTCP congestion control
TCP congestion control
Ā 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
Ā 
Transport layer
Transport layerTransport layer
Transport layer
Ā 
Multithreading
Multithreading Multithreading
Multithreading
Ā 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
Ā 

Similar to Kademlia introduction

Peer to peer Paradigms
Peer to peer ParadigmsPeer to peer Paradigms
Peer to peer Paradigmshassan ahmed
Ā 
Implementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaImplementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaTristan Penman
Ā 
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...Tristan Penman
Ā 
UNIT III DIS.pptx
UNIT III DIS.pptxUNIT III DIS.pptx
UNIT III DIS.pptxSamPrem3
Ā 
IRJET- Estimating Various DHT Protocols
IRJET- Estimating Various DHT ProtocolsIRJET- Estimating Various DHT Protocols
IRJET- Estimating Various DHT ProtocolsIRJET Journal
Ā 
Dynamo and BigTable in light of the CAP theorem
Dynamo and BigTable in light of the CAP theoremDynamo and BigTable in light of the CAP theorem
Dynamo and BigTable in light of the CAP theoremGrisha Weintraub
Ā 
6.1-Cassandra.ppt
6.1-Cassandra.ppt6.1-Cassandra.ppt
6.1-Cassandra.pptDanBarcan2
Ā 
Agents and P2P Networks
Agents and P2P NetworksAgents and P2P Networks
Agents and P2P NetworksJames Salter
Ā 
Apache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsApache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsJulien Anguenot
Ā 
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...DataStax
Ā 
Routing Protocols of Distributed Hash Table Based Peer to Peer Networks
Routing Protocols of Distributed Hash Table Based Peer to Peer NetworksRouting Protocols of Distributed Hash Table Based Peer to Peer Networks
Routing Protocols of Distributed Hash Table Based Peer to Peer NetworksIOSR Journals
Ā 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
Ā 
An overview of Peer-to-Peer technology new
An overview of Peer-to-Peer technology newAn overview of Peer-to-Peer technology new
An overview of Peer-to-Peer technology newchizhangufl
Ā 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupAdam Hutson
Ā 

Similar to Kademlia introduction (20)

Peer to peer Paradigms
Peer to peer ParadigmsPeer to peer Paradigms
Peer to peer Paradigms
Ā 
Implementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and AkkaImplementing a Distributed Hash Table with Scala and Akka
Implementing a Distributed Hash Table with Scala and Akka
Ā 
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...
PWL Seattle #16 - Chord: A Scalable Peer-to-peer Lookup Protocol for Internet...
Ā 
UNIT III DIS.pptx
UNIT III DIS.pptxUNIT III DIS.pptx
UNIT III DIS.pptx
Ā 
IRJET- Estimating Various DHT Protocols
IRJET- Estimating Various DHT ProtocolsIRJET- Estimating Various DHT Protocols
IRJET- Estimating Various DHT Protocols
Ā 
Dynamo and BigTable in light of the CAP theorem
Dynamo and BigTable in light of the CAP theoremDynamo and BigTable in light of the CAP theorem
Dynamo and BigTable in light of the CAP theorem
Ā 
6.1-Cassandra.ppt
6.1-Cassandra.ppt6.1-Cassandra.ppt
6.1-Cassandra.ppt
Ā 
Cassandra
CassandraCassandra
Cassandra
Ā 
6.1-Cassandra.ppt
6.1-Cassandra.ppt6.1-Cassandra.ppt
6.1-Cassandra.ppt
Ā 
Agents and P2P Networks
Agents and P2P NetworksAgents and P2P Networks
Agents and P2P Networks
Ā 
Apache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentialsApache Cassandra multi-datacenter essentials
Apache Cassandra multi-datacenter essentials
Ā 
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Apache Cassandra Multi-Datacenter Essentials (Julien Anguenot, iLand Internet...
Ā 
Routing Protocols of Distributed Hash Table Based Peer to Peer Networks
Routing Protocols of Distributed Hash Table Based Peer to Peer NetworksRouting Protocols of Distributed Hash Table Based Peer to Peer Networks
Routing Protocols of Distributed Hash Table Based Peer to Peer Networks
Ā 
CS8603 DS UNIT 5.pptx
CS8603 DS UNIT 5.pptxCS8603 DS UNIT 5.pptx
CS8603 DS UNIT 5.pptx
Ā 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
Ā 
An overview of Peer-to-Peer technology new
An overview of Peer-to-Peer technology newAn overview of Peer-to-Peer technology new
An overview of Peer-to-Peer technology new
Ā 
lecture-2-tcp-ip.ppt
lecture-2-tcp-ip.pptlecture-2-tcp-ip.ppt
lecture-2-tcp-ip.ppt
Ā 
P2P Lecture.ppt
P2P Lecture.pptP2P Lecture.ppt
P2P Lecture.ppt
Ā 
L6.sp17.pptx
L6.sp17.pptxL6.sp17.pptx
L6.sp17.pptx
Ā 
Cassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User GroupCassandra & Python - Springfield MO User Group
Cassandra & Python - Springfield MO User Group
Ā 

More from Priyab Satoshi

Introduction to Chatbots
Introduction to ChatbotsIntroduction to Chatbots
Introduction to ChatbotsPriyab Satoshi
Ā 
Introduction to IOT security
Introduction to IOT securityIntroduction to IOT security
Introduction to IOT securityPriyab Satoshi
Ā 
Introduction to State Channels & Payment Channels
Introduction to State Channels & Payment ChannelsIntroduction to State Channels & Payment Channels
Introduction to State Channels & Payment ChannelsPriyab Satoshi
Ā 
Introduction to GDPR
Introduction to GDPRIntroduction to GDPR
Introduction to GDPRPriyab Satoshi
Ā 
Cryptocurrency & ICO Regulations in US
Cryptocurrency & ICO Regulations in USCryptocurrency & ICO Regulations in US
Cryptocurrency & ICO Regulations in USPriyab Satoshi
Ā 
Online privacy & security
Online privacy & securityOnline privacy & security
Online privacy & securityPriyab Satoshi
Ā 
Introduction to Cognitive Automation
Introduction to Cognitive AutomationIntroduction to Cognitive Automation
Introduction to Cognitive AutomationPriyab Satoshi
Ā 
Robotic process automation Introduction
Robotic process automation IntroductionRobotic process automation Introduction
Robotic process automation IntroductionPriyab Satoshi
Ā 
Decentralised Exchanges - An Introduction
Decentralised Exchanges - An IntroductionDecentralised Exchanges - An Introduction
Decentralised Exchanges - An IntroductionPriyab Satoshi
Ā 
Introduction to Segwit
Introduction to SegwitIntroduction to Segwit
Introduction to SegwitPriyab Satoshi
Ā 
On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token Priyab Satoshi
Ā 
Introduction to blockchain
Introduction to blockchainIntroduction to blockchain
Introduction to blockchainPriyab Satoshi
Ā 
Blockchain and Decentralization
Blockchain and DecentralizationBlockchain and Decentralization
Blockchain and DecentralizationPriyab Satoshi
Ā 
Cryptocurrency & Regulatory Environment
Cryptocurrency & Regulatory EnvironmentCryptocurrency & Regulatory Environment
Cryptocurrency & Regulatory EnvironmentPriyab Satoshi
Ā 
Understanding blockchain
Understanding blockchainUnderstanding blockchain
Understanding blockchainPriyab Satoshi
Ā 

More from Priyab Satoshi (16)

Introduction to Chatbots
Introduction to ChatbotsIntroduction to Chatbots
Introduction to Chatbots
Ā 
Introduction to IOT security
Introduction to IOT securityIntroduction to IOT security
Introduction to IOT security
Ā 
Introduction to State Channels & Payment Channels
Introduction to State Channels & Payment ChannelsIntroduction to State Channels & Payment Channels
Introduction to State Channels & Payment Channels
Ā 
Introduction to GDPR
Introduction to GDPRIntroduction to GDPR
Introduction to GDPR
Ā 
Cryptocurrency & ICO Regulations in US
Cryptocurrency & ICO Regulations in USCryptocurrency & ICO Regulations in US
Cryptocurrency & ICO Regulations in US
Ā 
Online privacy & security
Online privacy & securityOnline privacy & security
Online privacy & security
Ā 
Introduction to Cognitive Automation
Introduction to Cognitive AutomationIntroduction to Cognitive Automation
Introduction to Cognitive Automation
Ā 
Robotic process automation Introduction
Robotic process automation IntroductionRobotic process automation Introduction
Robotic process automation Introduction
Ā 
Decentralised Exchanges - An Introduction
Decentralised Exchanges - An IntroductionDecentralised Exchanges - An Introduction
Decentralised Exchanges - An Introduction
Ā 
Introduction to Segwit
Introduction to SegwitIntroduction to Segwit
Introduction to Segwit
Ā 
On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token On-chain Crowdfunding & Asset Token
On-chain Crowdfunding & Asset Token
Ā 
Introduction to blockchain
Introduction to blockchainIntroduction to blockchain
Introduction to blockchain
Ā 
Blockchain and Decentralization
Blockchain and DecentralizationBlockchain and Decentralization
Blockchain and Decentralization
Ā 
Erc 721 tokens
Erc 721 tokensErc 721 tokens
Erc 721 tokens
Ā 
Cryptocurrency & Regulatory Environment
Cryptocurrency & Regulatory EnvironmentCryptocurrency & Regulatory Environment
Cryptocurrency & Regulatory Environment
Ā 
Understanding blockchain
Understanding blockchainUnderstanding blockchain
Understanding blockchain
Ā 

Recently uploaded

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 šŸ‘Œ ā­ļø 6378878445ruhi
Ā 
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...Sheetaleventcompany
Ā 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
Ā 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
Ā 
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663Call Girls Mumbai
Ā 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
Ā 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
Ā 
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
Ā 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ā˜
Ā 
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
Ā 
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
Ā 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
Ā 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
Ā 
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...Diya Sharma
Ā 
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
Ā 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
Ā 
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort Service
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort ServiceEnjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort Service
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort ServiceDelhi Call girls
Ā 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
Ā 

Recently uploaded (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
Ā 
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ā¤ļø 7710465962 Independent Call Girls In C...
Ā 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
Ā 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
Ā 
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663
āœ‚ļø šŸ‘… Independent Andheri Escorts With Room Vashi Call Girls šŸ’ƒ 9004004663
Ā 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Ā 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
Ā 
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
Ā 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
Ā 
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
Ā 
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...
Ā 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
Ā 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
Ā 
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...
Ā 
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...
ā‚¹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] šŸ”|97111...
Ā 
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
Ā 
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.
Ā 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
Ā 
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort Service
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort ServiceEnjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort Service
Enjoy Nightāš”Call Girls Dlf City Phase 3 Gurgaon >ą¼’8448380779 Escort Service
Ā 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Ā 

Kademlia introduction

  • 1. Kademlia A distributed hash table for decentralized peer-to-peer network By Priyabrata Dash (AKA Priyab Satoshi) Twitter: twitmyreview Medium: medium/Crypt-Bytes-Tech
  • 2. Agenda ā€¢ What is Peer to Peer Network ā€¢ What is DHT ā€¢ Introduction to Kademlia ā€¢ System Design ā€¢ Academic Significance ā€¢ Uses ā€¢ Implementations
  • 3. What is Peer to Peer Network ā€¢ P2P computing is the sharing of computer resources and services by direct exchange between systems. ā€¢ Peers are equally privileged ā€¢ Resources ā€¢ processing power ā€¢ disk storage or network bandwidth ā€¢ A distributed system architecture ā€¢ No centralized control ā€¢ Typically many nodes, but unreliable and heterogeneous ā€¢ Nodes are symmetric in function ā€¢ Take advantage of distributed, shared resources (bandwidth, CPU, storage) on peer-nodes ā€¢ Fault-tolerant, self-organizing ā€¢ Operate in dynamic environment, frequent join and leave is the norm
  • 5. Types & Categories of P2P Systems Types ā€¢ Pure P2P system: a P2P system that has no central service of any kind ā€¢ Hybrid P2P system: a P2P system which depends partially on central servers or allocates selected functions to a subset of dedicated peers Categories ā€¢ Unstructured ā€¢ No restriction on overlay structures and data placement ā€¢ Napster, Gnutella, Kazza, Freenet, Bit torrent ā€¢ Structured ā€¢ Distributed hash tables (DHTs) ā€¢ Place restrictions on overlay structures and data placement ā€¢ Chord, Pastry, Tapestry, CAN
  • 6. What is DHT (Distributed Hash table) ā€¢ A distributed hash table (DHT) is a class of a decentralized distributed system that provides a lookup service similar to a hash table: (key, value) pairs are stored in a DHT, and any participating node can efficiently retrieve the value associated with a given key. ā€¢ Responsibility for maintaining the mapping from keys to values is distributed among the nodes, in such a way that a change in the set of participants causes a minimal amount of disruption. ā€¢ This allows a DHT to scale to extremely large numbers of nodes and to handle continual node arrivals, departures, and failures. ā€¢ Distribute data over a large P2P network ā€¢ Quickly find any given item ā€¢ Can also distribute responsibility for data storage ā€¢ Whatā€™s stored is key/value pairs ā€¢ The key value controls which node(s) stores the value ā€¢ Each node is responsible for some section of the space ā€¢ Basic operations ā€¢ Store(key, val) ā€¢ val = Retrieve(key)
  • 7. Introduction to Kademlia ā€¢ Distributed Hash Table for decentralized peer to peer computer network designed by Petar Maymounkov and David MaziĆØres in 2002 ā€¢ Specifies the structure of the network and the exchange of information through node lookups. ā€¢ Kademlia nodes communicate among themselves using UDP. ā€¢ Each node is identified by a number or node ID ā€¢ The node ID serves not only as identification, but the Kademlia algorithm uses the node ID to locate values (usually file hashes or keywords). ā€¢ The Kademlia network is made up of a wide range of nodes, which interact with each other through User Datagram Protocol (UDP). Each node on the network is identified by a unique binary number called node ID. The node ID is used to locate values (block of data) in the Kademlia algorithm. The values are also interlinked within a Kademlia network with a specific valueā€™s key, a binary number of fixed length. ā€¢ One major goal of P2P systems is object lookup: Given a data item X stored at some set of nodes in the system, find it. Unlike Chord, CAN, or Pastry Kademlia uses Tree-based routing.
  • 8. Kademlia Binary Tree ā€¢ Treat nodes as leaves of a binary tree. ā€¢ Start from root, for any given node, dividing the binary tree into a series of successively lower subtrees that donā€™t contain the node. ā€¢ Every node keeps touch with at least one node from each of its subtrees. (if there is a node in that subtree.) Corresponding to each subtree, there is a k-bucket. ā€¢ Every node keeps a list of (IP- address, Port, Node id) triples, and (key, value) tuples for further exchanging information with others
  • 9. Kad System Design- Distance Calculation ā€¢ Kademlia uses a "distance" calculation between two nodes ā€¢ The closeness between two objects measured as their bitwise XOR interpreted as an integer. distance(a, b) = a XOR b ā€¢ Distance is computed as the (XOR) of the two node IDs ā€¢ Keys and Node IDs have the same format and length ā€¢ Exclusive or was chosen because it acts as a distance function between all the node IDs. ā€¢ Specifically: ā€¢ The distance between a node and itself is zero ā€¢ It is symmetric: the "distances" calculated from A to B and from B to A are the same ā€¢ It follows the triangle inequality: given A, B and C are vertices (points) of a triangle, then the distance from A to B is shorter than (or equal to) the sum of the distance from A to C and the distance from C to B. ā€¢ A basic Kademlia network with 2n nodes will only take n steps (in the worst case) to find that node.
  • 10. Kad System Design- Routing tables ā€¢ Nodes, files and key words, deploy SHA-1 hash into a 160 bits space. ā€¢ Every entry in a list holds the necessary data to locate another node. Every node maintains information about files, key words close to itself. ā€¢ Data in list contains IP address, port, and node ID of another node ā€¢ The nth list must have a differing nth bit from the node's ID ā€¢ The first n-1 bits of the candidate ID must match those of the node's ID ā€¢ First list as 1/2 of the nodes in the network are far away candidates ā€¢ The next list can use only 1/4 of the nodes in the network (one bit closer than the first), etc.
  • 11. Kad System Design- Protocol messages ā€¢ Kademlia has four messages ā€¢ PING ā€” used to verify that a node is still alive. ā€¢ STORE ā€” Stores a (key, value) pair in one node. ā€¢ FIND_NODE ā€” The recipient of the request will return the k nodes in his own buckets that are the closest ones to the requested key. ā€¢ FIND_VALUE ā€” Same as FIND_NODE, but if the recipient of the request has the requested key in its store, it will return the corresponding value. ā€¢ Each RPC message includes a random value from the initiator. This ensures that when the response is received it corresponds to the request previously sent ā€¢ Every node keeps touch with at least one node from each of its subtrees. (if there is a node in that subtree.) Corresponding to each subtree, there is a k- bucket. ā€¢ Every node keeps a list of (IP-address, Port, Node id) triples, and (key, value) tuples for further exchanging information with others
  • 12. Kad System Design- Locating nodes ā€¢ The most important is to locate the k closest nodes to some given node ID. ā€¢ Kademlia employs a recursive algorithm for node lookups. The lookup initiator starts by picking a nodes from its closest non- empty k-bucket. ā€¢ The initiator then sends parallel, asynchronous FIND_NODE to the Ī± nodes it has chosen. ā€¢ Ī± is a system-wide concurrency parameter, such as 3. ā€¢ the initiator resends the FIND_NODE to nodes it has learned about from previous RPCs. ā€¢ If a round of FIND_NODES fails to return a node any closer than the closest already seen, the initiator resends the FIND_NODE to all of the k closest nodes it has not already queried. ā€¢ The lookup could terminate when the initiator has queried and gotten responses from the k closest nodes it has seen.
  • 13. Kad System Design- Locating resources ā€¢ Information is located by mapping it to a key. A hash is typically used for the map. The storer nodes will have information due to a previous STORE message. Locating a value follows the same procedure as locating the closest nodes to a key, except the search terminates when a node has the requested value in his store and returns this value. ā€¢ The values are stored at several nodes (k of them) to allow for nodes to come and go and still have the value available in some node. Periodically, a node that stores a value will explore the network to find the k nodes that are close to the key value and replicate the value onto them. This compensates for disappeared nodes. ā€¢ Also, for popular values that might have many requests, the load in the storer nodes is diminished by having a retriever store this value in some node near, but outside of, the k closest ones. This new storing is called a cache. In this way the value is stored farther and farther away from the key, depending on the quantity of requests. This allows popular searches to find a storer more quickly. Because the value is returned from nodes farther away from the key, this alleviates possible "hot spots". Caching nodes will drop the value after a certain time depending on their distance from the key. ā€¢ Some implementations (e.g. Kad) do not have replication nor caching. The purpose of this is to remove old information quickly from the system. The node that is providing the file will periodically refresh the information onto the network (perform FIND_NODE and STORE messages). When all of the nodes having the file go offline, nobody will be refreshing its values (sources and keywords) and the information will eventually disappear from the network.
  • 14. Kad System Design- Joining the network ā€¢ A node that would like to join the net must first go through a bootstrap process. In this phase, the joining node needs to know the IP address and port of another nodeā€”a bootstrap node (obtained from the user, or from a stored list)ā€”that is already participating in the Kademlia network. If the joining node has not yet participated in the network, it computes a random ID number that is supposed not to be already assigned to any other node. It uses this ID until leaving the network. ā€¢ The joining node inserts the bootstrap node into one of its k-buckets. The joining node then does a FIND_NODE of its own ID against the bootstrap node (the only other node it knows). The "self-lookup" will populate other nodes' k-buckets with the new node ID, and will populate the joining node's k-buckets with the nodes in the path between it and the bootstrap node. After this, the joining node refreshes all k-buckets further away than the k- bucket the bootstrap node falls in. This refresh is just a lookup of a random key that is within that k-bucket range. ā€¢ Initially, nodes have one k-bucket. When the k-bucket becomes full, it can be split. The split occurs if the range of nodes in the k-bucket spans the node's own id (values to the left and right in a binary tree). Kademlia relaxes even this rule for the one "closest nodes" k-bucket, because typically one single bucket will correspond to the distance where all the nodes that are the closest to this node are, they may be more than k, and we want it to know them all. It may turn out that a highly unbalanced binary sub-tree exists near the node. If k is 20, and there are 21+ nodes with a prefix "xxx0011....." and the new node is "xxx000011001", the new node can contain multiple k-buckets for the other 21+ nodes. This is to guarantee that the network knows about all nodes in the closest region.
  • 15. Academic Significance & benefits ā€¢ While the XOR metric is not needed to understand Kademlia, it is critical in the analysis of the protocol. ā€¢ The XOR arithmetic forms an abelian group allowing closed analysis. Other DHT protocols and algorithms require simulation or complicated formal analysis in order to predict network behavior and correctness. ā€¢ Using groups of bits as routing information also simplifies the algorithms. ā€¢ Since the network is distributed, by definition, there's no one master table of ID->address mappings. ā€¢ Nodes don't have to (and usually don't) know about all the other nodes. ā€¢ The process of "finding" a node is basically to ask known nodes "closest" to the target not so much about the target node directly, but about what nodes are closer to the target. ā€¢ The result of that query gives you the next group of nodes to query, and the process repeats -- and because a node would return results that are closer than it is, each iteration tends to find nodes closer and closer to the target till you finally reach a node that can say "Oh, node X? He's right over there.ā€œ ā€¢ The nodes in the k-buckets are the stepping stones of routing. ā€¢ By relying on the oldest nodes, k-buckets promise the probability that they will remain online. ā€¢ DoS attack is prevented since the new nodes find it difficult to get into the k-bucket
  • 16. Uses ā€¢ Some of the Use cases of Kademlia are given below: ā€¢ File Sharing ā€¢ Botnet ā€¢ File System ā€¢ IP Overlay Routing ā€¢ P2P Network Discovery ā€¢ Peer to Peer Messaging ā€¢ Kademlia is used in file sharing networks. ā€¢ If a node wants to share a file, it processes the contents of the file, calculating from it a number (hash) that will identify this file within the file-sharing network ā€¢ Hashes and the node IDs must be of the same length ā€¢ It then searches for several nodes whose ID is close to the hash ā€¢ A searching client will use Kademlia to search the network for the node whose ID has the smallest distance to the file hash, then will retrieve the sources list that is stored in that node
  • 17. Implementation ā€¢ I2P[7] ā€¢ Kad Network ā€” developed originally by the eMule community to replace the server-based architecture of the eDonkey2000 network. ā€¢ Ethereum ā€” The node discovery protocol in Ethereum's blockchain network stack is based a slightly modified implementation of Kademlia.[8] ā€¢ Overnet network: With KadC a C library for handling its Kademlia is available. (development of Overnet is discontinued) ā€¢ BitTorrent Uses a DHT based on an implementation of the Kademlia algorithm, for trackerless torrents. ā€¢ Osiris sps (all version): used to manage distributed and anonymous web portal. ā€¢ Retroshare ā€” F2F decentralised communication platform with secure VOIP, instant messaging, file transfer etc. ā€¢ Tox - A fully distributed messaging, VoIP and video chat platform ā€¢ Gnutella DHT ā€” Originally by LimeWire[9][10] to augment the Gnutella protocol for finding alternate file locations, now in use by other gnutella clients.[11] ā€¢ IPFS āˆ’ A peer-to-peer distributed filesystem.[12] ā€¢ TeleHash is a mesh networking protocol that uses Kademlia to resolve direct connections between parties.[13] ā€¢ IPFS ā€¢ OpenDHT
  • 18. Reference ā€¢ Pease refer below link to access some of the references I used for this presentation: https://www.reddit.com/r/indiacryptogrp/comments/8ej9zv/reading _list_kademlia/