Author

Topic: DNS Bootstrap/Addnode Logic (Read 1237 times)

legendary
Activity: 1596
Merit: 1100
December 06, 2012, 02:13:22 PM
#4

  • Your local peers.dat file
  • Ask other peers
  • Query DNS
  • Use hardcoded list, compiled into client

Thanks Jeff.  The hardcoded list, are those IPs or host names?

IP addresses.  But that hardcoded list, as you might imagine, gets out of date fairly quickly.

Typically an empty node with an empty peers.dat file gets most of its initial addresses from DNS.

After that, most addresses come via peer exchange, from talking to other nodes.

Quote
Sorry for such basic questions, I know the code is out there but I'm not a developer so I probably wouldn't know what I'm looking at.  I'm working on a project and want to be sure the peer finding process is as robust as possible when bitcoind starts up the very first time on a new client.  As I understand things, items 1 and 2 in the above list won't do anything the first time bitcoind starts up since there's no data there.  Item 3 will only work if DNS is functioning correctly.  Please correct me if I'm wrong.

That is correct.  But let's emphasize that this is the first time startup, so that other readers are not confused.

Too many people focus on the bootstrapping process, when normally most peer addresses come from your local database or other nodes.


member
Activity: 74
Merit: 10
December 06, 2012, 01:22:08 PM
#3

  • Your local peers.dat file
  • Ask other peers
  • Query DNS
  • Use hardcoded list, compiled into client

Thanks Jeff.  The hardcoded list, are those IPs or host names?

Sorry for such basic questions, I know the code is out there but I'm not a developer so I probably wouldn't know what I'm looking at.  I'm working on a project and want to be sure the peer finding process is as robust as possible when bitcoind starts up the very first time on a new client.  As I understand things, items 1 and 2 in the above list won't do anything the first time bitcoind starts up since there's no data there.  Item 3 will only work if DNS is functioning correctly.  Please correct me if I'm wrong.
legendary
Activity: 1596
Merit: 1100
December 04, 2012, 04:47:03 PM
#2
The internal, in-memory peer address database reads from several sources (in decreasing priority order):

  • Your local peers.dat file
  • Ask other peers
  • Query DNS
  • Use hardcoded list, compiled into client

The logic for finding peer addresses should be considered separate and independent of the logic used for connecting to other peers.

Addnode will always attempt to connect to the peer specified with -addnode, and it does not care what is in the in-memory address database.

Similarly, -connect does not care about the address database.  -connect always connects to the specified peer.

member
Activity: 74
Merit: 10
December 04, 2012, 01:38:06 PM
#1
Trying to understand how addnode logic works.  I know recent bitcoind uses DNS for bootstrap.  If one uses addnode to specify a host to connect to does bitcoind always try to connect to that host or does it only connect if the DNS bootstrap fails?  If there are multiple addnodes specified does it try them in order until it succeeds or does it always try all of them?  Thanks for your help.
Jump to: