Use IPv4-encoded IPv6 address to get IPv4 node address with port number from DNS seeds #30900

issue 1440000bytes openend this issue on September 13, 2024
  1. 1440000bytes commented at 5:35 pm on September 13, 2024: none

    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

    Example: Port 39388 is used by more than 1000 nodes

    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

    Non-default ports are supported in automatic connections since v23.0: #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:

    #23542 (comment)

    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:

    0| 80 bits                          | 32 bits         | 16 bits |
    1|----------------------------------|-----------------|---------|
    2| 0000 0000 0000 0000 abcd (prefix)| IPv4 Address    | Port    |
    

    Python script to encode and decode: https://gitlab.com/-/snippets/3746764

     01. Encode
     12. Decode
     23. Exit
     3Enter your choice: 1
     4Enter IPv4 address: 127.0.0.1
     5Enter port number: 8080
     6Encoded IPv6: 0000:0000:0000:0000:abcd:7f00:0001:1f90
     71. Encode
     82. Decode
     93. Exit
    10Enter your choice: 2
    11Enter the encoded IPv6 address: ::abcd:7f00:1:1f90
    12Decoded Data (IPv4, Port): 127.0.0.1, 8080
    

    I am using clouflare for DNS and tested this on a domain:

    image

    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

  2. 1440000bytes added the label Feature on Sep 13, 2024
  3. petertodd commented at 8:52 pm on September 16, 2024: contributor

    NACK

    The purpose of the DNS seeds is just to find some bootstrap nodes. More addresses are then learned from those bootstrap nodes, and additional connections are made to them. There’s no need for the initial bootstrap nodes to be sampled from the entire set of possible nodes.

  4. 1440000bytes commented at 9:29 pm on September 16, 2024: none

    The purpose of the DNS seeds is just to find some bootstrap nodes. There’s no need for the initial bootstrap nodes to be sampled from the entire set of possible nodes.

    I disagree. @cdecker’s DNS seed was recently removed from bitcoin core because it did not return enough nodes for bootstrapping. It was noticed that @luke-jr’s DNS seed returned only nodes with older version and now it only returns newer versions.

    Such results violate 1 and 2 mentioned in DNS seed policy and even if the policy is useless, they do affect the bootstrapping process used for a decentralized network.

    If most nodes start using non-default ports for various reasons, including government censorship, DNS seeds may become irrelevant.

  5. petertodd commented at 10:08 pm on September 16, 2024: contributor

    @1440000bytes As you can see by clicking through to the removal pull-req, the problem wasn’t “insufficient nodes”, it was failing to implement filtering properly: #29911

    Re: censorship, that’s just nonsense. If government is blanket censoring specific ports they can pretty much just as easily censor the DNS seeding mechanism itself. There’s no need to include complex new code for such a niche use-case - you can easily bootstrap a node by getting the IP address of any other working node and connecting to it.

  6. 1440000bytes commented at 1:52 pm on September 18, 2024: none

    @1440000bytes As you can see by clicking through to the removal pull-req, the problem wasn’t “insufficient nodes”, it was failing to implement filtering properly: #29911

    Sharing the PR rationale/description below with people who ACKed it:

    0This seeder no longer appears to be serving sufficient addresses.
    1
    2Fixes [#29911](/bitcoin-bitcoin/29911/)
    
    0ACKs for top commit:
    1  1440000bytes:
    2    ACK https://github.com/bitcoin/bitcoin/commit/c88a7dc53e3be7489605c3326cf768df5437393a
    3  virtu:
    4    ACK https://github.com/bitcoin/bitcoin/commit/c88a7dc53e3be7489605c3326cf768df5437393a
    5  mzumsande:
    6    ACK https://github.com/bitcoin/bitcoin/commit/c88a7dc53e3be7489605c3326cf768df5437393a
    7  BrandonOdiwuor:
    8    ACK https://github.com/bitcoin/bitcoin/commit/c88a7dc53e3be7489605c3326cf768df5437393a
    

    Re: censorship, that’s just nonsense.

    Governments dont act rationally and sometimes block ports: https://x.com/SimpleXChat/status/1835072004921475219

    Non-default ports were supported in v23.0 and p2p v2 is used for a reason even if ISP can identify a bitcoin node.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 00:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me