Bitcoin Forum
May 25, 2024, 03:47:21 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How do nodes connect to each other?  (Read 155 times)
GlowingGypsie (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
October 20, 2019, 01:23:20 PM
 #1

Clients connect to SeedDNS and connect to nodes but how do nodes connect to each other?
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
October 20, 2019, 01:29:59 PM
Merited by hugeblack (1)
 #2

Bitcoin node software comes with a predetermined list of nodes that should be avaliable when the software is run.

After the initial run, the software asks those nodes for a list of recommended nodes (which has to be less than 1000) it adds these modes to peers.dat and picks the fastest few to connect to (normally 8 or so) it wants the one with the longest chain too so that it knows its up to date. So if a node has a lower speed but a longer chain it may download the next block from it and connect to it rather than the fastest node in order to stay up to date...

When the node is turned on again, it scans its peers.dat and checks the connections that are still active from it.
GlowingGypsie (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
October 20, 2019, 02:58:15 PM
 #3

I have two clients on the same wifi network and they connect to each other via IPv4 and IPv6 how the hell is that possible?
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
October 20, 2019, 03:12:09 PM
Merited by hugeblack (1)
 #4

I have two clients on the same wifi network and they connect to each other via IPv4 and IPv6 how the hell is that possible?

If they both have the longest chain or one has a chain longer than the other then they are the fastest for a connection. Every so often other nodes they are connected to might get pinged too.

Generally if you have a fast switch/modem the lung speed should be less than 1ms and the rate data can be transferred at between them should obviously be higher.

I'm not sure if there's something bitcoin core uses that scans the home network for anything that it can connect to (it'd normally just have to ping 192.168.0.255 for a response from anything that can accept a connection and understand the packet sent to it).
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
October 20, 2019, 03:14:55 PM
 #5

I have two clients on the same wifi network and they connect to each other via IPv4 and IPv6 how the hell is that possible?

if they are actually connected over the internet (not through any other way) then it is not surprising really. every client has an IP address that it broadcasts to others as it connects to any other node through a version message. then others send its IP to other nodes and that way it propagates. so your other client eventually finds out about that IP, most likely right away if both are connected to same node(s) and attempts connecting to that IP.

There is a FOMO brewing...
GlowingGypsie (OP)
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
October 20, 2019, 03:28:42 PM
 #6

Just weirded me out that Client A has an IPv4 and IPV6 and so does Client B. In client A i can see two IPs one v4 and v6 and both belong to client B and the same at client B I can see clients A v4 and v6 IPs. Why using both v4 and v6?
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
October 20, 2019, 03:51:51 PM
 #7

Why using both v4 and v6?

it is a networking thing, not everyone has adopted IPV6 yet (in fact according to google only 26% of the world is using it right now) but it is recommended to move to V6 because of V4 exhaustion, so if you have it you must advertise that but to let those who don't have it you must also advertise V4.
i believe what bitcoin does is that it mapps all IP addresses to V6 so it can show you both at the same time.

There is a FOMO brewing...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!