ethersphere / bee

Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network: a private; decentralized; and self-sustaining network for permissionless publishing and access to your (application) data.
https://www.ethswarm.org
BSD 3-Clause "New" or "Revised" License
1.45k stars 336 forks source link

Swarm support multicast routing based on Kademlia #4219

Open bitcard opened 1 year ago

bitcard commented 1 year ago

Summary

Swarm supports multicast between multiple nodes, multiple nodes form a group (as few as a few nodes, as many as 100,000 nodes, which can limit the maximum number of nodes), and messages sent by any node in the group can be received by other nodes. Of course, in order to avoid broadcast storms, messages, like unicast (PSS), need to be paid to prevent spam broadcasting.

Motivation

The basic routing methods of the IP network are unicast and multicast, which can easily realize various applications such as 1-to-1, 1-to-many, and many-to-many. Swarm forms an overlay network on the top of IP network, which solves the problem of data storage well, but in terms of node communication, it mainly relies on PSS implementation, similar to unicast of IP network, without realizing the multicast function of IP network, and the application type will be greatly limited, such as real-time group chat, real-time multi-person meeting, online livestreaming video, etc.

Implementation

A node joins a group of multicasts, and all joined nodes form a group. Message routing in the group, there are two implementation ideas, one is to use the multicast algorithm of the IP network, which is widely used in the IP network, should be relatively mature, the second is according to the characteristics of the KAD network, all nodes in the group form a broadcast tree, the whole Swarm is a large KAD tree, a multicast is a small KAD network (composed of nodes joined), so that the message propagates within the group, does not affect other groups, a multicast is equivalent to an IP network virtual LAN. In this way, the entire network is a large KAD tree, plus countless small KAD trees.

Drawbacks

There is no reason not to do this, only the simultaneous realization of unicast and multicast, is a complete new overlay network, will implement all kinds of applications faster and better, Swarm will truly become the cornerstone of Web3.

Here's a project, https://github.com/nknorg/nnet, that similarly implements this kind of multicast, which supports both unicast and multicast. However, the overlay network is based on Chord DHT.

zelig commented 1 year ago

This is a great proposal, I always wanted to do this.