3 min de lectura
Ethereum: Why doesn’t Bitcoin use a DHT for choosing peers?
CRYPTOCURRENCY
The Mystery of Ethereum’s Peer Discovery: Uncovering the Difference Between DHT and Gossip Protocols
The world of cryptocurrency is known for its decentralized networks, but one aspect remains shrouded in mystery: how Bitcoin selects its peers for transactions. Two popular contenders for this task are DHT (Directly Threshhold) and gossip protocols like Kademlia XOR distance. In this article, we’ll delve into the differences between these two approaches and why Ethereum’s developers chose to opt for a gossip protocol over a DHT.
DHT: Decentralized Hash Table
A DHT is a decentralized index-based storage system that allows nodes to share data in a peer-to-peer manner. The idea behind DHTs is to create a shared directory that contains all the files or data available on the network. When a new node joins the network, it creates an entry in this directory and shares its own files with other nodes.
While DHTs can be useful for sharing large amounts of data, they have some limitations when it comes to peer discovery. In order to find new nodes to interact with, DHTs rely on a central index that lists all available peers. If the indexing is not done efficiently, it can lead to poor performance and reduced scalability.
Gossip Protocols: Decentralized Convergence
A gossip protocol, like Kademlia’s XOR distance, is designed for peer discovery in decentralized networks. It works by having multiple nodes (peers) repeatedly send queries to each other to discover new connections. The most efficient peers are those that are closest in distance and have not yet been queried.
Kademlia XOR distance is a popular choice among researchers due to its simplicity and efficiency. Here’s how it works: when a node sends a query, the response includes the IDs of all nodes within a certain distance (XOR) from the sender. The receiving node then uses this information to find new peers that are closer than they were before.
Why Ethereum Chooses Gossip Over DHT
So, why didn’t the Ethereum team opt for a DHT when designing their network? There are several reasons:
- Scalability: As the number of nodes on the network increases, the indexing overhead in DHTs becomes a significant issue. With a gossip protocol like Kademlia XOR distance, each node only needs to maintain contact information with its closest peers, making it easier to scale.
- Performance: Gossip protocols are generally faster and more efficient than DHT-based index systems. By having nodes periodically send queries, you can quickly discover new connections and reduce the time spent in repeated interactions.
- Security: While both approaches have their drawbacks, gossip protocols provide better anonymity and security due to the decentralized nature of node-to-node communication.
Conclusion
The choice between a DHT and a gossip protocol like Kademlia XOR distance depends on the specific requirements of your network. In the case of Ethereum, the developers opted for a gossip protocol to ensure efficient peer discovery, scalability, and performance. While DHTs can be useful in certain scenarios, they often come with limitations that make them less suitable for complex decentralized networks.
As the cryptocurrency landscape continues to evolve, it will be interesting to see how different protocols adapt and improve their approaches to peer discovery. One thing is certain, however: the pursuit of efficient and scalable networks is a crucial aspect of building secure and resilient blockchain ecosystems.