Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow resolving bootnodes through WebTorrent or IPFS #324

Open
tomaka opened this issue Mar 21, 2023 · 5 comments
Open

Allow resolving bootnodes through WebTorrent or IPFS #324

tomaka opened this issue Mar 21, 2023 · 5 comments
Labels
blocked Progress on this issue requires something beyond our control priority-low

Comments

@tomaka
Copy link
Contributor

tomaka commented Mar 21, 2023

I'm opening this issue just to keep notes of a discussion on Element with Gav.

Rather than hardcode a list of bootnodes in the chain spec, the WebTorrent DHT could be used in order to grab that list.

Full nodes that want to be bootnodes would register themselves as seeders of a dummy torrent file and publish in the WebTorrent DHT an entry containing their port, WebRTC certificate hash, and PeerId.

This is a long term issue that requires a lot of work.

See also:

@tomaka
Copy link
Contributor Author

tomaka commented Jul 10, 2023

Unfortunately, WebTorrent uses WebRTC only to connect together the browsers that want to download a torrent. The DHT doesn't use WebRTC (it's the same DHT as the regular Bittorent, so over UDP). The WebTorrent library doesn't support looking into the DHT, it only supports using a tracker over WebSocket.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 14, 2023

I've opened polkadot-fellows/RFCs#8 for parachains

@tomaka tomaka added the blocked Progress on this issue requires something beyond our control label Jul 16, 2023
@tomaka
Copy link
Contributor Author

tomaka commented Jul 31, 2023

Another possibility is IPFS, who are working on integrating WebRTC: libp2p/go-libp2p#2337

@tomaka tomaka changed the title Allow resolving bootnodes through WebTorrent Allow resolving bootnodes through WebTorrent or IPFS Jul 31, 2023
@tomaka
Copy link
Contributor Author

tomaka commented Nov 16, 2023

go-ipfs have just released experimental WebRTC support: https://github.com/ipfs/kubo/releases/tag/v0.24.0#experimental-transport-webrtc-direct

@tomaka
Copy link
Contributor Author

tomaka commented Nov 19, 2023

Unfortunately, storing the bootnodes on IPFS has a pretty big flaw: only 20 bootnodes can be stored at a time, after which new ones will be (silently) ignored.

This means that adding yourself to the list of bootnodes is first come first serve. Consequently, an attacker can try register 20 fake/malicious nodes to clog this mechanism, or even do an eclipse attack. And if they succeed, it's "forever" as long as the fake/malicious nodes don't go offline for more than 48 hours.

Additionally, this mechanism is also attackable on the IPFS side. Only the 20 DHT nodes closest to a certain key store the providers of that key. This means that an attacker can try to generate public keys until they find 20 keys closest to the one where the bootnodes are registered, then spawn malicious IPFS nodes that use these keys. If they succeed, they control the list of bootnodes.

In polkadot-fellows/RFCs#8, the DHT key at which the bootnodes are stored is rotated periodically using the relay chain randomness. This more or less solves the second problem (the IPFS-side attack). At each rotation, there is a rush to register yourself first, and who actually arrives first is random (as it depends on the way the block announce propagates and the ping time of the DHT nodes that store the record), so it more or less solves the first problem as well.
For the relay chain bootnodes, however, we don't have access to any randomness. Even if the key at which the bootnodes are registered was rotated over time, this rotation is predictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Progress on this issue requires something beyond our control priority-low
Projects
None yet
Development

No branches or pull requests

1 participant