Usage example of DHT random walk for discovery

The examples in the js-libp2p repo are very good and helped me to integrate libp2p quite fast. The last missing piece of my build is peer discovery. I use Bootstrap to supply nodes with some prior known nodes in the network and connection is working fine. But I’d also like the dynamic nodes to connect each other and not only to the bootstrap nodes.
If I understood correctly this is exactly what peer discovery with random walks of the DHT can do.
In the docs there is mentioned, that libp2p-kad-dht can do this, but I’m missing the necessary API information or examples to use ist for peer discovery.

How do I integrate the random walk correctly into the js config to make it work?

You can take a look at the settings in the DHT configuration section of the libp2p config readme, https://github.com/libp2p/js-libp2p/blob/v0.28.4/doc/CONFIGURATION.md#customizing-dht. The default config options for the DHT are shown there.

Thank you very much! I would recommend to link exactly this to the peer discovery example.

That’s a great suggestion, if you’d be up for submitting a PR that would be very appreciated!

Of course, I will do it.