js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

Saving previously seen nodes for later bootstrapping

Open lidel opened this issue 7 years ago • 3 comments

Version: N/A

Type: Enhancement

Severity: Medium

Description:

IPFS Node should persist a list of currently connected peers periodically, so the next time it starts it can use previously working peers in addition to centralized bootstrap nodes.

This is especially important in web browser context, where discovery often relies on centralized signaling servers. Having a ready-to-use cache of known-to-work peers would improve startup performance in those contexts and act as an additional tool for achieving connectivity magic (#1459).

References:

  • This is js-ipfs version for original issue from https://github.com/ipfs/go-ipfs/issues/3926:

    Bootstrap nodes built into ipfs client don't seem to work for me at all. Had to find and add some manually. Generally having so centralized bootstrap system for otherwise decentralized network is its weakness: https://github.com/ipfs/go-ipfs/issues/3908 Should ipfs automatically save all the nodes it seen and the time of last seen, to clean out the list later? That should make the bootstrapping more reliable and truly decentralized.

  • Prior art: Torrent clients persist things like DHT routing tables between restarts to improve performance, eg. aria CLI https://linux.die.net/man/1/aria2c:

    By default, the routing table of IPv4 DHT is saved to the path $HOME/.aria2/dht.dat and the routing table of IPv6 DHT is saved to the path $HOME/.aria2/dht6.dat.

lidel avatar Aug 12 '18 13:08 lidel

Ideas being discussed in https://github.com/libp2p/go-libp2p-kad-dht/issues/254

lidel avatar Feb 15 '19 16:02 lidel

I think https://github.com/ipfs/go-ipfs/issues/3926#issuecomment-1067246366 applies to js-ipfs as well.

lidel avatar Mar 14 '22 20:03 lidel

This sounds a lot like the libp2p persistent peer store, right? It's enabled by default in node and the browser.

libp2p emits all known peers at startup which should trigger auto-dial means we'd connect to them, up to the max connections threshold.

Is it not working as intended?

achingbrain avatar Mar 15 '22 07:03 achingbrain

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterwards (see https://github.com/ipfs/js-ipfs/issues/4336).

Handing this off to @achingbrain to see how to handle moving forward.

SgtPooki avatar May 26 '23 18:05 SgtPooki

libp2p has a persistent peer store, and peers are selected from the store to be dialled on start up so I think this can be closed.

The other issue is reloading the KAD buckets which is tracked here: https://github.com/libp2p/js-libp2p-kad-dht/issues/109

achingbrain avatar May 31 '23 16:05 achingbrain