kademlia | Dead simple C11 kademlia distributed hash table library | Hashing library
kandi X-RAY | kademlia Summary
kandi X-RAY | kademlia Summary
C++11 distributed hash table library.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kademlia
kademlia Key Features
kademlia Examples and Code Snippets
Community Discussions
Trending Discussions on kademlia
QUESTION
I'm trying to insert a simple /pk
record to the IFPS DHT using Rust and rust-libp2p
Here's my code (Rust 1.55, libp2p-rust 0.39.1):
...ANSWER
Answered 2021-Oct-25 at 23:14Unfunny story - my example presented in the question is correct - but there is a bug in rust-libp2p which breaks the interoperability with go-libp2p. See https://github.com/libp2p/rust-libp2p/pull/2309 for details
QUESTION
I am new to Ethereum and generally to blockchain. I learned that Ethereum blockchain works on Kademlia. The distributed hash table and its working was beautiful and nicely explained by Eleuth P2P.
Now I used geth to connect to the Ethereum Mainnet and it discovered 2 to 3 maximum peers in 5 to 6 minutes.
Now I know the algorithm but my concern is how the first peer is discovered? Because internet is just a big set of routers and different type of computers (server, computer, etc ) and if you broadcast the discovery like in ARP. The internet will be flooded with these peer discovery broadcast messages and this doesn't seems right. So how initially the connections are made? Also we cannot trust a single network for first time connection because this will make the system server and client based and not decentralised so how the initial connections and peer discovery happens?
Are the broadcast message like have TTL like to prevent the circular loop like in TCP I guess? But this also seems a horrible idea to me.
Please explain.
...ANSWER
Answered 2021-Oct-24 at 09:57In order to get going initially, geth uses a set of bootstrap nodes whose endpoints are recorded in the source code.
Source: Geth docs
Here's the list of the bootstrap nodes hardcoded in the Geth source code: https://github.com/ethereum/go-ethereum/blob/v1.10.11/params/bootnodes.go#L23
The --bootnodes
option allows you to overwrite this list with your own. Example from the above linked docs:
QUESTION
i am studying p2p network recently. when i was reading the s/kademlia paper, i found that the sibling broadcast related content is not detailed enough.
here is my question:
- how the sibling list works?
- how can it solve highly unbalanced tree problem?
it would be grateful if anyone can help me out! thanks!
ref: s/kademlia paper
ANSWER
Answered 2021-Sep-16 at 19:18how the sibling list works?
It seems like it replaces the refinement of the bucket splitting for unbalanced trees with a a list of the closest known nodes relative to the local node ID. Unlike the bucket splitting approach it uses a different parameter instead of the bucket size K.
The details don't seem to be spelled out but it seems logical that one simply computes whether a node would be inserted in that list based on the currently furthest node in that list (assuming the maximum size based on the new parameter has been reached) and otherwise spilling it into the main routing table which is still based on buckets.
how can it solve highly unbalanced tree problem?
Pretty much the same way that kademlia does with the refined splitting approach (which many implementations fail to consider!), but in a way that's easier to reason about and can be parametrized separately.
QUESTION
The first step of the find node operation is as follows (as described in the paper):
The lookup initiator starts by picking α nodes from its closest non-empty k-bucket (or, if that bucket has fewer than α entries, it just takes the α closest nodes it knows of).
Why does it pick the elements directly from the bucket, as opposed to looking for k
closest elements across all elements in all buckets? I believe the latter is what happens in step 2 of the algorithm, and can be seen in the visualization here.
ANSWER
Answered 2021-Mar-28 at 13:26I guess this is simply under the assumption that α ≤ k. Under that condition you will get the k closest nodes automatically from the closest bucket, or if the bucket contains fewer than α nodes the bracketed condition will apply
(or, if that bucket has fewer than α entries, it just takes the α closest nodes it knows of)
Also note that you're looking at the pre-proceedings version of the paper, which does not contain the full kademlia description. You can find the full paper here.
QUESTION
Okay, I've been reading articles and the paper about Kademlia recently to implement a simple p2p program that uses kademlia dht algorithm. And those papers are saying, those 160-bit key in a Kademlia Node is used to identify both nodes (Node ID) and the data (which are stored in a form of tuple).
I'm quite confused on that 'both' part.
As far as my understanding goes, each node in a Kademlia binary tree uniquely represents a client(IP, port) who each holds a list of files.
Here is the general flow on my understanding.
- Client (.exe) gets booted
- Creates a node component
- Newly created node joins the network (bootstrapping)
- Sends find_node(filehash) to k-closest nodes
- Let's say hash is generated by hashing file binary named file1.txt
- Received nodes each finds the queried filehash in its different hash table
- Say, a hash map that has a list of files(File Hash, file location)
- Step 4,5 repeated until the node is found (meanwhile all associated nodes are updating the buckets)
Does this flow look all right?
Additionally, bootstrapping method of Kademlia too confuses me. When the node gets created (user executes the program), It seems like it uses bootstrapping node to fill up the buckets. But then what's bootstrapping node? Is it another process that's always running? What if the bootstrapping node gets turned off?
Can someone help me better understand the concept?
Thanks for the help in advance.
...ANSWER
Answered 2020-Jan-09 at 19:56Does this flow look all right?
It seems roughly correct, but your wording is not very precise.
Each node has a routing table by which it organizes the neighbors it knows about and another table in which it organizes the data it is asked to store by others. Nodes have a quasi-random ID that determines their position in the routing keyspace. The hashes of keys for stored data don't precisely match any particular node ID, so the data is stored on the nodes whose ID is closest to the hash, as determined by the distance metric. That's how node IDs and key hashes are used for both.
When you perform a lookup for data (i.e. find_value
) you ask the remote nodes for the k-closest neighbor set they have in their routing table, which will allow you to home in on the k-closest set for a particular target key. The same query also asks the remote node to return any data they have matching that target ID.
When you perform a find_node
on the other hand you're only asking them for the closest neighbors but not for data. This is primarily used for routing table maintenance where you're not looking for any data.
Those are the abstract operations, if needed an actual implementation could separate the lookup from the data retrieval, i.e. first perform a find_node
and then use the result set to perform one or more separate get
operations that don't involve additional neighbor lookups (similar to the store
operation).
Since kademlia is UDP-based you can't really serve arbitrary files because those could easily exceed reasonable UDP packet sizes. So in practice kademlia usually just serves as a hash table for small binary values (e.g. contact information, public keys and such). Bulk operations are either performed by other protocols bootstrapped off those values or by additional operations beyond those mentioned in the kademlia paper.
What the paper describes is only the basic functionality for a routing algorithm and most basic key value storage. It is a spherical cow in a vacuum. Actual implementations usually need additional features or work around security and reliability problems faced on the public internet.
But then what's bootstrapping node? Is it another process that's always running? What if the bootstrapping node gets turned off?
That's covered in this question (by example of the bittorrent DHT)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kademlia
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page