Peer Discovery Mechanisms
Currently, nodes join the peer-to-peer network using bootstrap nodes (addresses are hardcoded in the chainspec).
- vulnerable to man-in-the-middle attacks
- useful for development purposes (because of simple testing and setup)
Each node maintains a topology consistsing of the set of nodes that are known to be part of the network. Each topology is cached on the local disk and loaded upon startup.
Every node tracks the reputation of its peers locally according to iterative Kademlia queries on random node IDs. See current reputation algorithm here.
There are a few problems with Kademlia in the context of Substrate:
- network control centralizes in very few (maybe 20) nodes
- The libp2p Kademlia system has a two additional messages,
ADD_PROVIDER
andGET_PROVIDER
, which entail querying the peers closest to a key (in this case, the hash of the chain identifier) to store the topology.
- The libp2p Kademlia system has a two additional messages,
- bootstrap nodes can only connect to a limited number of other nodes
- A freshly-created node with an empty topology needs to be able to connect to boostrap nodes; otherwise it is incapable of joining the network. If all bootstrap nodes are full, such a node would be denied entry.
- Kademlia discovery mechanism is vulnerable to Eclipse Attacks (similar to Ethereum)
Possibly two approaches to solving these problems (according to the aforementioned post in Parity forum)
- establish strong, trusted, durable links between nodes
- more easy to attack, but purportedly necessary for Polkadot to function
- weak short-lived anonymous links based on randomness
The Discovery Protocol enables us to build a partial view of the network that we'll use for gossiping.
- A discovery mechanism for the nodes of the global network.
- A gossiping system for nodes to notify when they want to join or leave a specific network. This lets each node build a partial view of the chains it wants to be connected to.
- An overlay-network-building gossiping system for each per-chain network.
- rendezvous seeks to solve (1) and (2)
- gossipsub seeks to solve (2) and (3)
-
attempt by Dean Eigenmann to bootstrap nodes in a decentralized manner by using the blockchain to coordinate peer discovery
-
tomaka (pierre) tweet: ~"the base layer is still very centralized"