LibP2P on the Polkadot Network

I’m looking to build a DHT crawler for Polkadot.

A few month ago, I chatted with one of the devs, Pierre, and he mentioned that I might have to set the user-agent to a string that contains “substrate”. I’ve tried to connect to the network but i’m not getting a response. I’m using a boot node gotten from the Polkadot Source:

Has anyone got a connection working to the Polkadot network through LibP2P? Has anything changed, maybe some new network ID?


I don’t know why it doesn’t show up in your GitHub search (maybe because the file is too large), but Polkadot’s bootnodes are listed here:
(and for future reference, chain specs will be here)

Whatever happens, the connection initiation consists of secio and mplex/yamux, and that should be totally compatible with go-libp2p and js-libp2p.

Afterwards, however, you node will get disconnected if:

  • It doesn’t support ping or identify.
  • The response from identify doesn’t contain the string “substrate” (to prevent IPFS nodes from connecting).

Thanks Pierre,

Do you know of any existing code that uses LibP2P (either NodeJs or GoLang) that is connecting to Substrate? I’m able to connect to IPFS but still unable to connect to the substrate network. It looks like that some of the libraries like (NodeJs multiaddr) might be built for IPFS only.

I was able to ping the IPFS bootnodes but when I just try to ping (using the standard setup provided by libp2p tutorial) the Substrate bootnodes, I get either one of two errors:

When pinging /ip4/
The response is:

pinging remote peer at  /ip4/
error pinging:  { Error: No available transports to dial peer QmPiGU1jwL9UDw2FMyMQFr9FdpF9hURKxkfy6PWw6aLsur!

When Pinging: /ip4/

pinging remote peer at  /ip4/
error pinging:  Error: dialed to the wrong peer, Ids do not match

My config:

    transport: [
    connEncryption: [
    streamMuxer: [

Looks like the multiaddr library is converting all p2p protocol into ipfs not sure if that’s intentional and if that’ll work for the substrate network.

If you can point me to some reference code (go/node) for connecting to Substrate using libP2P that would be very helpful.


Commented over at Multiaddr shouldn’t be an issue. It looks like the BootNodes from the config aren’t available as TCP is getting an ECONNREFUSED error.

  libp2p:tcp:dial Connecting to 30363 +21s
  libp2p:switch:dialer:queue:error TCP:work { Error: connect ECONNREFUSED
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '',
  port: 30363 } +11s

It looks like the Alexander bootnodes are now down, indeed. We’re preparing to launch Kusama soon, so the devops team has probably stopped the old bootnodes.

In the meanwhile you should be able to try to connect to Flaming Fir, the Substrate testnet:
However, it is not unlikely that we kill it soon as well!

Thanks Pierre,

I’m trying the new bootnodes that you mentioned and I’m getting a lot of :

pinging remote peer at  /ip4/
error pinging:  Error: dialed to the wrong peer, Ids do not match

Jacob mentioned that this is most likely: node has connected but SECIO failed due to the actual ID is not matching the ID that was passed in. Any clue on why this would be the case?


Oh, I suspect that what happens is that the public key’s format is secp256k1, which the Go and Js implementations don’t support.

We’re switching to ed25519, which Go and Js might support?
If you spawn your own Substrate (or Polkadot) node, its network key will be ed25519 by default.

Hey Pierre,

Just to follow up on this, do you know roughly when the GoLang or JS implementations will be able to support this? We are working on one of the grant projects and we have finished 2/3 milestones and we need to get the DHT crawler working for the final step to complete the project


I am not involved in the Go or JS implementations.
As for Polkadot, we should be deploying Kusama soon, which will use ED25519 keys.