Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

Opposite part of sipa/bitcoin-seeder#36.
Including new testnet seed that supports filtering.

Required for SW #7910.

@petertodd
Copy link
Contributor

Concept ACK, but I think it'd be simpler to have this be based on a bitmask rather than service-specific letters.

@jonasschnelli
Copy link
Contributor Author

Yes. Agreed. Will change it to a bitmask. Maybe a hex representation of the uint64_t as subdomain.

@TheBlueMatt
Copy link
Contributor

Do we actually connect to DNS Seeds, or is it only for Tor where we connect to them, get a list of addresses, and then immediately disonnect?

@sipa
Copy link
Member

sipa commented May 23, 2016 via email

@jonasschnelli
Copy link
Contributor Author

jonasschnelli commented May 24, 2016

Updated this PR and sipa/bitcoin-seeder#36 to support non-bitflags-to-string mapping.
Now, node-filtering via dnsseed is possible with a bitmap-filter-hex-string as subdomain.

Example:
dig A 5.testnet-seed.bitcoin.jonasschnelli.ch (filter = 5 == 0101) will return only nodes with NODE_NETWORK and NODE_BLOOM service flags set.
dig A d.testnet-seed.bitcoin.jonasschnelli.ch (filter = d == 1101) will return only nodes with NODE_NETWORK, NODE_BLOOM and NODE_WITNESS service flags set.

A bar main domain query will still result with the default NODE_NETWORK filter:
dig A testnet-seed.bitcoin.jonasschnelli.ch

@petertodd
Copy link
Contributor

RBF nodes! dig A 4000001.testnet-seed.bitcoin.jonasschnelli.ch Cool!

Something I noticed was you could also query 0000000004000001.testnet-seed.bitcoin.jonasschnelli.ch instead - it'd probably be a good idea to fail the query if there are any leading zeros, to maximally ensure that everyone uses the same queries whenever possible - better for privacy, and a few less bytes on the wire.

@gmaxwell
Copy link
Contributor

RFC 952 did not permit hostnames to begin with a number. This has since been relaxed but many implementations still manage to screw this up (treating the names that begin with numbers as IP addresses), it might be better to begin the mask with a x, and also require it to be zero extended so that caching isn't degraded by clients using x00000005 vs x5.

@arowser
Copy link
Contributor

arowser commented May 25, 2016

Can one of the admins verify this patch?

@jonasschnelli
Copy link
Contributor Author

@gmaxwell: Good point.
I just force pushed a change that will require a leading x for the query subdomain.
dig A x5.testnet-seed.bitcoin.jonasschnelli.ch for NODE_BLOOM, etc.

leading zeros will be ignored: dig A x0005.testnet-seed.bitcoin.jonasschnelli.ch also results in a NODE_BLOOM filter.

@sipa
Copy link
Member

sipa commented May 25, 2016 via email

@jonasschnelli
Copy link
Contributor Author

@sipa: Good point.
Update the seeder PR to ignore/reject leading zeros.
Rejecting = reply with standard NODE_NETWORK filter (same behavior as before this PR).
https://github.com/sipa/bitcoin-seeder/pull/36/files#diff-118fcbaaba162ba17933c7893247df3aR263

@sipa
Copy link
Member

sipa commented May 25, 2016

How will you pass in the required flags to addrman?

I was imagining something simpler here, where a DNSSeedData struct just has a hostname and a servicebits value. For hosts where it is supported, we use ("x9.seeder.host.tld", 9), for others we use ("seeder.host.tld", 1).

@jonasschnelli
Copy link
Contributor Author

@sipa: Right. The code is currently pretty much unused.
At the moment, what we want is filter for NODE_NETWORK (which is the default). This results in not using the x.seed filter.

However, this will be required for SW and I though instead of extending the SW PR, try to get this into master because it can be useful anyways.

This also adds a testnet seed (last weekend only one testnet seed was running).

@laanwj
Copy link
Member

laanwj commented May 30, 2016

utACK 2d83013

what we want is filter for NODE_NETWORK (which is the default)

I think there's something (for consistency / future-proofness) to be said for always using filtering when the seed supports this, even to just request NODE_NETWORK, instead of relying on a default being the same server-side.

Though this would remove the flexibility for the DNS seed operator to change the default and have everyone use that by default, if that turns out to be necessary - which has been discussed in the context of segwit. So I'm not sure.

@laanwj
Copy link
Member

laanwj commented Jun 8, 2016

What is there to be done here?

@sipa
Copy link
Member

sipa commented Jun 8, 2016

utACK 2d83013

@sipa sipa merged commit 2d83013 into bitcoin:master Jun 8, 2016
sipa added a commit that referenced this pull request Jun 8, 2016
…ebits

2d83013 Add support for dnsseeds with option to filter by servicebits (Jonas Schnelli)
codablock pushed a commit to codablock/dash that referenced this pull request Dec 22, 2017
… servicebits

2d83013 Add support for dnsseeds with option to filter by servicebits (Jonas Schnelli)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
… servicebits

2d83013 Add support for dnsseeds with option to filter by servicebits (Jonas Schnelli)
Fuzzbawls added a commit to PIVX-Project/PIVX that referenced this pull request Mar 27, 2020
…servicebits

9a364e1 Add support for dnsseeds with option to filter by servicebits (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#8083

  This adds the ability to filter DNS seed requests by service bit, but does not actually implement any filtering other than the default `NODE_NETWORK` (for now). Further related upstream backports will follow.

ACKs for top commit:
  random-zebra:
    ACK 9a364e1
  furszy:
    ACK 9a364e1

Tree-SHA512: cc95d042a8144e31a10e58ed02460cfb2d1801f91c4f988b3e3ae5a5bdf2537c1ffc7ea3c736dabd998d369761bef54863b8aa1e27ad8bdf8ece72f121a1ca31
akshaynexus added a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this pull request Mar 30, 2020
…o filter by servicebits

9a364e1 Add support for dnsseeds with option to filter by servicebits (Jonas Schnelli)

Pull request description:

  Backport of bitcoin#8083

  This adds the ability to filter DNS seed requests by service bit, but does not actually implement any filtering other than the default `NODE_NETWORK` (for now). Further related upstream backports will follow.

ACKs for top commit:
  random-zebra:
    ACK 9a364e1
  furszy:
    ACK 9a364e1

Tree-SHA512: cc95d042a8144e31a10e58ed02460cfb2d1801f91c4f988b3e3ae5a5bdf2537c1ffc7ea3c736dabd998d369761bef54863b8aa1e27ad8bdf8ece72f121a1ca31
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants