3

In this question we have a superficial explanation of vSeeds (seednodes), from the Bitcoin wiki, we have:

DNS Addresses Upon startup, if peer node discovery is needed, the client then issues DNS requests to learn about the addresses of other peer nodes. The client includes a list of host names for DNS services that are seeded. As-of May 17, 2012 the list (from chainparams.cpp) includes:

bitseed.xf2.org
dnsseed.bluematt.me
seed.bitcoin.sipa.be
dnsseed.bitcoin.dashjr.org
seed.bitcoinstats.com

A DNS reply can contain multiple IP addresses for a requested name. Addresses discovered via DNS are initially given a zero timestamp, therefore they are not advertised in response to a "getaddr" request.

Hard Coded "Seed" Addresses The client contains hard coded IP addresses that represent bitcoin nodes. These addresses are only used as a last resort, if no other method has produced any addresses at all. When the loop in the connection handling thread ThreadOpenConnections2() sees an empty address map, it uses the "seed" IP addresses as backup.

In the Bitcoin core code base it looks like this:

// Note that of those with the service bits flag, most only support a subset of possible options
vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be", true)); // Pieter Wuille, only supports x1, x5, x9, and xd
vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me", true)); // Matt Corallo, only supports x9
vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr
vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com", true)); // Christian Decker, supports x1 - xf
vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch", true)); // Jonas Schnelli, only supports x1, x5, x9, and xd
vSeeds.push_back(CDNSSeedData("petertodd.org", "seed.btc.petertodd.org", true)); // Peter Todd, only supports x1, x5, x9, and xd

When you actually go to those addresses in a browser you get something unintelligible, such as this:

enter image description here

All close forks of Bitcoin have them in some way including Dogecoin here:

vSeeds.push_back(CDNSSeedData("dogecoin.com", "seed.dogecoin.com"));
vSeeds.push_back(CDNSSeedData("multidoge.org", "seed.multidoge.org"));
vSeeds.push_back(CDNSSeedData("multidoge.org", "seed2.multidoge.org"));
vSeeds.push_back(CDNSSeedData("doger.dogecoin.com", "seed.doger.dogecoin.com"));

and here Litecoin:

vSeeds.push_back(CDNSSeedData("loshan.co.uk", "seed-a.litecoin.loshan.co.uk", true));
vSeeds.push_back(CDNSSeedData("thrasher.io", "dnsseed.thrasher.io", true));
vSeeds.push_back(CDNSSeedData("litecointools.com", "dnsseed.litecointools.com"));
vSeeds.push_back(CDNSSeedData("litecoinpool.org", "dnsseed.litecoinpool.org"));
vSeeds.push_back(CDNSSeedData("koin-project.com", "dnsseed.koin-project.com"));

The question is, what are they exactly, i.e. what data do they provide, in what format? How are they configured?

Would I be able to create seednodes out of docker containers for a new network?

What tools could I use to query those nodes listed earlier?

Does anyone have a reference implementation for one of these?

3

Couple of points covering what it is and how it works:

  • The description might be out of date. You'd need to follow the code to see how seeding is done. E.g. IRC seeding is not used any more (but that is noted).

  • Those addresses are DNS seeds. They run a DNS name server which is usually used to translate website names (like www.google.com) to IP addresses (eg 123.123.123.321). They've made the code such that those DNS server instead of returning IP addresses of servers return the IP addresses of bitcoin nodes.

  • DNS operates on port UDP port 53 (and TCP) so you would not expect anything when browsing to those DNS seeds.

  • This is done by running special software that aims to find nodes on the network. It keeps track of nodes that are consistently available and serves those randomly in response to DNS requests.

  • When a new node comes on line it will not have a history of peers it previously connected to and will contact these DNS seeds to obtain addresses of random nodes to connect to.

  • The next time a node starts up it will connect to peers it previously connected to (rather than DNS seeds). If it can't connect to any it will retry the DNS seeds.

  • Nodes that are connected to existing nodes also share details of nodes they are connected to.

  • A seed node is typically a last resort. It's a hard coded node IP that is running the node software that uses the standard (or near standard) bitcoin protocol to talk to nodes connecting to it. This is not using DNS. This may be a last resort node to connect to if other options fail.

To implement your own for your altcoin you'd need to replicate this infrastructure. You could just start with a fixed IP node(s) on your network but to enable decentralisation a couple of independently run DNS seeds are probably a good idea.

The crawler / DNS seed software would need to be adapted to understand the communication protocol of your coin to find all nodes in your network.

  • thanks for this awesome answer! Could I make those nodes docker containers running on my local machine or a raspberry pi to start with? – smatthewenglish May 11 '17 at 13:40
  • I don't see why not, but to aid decentralisation you should probably add get others to host them as well. – Louis May 11 '17 at 14:53
  • yeah I think I'll do that, but just in the very beginning I'll have them on docker containers on my own machine, then raspberry pis I guess and then later I'll deploy it on real machines. do you know of any reference implementation of what one of those looks like? – smatthewenglish May 11 '17 at 15:47
  • 1
    I linked code for the bitcoin dns seeder in the answer. – Louis May 11 '17 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.