I was trying to automate peer discovery of my newly launched substrate network, and can't find any documentation related to that, it would be really helpful if someone can point to any available documentation or can tell how to achieve this. Automate means when I launch a new node, it will automatically connect to it's nearest node with it's IP and peer ID

  • I have also come across a similar problem. My knowledge on the topic is limited, hence my reply to this being a comment. From what I have gathered, Substrate has two discovery mechanisms: Mdns and kad dht. mDNS means any node in your local network will automatically connect to your node and sync up. With kademlia, all you need to do is connect to someone with more connections than you. Even over an external network, and Your node will automatically look through their peers and connect to good ones based on some factors. Hence this method requires a good bootstrap list
    – islami00
    Feb 18, 2022 at 2:39
  • substrate nodes should self peer if they are running on local host without needing to do any additional configuration.
    – Squirrel
    Feb 19, 2022 at 13:30

1 Answer 1


There is a lot of great content here around the networking in Substrate: https://crates.parity.io/sc_network/index.html

Discovery mechanisms

In order for our node to join a peer-to-peer network, it has to know a list of nodes that are part of said network. This includes nodes identities and their address (how to reach them). Building such a list is called the discovery mechanism. There are three mechanisms that Substrate uses:

  1. Bootstrap nodes. These are hard-coded node identities and addresses passed alongside with the network configuration.
  2. mDNS. We perform a UDP broadcast on the local network. Nodes that listen may respond with their identity. More info here. mDNS can be disabled in the network configuration.
  3. Kademlia random walk. Once connected, we perform random Kademlia FIND_NODE requests on the configured Kademlia DHTs (one per configured chain protocol) in order for nodes to propagate to us their view of the network. More information about Kademlia can be found on Wikipedia.

So really you should start with a bootstrap node, and then the other discovery mechanisms can kick in to help connect you to and diversify your nodes.

You can specify bootstrap nodes in your chain specification:

  "name": "Polkadot",
  "id": "polkadot",
  "chainType": "Live",
  "bootNodes": [
  "telemetryEndpoints": [

Or via the command line when starting a node. From --help:

--bootnodes <ADDR>...                                        
    Specify a list of bootnodes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.