Cannot resolve bootnodes' libp2p multiaddr(`/dnsaddr`) in chainspec
Is there an existing issue?
- [X] I have searched the existing issues
Experiencing problems? Have you tried our Stack Exchange first?
- [X] This is not a support question.
Description of bug
libp2p supports /dnsaddr multiaddr(s) by looking up TXT records in DNS. https://github.com/multiformats/multiaddr/blob/master/protocols/DNSADDR.md
I assumed that https://github.com/paritytech/substrate/issues/7811 made it possible to use multiaddr. However, Substrate returns errors when /dnsaddr is defined in chainspec's bootnodes list.
Error: Input("Error parsing spec file: Peer id is missing from the address at line 7 column 3")
Steps to reproduce
-
Register TXT record
_dnsaddr.{domain name}and value isdnsaddr=/ip4/{ip address}/tcp/30333/p2p/{parachain node identity} -
Make sure libp2p-lookup works
$ libp2p-lookup direct --address /dnsaddr/{domain name}
Lookup for peer with id PeerId("{Actual Peer Identity}") succeeded.
...
- Add
/dnsaddrto raw chain spec json
{
"bootNodes": [
"/dnsaddr/{domain name}"
],
...
- Pass json file to Substrate
--chainargs
We have the custom MultiaddrWithPeerId in Substrate. This requires that you have a multi-address that has a peer id attached. A lot of our code currently "requires" that we already know the peer id. We would probably need to change the code to first resolve the peer ids. However, I don't know how to do this actually. @kpp @tomaka do you maybe know if we can resolve a multiaddr that starts with dnsaddr to some "normal" multiaddr? (I mean it is done somewhere in libp2p, I just don't know how complicated it is to do this from the outside)
This is an expected behavior. There could be multiple records associated with the provided dnsaddr, section #suffix-matching says how to match against peer id in order to get the right record. Even ipfs has to specify p2p|ipfs peer id in their list of bootstrap nodes.
@bkchr do we need a different approach? Something like resolve -> get list of nodes -> add to bootstrap list?
@bkchr do we need a different approach? Something like
resolve -> get list of nodes -> add to bootstrap list?
Sounds correct to me.