Issue Details

Number
30900
Title
Use IPv4-encoded IPv6 address to get IPv4 node address with port number from DNS seeds
Description
### Please describe the feature you'd like to see added. Use the IPv4-encoded IPv6 addresses that start with a reserved prefix to support nodes with non-default ports in bootstrapping process. There are 7k IPv4 reachable nodes and some of them use non-default ports: ![image](https://github.com/user-attachments/assets/1135ce50-0c43-4da6-af37-4c2ee2bfe5bc) Example: Port 39388 is used by more than [1000 nodes](https://bitnodes.io/nodes/all/ports/) The scripts used in this testing guide can be helpful to discover more nodes with non-default ports: https://web.archive.org/web/20230129111013/https://github.com/bitcoin-core/bitcoin-devwiki/wiki/23.0-Release-Candidate-Testing-Guide ### Is your feature related to a problem, if so please describe it. Non-default ports are supported in automatic connections since v23.0: https://github.com/bitcoin/bitcoin/pull/23542. However, DNS seeds cannot return port numbers in DNS queries. So, the nodes with non-default port will never be a part of bootstrapping. Related discussion: https://github.com/bitcoin/bitcoin/pull/23542#issuecomment-1036384792 https://delvingbitcoin.org/t/hardcoded-seeds-dns-seeds-and-darknet-nodes/1123/8 https://njump.me/nevent1qqst405e4jwg9fwufrqrmjczxdc6desc8xsqlhzsvk7w5wk3lrlmqlczyq9288j6a7v6qq98hkctfxg43jftcj4zp7m9jvd995z4kh4kmlmns9h6j6q ### Describe the solution you'd like IPv4 address and port number can be encoded in an IPv6 address by DNS seeds. IPv6 address format: ``` | 80 bits | 32 bits | 16 bits | |----------------------------------|-----------------|---------| | 0000 0000 0000 0000 abcd (prefix)| IPv4 Address | Port | ``` Python script to encode and decode: https://gitlab.com/-/snippets/3746764 ``` 1. Encode 2. Decode 3. Exit Enter your choice: 1 Enter IPv4 address: 127.0.0.1 Enter port number: 8080 Encoded IPv6: 0000:0000:0000:0000:abcd:7f00:0001:1f90 1. Encode 2. Decode 3. Exit Enter your choice: 2 Enter the encoded IPv6 address: ::abcd:7f00:1:1f90 Decoded Data (IPv4, Port): 127.0.0.1, 8080 ``` I am using clouflare for DNS and tested this on a domain: ![image](https://github.com/user-attachments/assets/372c0359-8b1d-4935-a456-65524038b19c) IPv6 addresses are valid, AAAA for domain is resolved successfully by `getaddrinfo` and Google DNS: https://dns.google/resolve?name=test.joinstr.xyz&type=AAAA&cd=true ### Describe any alternatives you've considered - IPv4 mapped IPv6 addresses are supported based on RFC 4291 and I tested it on Cloudflare. However, you cannot add anything more than IPv4 address. https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2 - NULL and TXT records Related issues: https://delvingbitcoin.org/t/hardcoded-seeds-dns-seeds-and-darknet-nodes/1123/6 https://njump.me/nevent1qqsp9v4jxynf8k93erdl2ku3nh92ng7fwr695lvwmh0tek8k2r6fvscpp4mhxue69uhkummn9ekx7mqpz3mhxue69uhhyetvv9ujuerpd46hxtnfdupzqz4rnedwlxdqqznmmv95ny2cey4uf23qldjexxjj6p2mt6mdlaeceaxu3t
URL
https://github.com/bitcoin/bitcoin/issue/30900
Closed by
Back to List