Bitcoin Forum
September 24, 2018, 10:45:03 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How do blockchain nodes find each other?  (Read 365 times)
kooler1
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
November 30, 2017, 08:20:30 PM
 #1

It is well known that blockchain is decentralised and each node stores whole history of transactions (all blocks).

But when you start the node, how does it know how to connect to others to synchronise? Is there central registry of nodes (or IP addresses of nodes) that it checks?
Einax Airdrops and Bounties made easy! List your ERC-20 token
FREE
ETH markets launching soon!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537829103
Hero Member
*
Offline Offline

Posts: 1537829103

View Profile Personal Message (Offline)

Ignore
1537829103
Reply with quote  #2

1537829103
Report to moderator
1537829103
Hero Member
*
Offline Offline

Posts: 1537829103

View Profile Personal Message (Offline)

Ignore
1537829103
Reply with quote  #2

1537829103
Report to moderator
1537829103
Hero Member
*
Offline Offline

Posts: 1537829103

View Profile Personal Message (Offline)

Ignore
1537829103
Reply with quote  #2

1537829103
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1656


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
November 30, 2017, 08:31:27 PM
 #2

Bitcoin Core (the most common type of node) has 3 methods of discovering peers. First it consults an internal database of peers it knows about. For a new node, this will be empty. Then it will consult a set of servers called DNS seeders. The DNS seeders give out the IP addresses of nodes that a node can connect to. The node will connect to these nodes only temporarily to gather the IP addresses of other nodes it can also connect to. It will then connect to those nodes. Lastly, if the previous two were unavailable, the node will consult a built in list of seed nodes. It does the same thing with these seed nodes that it did with nodes returned by the DNS seeders.

kooler1
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
November 30, 2017, 08:39:33 PM
 #3

Bitcoin Core (the most common type of node) has 3 methods of discovering peers. First it consults an internal database of peers it knows about. For a new node, this will be empty. Then it will consult a set of servers called DNS seeders. The DNS seeders give out the IP addresses of nodes that a node can connect to. The node will connect to these nodes only temporarily to gather the IP addresses of other nodes it can also connect to. It will then connect to those nodes. Lastly, if the previous two were unavailable, the node will consult a built in list of seed nodes. It does the same thing with these seed nodes that it did with nodes returned by the DNS seeders.

Thanks for explanation achow101. Does it mean that DNS seeders (primary and built in) are set of "hardcoded" servers which are basically critical point of bitcoin core and if those servers won't be available whole blockchain will stop functioning (as eventually nodes won't be able to discover each other)?
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1656


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
November 30, 2017, 08:45:26 PM
 #4

Thanks for explanation achow101. Does it mean that DNS seeders (primary and built in) are set of "hardcoded" servers which are basically critical point of bitcoin core and if those servers won't be available whole blockchain will stop functioning (as eventually nodes won't be able to discover each other)?
No. Nodes can still discover each other without the DNS seeders. The DNS seeders can be swapped out with some other initial discovery process too.

Furthermore, as I said, nodes maintain their own internal database that persists across restarts of nodes that it can connect to. So it will use those nodes instead of the DNS seeders on all starts after the first start. For new nodes, new nodes will fall back to the hundreds of hard coded seed nodes.

Lastly, nodes can be added manually too.

kooler1
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
November 30, 2017, 08:48:19 PM
 #5

Thanks for explanation achow101. Does it mean that DNS seeders (primary and built in) are set of "hardcoded" servers which are basically critical point of bitcoin core and if those servers won't be available whole blockchain will stop functioning (as eventually nodes won't be able to discover each other)?
No. Nodes can still discover each other without the DNS seeders. The DNS seeders can be swapped out with some other initial discovery process too.

Furthermore, as I said, nodes maintain their own internal database that persists across restarts of nodes that it can connect to. So it will use those nodes instead of the DNS seeders on all starts after the first start. For new nodes, new nodes will fall back to the hundreds of hard coded seed nodes.

Lastly, nodes can be added manually too.

Ah, ok. Thanks for clarification!
hopeAo
Jr. Member
*
Offline Offline

Activity: 42
Merit: 1


View Profile
December 02, 2017, 03:17:48 PM
 #6

It is well known that blockchain is decentralised and each node stores whole history of transactions (all blocks).

But when you start the node, how does it know how to connect to others to synchronise? Is there central registry of nodes (or IP addresses of nodes) that it checks?

For blockchain nodes to find each other it query the DNS using a number of "DNS seeds," which are DNS servers that provide a list of IP addresses of bitcoin nodes. Some of those DNS seeds provide a static list of IP addresses of stable bitcoin listening nodes. Some of the DNS seeds are custom implementations of BIND (Berkeley Internet Name Daemon) that return a random subset from a list of bitcoin node addresses collected by a crawler or a long-running bitcoin node. The Bitcoin Core client contains the names of five different DNS seeds. The diversity of ownership and diversity of implementation of the different DNS seeds offers a high level or reliability for the initial bootstrapping process. In the Bitcoin Core client, the option to use the DNS seeds is controlled by the option switch -dnsseed.





achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1656


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
December 02, 2017, 06:20:35 PM
 #7

Some of those DNS seeds provide a static list of IP addresses of stable bitcoin listening nodes.
None of the DNS seeders provide a static list of IP addresses. They all provide a random subset of IPs that are gathered by a crawler. It is against Bitcoin Core's DNS Seeder policy to have a seeder that returns static addresses.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!