SWIP | title | author | status | type | created |
---|---|---|---|---|---|
<To be assigned> |
Swarm node implementer spec - Hive |
Louis Holbrook <dev@holbrook.no> (https://holbrook.no) |
Draft |
Track Specs |
2019-09-14 |
This SWIP is a part of a general specification of a Swarm node. The SWIP system is used for convenience only.
Enable other implementations of the swarm node.
The connectivity driver of Swarm is named the Hive
. The component
decides which peers to make connections to by consulting the Kademlia
for known but unconnected peers, and by invoking the Discovery Protocol
to alert peers about changes in its peer database.
In Swarm, a fully connected state is referred to as Saturation.
A Proximity Bin is saturated when it has at least (2) connected peers.
A node is saturated if:
-
it is connected to all existing peers in its neighborhood
-
all Proximity Bins farther away than Depth are saturated
In the context of the Hive, the Depth
at any moment before or during a
saturated condition is called Saturation Depth
. This interpretation of
Depth
differs slightly from the Neighborhood Depth
used for routing
decisions. Specifically, it is the Proximity Order
farthest from the
Neighborhood Depth
that is not saturated. If no such bin exists,
Saturation Depth
is effectively the same as the Neighborhood Depth
.
A non-saturated node should seek connections with peers in the following order of priority:
-
the closest unconnected neighbors
-
the farthest bin that has the least connected peers
If a peer connection fails or is disconnected, the node MUST reconnect.
If the initial reconnection attempt fails, the node SHOULD exponentially increase the time it waits before retrying. The node’s reconnection attempts SHOULD stay within the minimum bounds of the algorithm:
-
If more than 42 retries have been attempted, discard the peer and do not continue
-
Caluculate the time delta since last retry
-
Calculate the number of warranted retries by subtracting (2) from the (log_2) of the time delta
-
Retry if the number of warranted retries is higher than the number of retries that has been made
N/A
N/A
N/A
Copyright and related rights waived via CC0