Idea on how to improve connectivity with more restricted parts of the world (like China)

It is not a secret that GFW in particular causes a lot of issues for the network.

Even if farmers find various relays, centralized nodes and other workarounds to actually farm on the network, if they are not reachable from the outside, they are not really helping the network with storing the archival history, which is essentially what they are being paid for. I mean they do store it, but it is not helping if there is no way to retrieve it.

We’ve been thinking about things like libp2p’s DCUtR and Circuit Relay and I have something that might resemble a solution.

The primary challenge with various kinds of relays is the abuse of the network bandwidth, especially without any incentive mechanism.

I think the fact that DSN has a structured topology, it might be possible to allocate certain number of persistent connections, possibly with bandwidth limits, for relays.

The idea is the following: a peer that discovers they are behind NAT and not reachable publicly, will find some peers with peer ID close to theirs and attempt to connect to them and use them as a relay. Since the ID is close to their own, this should help with maintenance of piece cache.

When someone else tries to reach out to this peer that is not directly reachable there are essentially two options, and it is actually possible to switch between the two on the fly in libp2p to the best of my knowledge.

First, if it is possible to do hole punching through DCUtR or if the peer that wants to establish the connection is publicly reachable, then the connection can be established P2P and not cause additional strain on the relay.

Second, when above is not possible, relay will have to be used, which is unfortunate, but there is little we can do about it.

Note that due to cross-country firewalls, it is possible that P2P connection is possible in some cases, but not others, it’d be nice to somehow detect this duality and handle it appropriately.

Now that these farmers are somehow part of the network, during DSN queries, farmers that receive requests, but don’t have the pieces themselves or need pieces due to plotting process, can request pieces from these farmers. In such cases, returning pieces successfully can be used to increase the bandwidth allowance for relay purpose, since farmer is still contributing data retrieval to the network, despite not being reachable directly themselves.

At least in theory this appears to be a sound approach, despite some open questions. I think even partial application might be beneficial and improve robustness of the network. This should also further reduce the appeal of farming pools in China, where farmers might have difficulties retrieving pieces.

1 Like