Bitcoin Forum
June 16, 2021, 04:20:34 PM *
News: Latest Bitcoin Core release: 0.21.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How do clients and miners know who is on the network?  (Read 1024 times)
tomwoods
Newbie
*
Offline Offline

Activity: 33
Merit: 0



View Profile
March 19, 2014, 02:27:36 AM
 #1

I'm looking into developing a javascript client p2p network. Most P2P networks I've looked into need to communicate with a connection broker in order to discover what other clients are in the network. Even bittorrent clients, need tracker servers.

How is it that the bitcoin network resolves this?

How does a client know what IPs to download the blockchain from?

How do miners know the IPs of other miners in the network?


If you can point me in the right direction to look up this information I would be most thankful
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
1623860434
Hero Member
*
Offline Offline

Posts: 1623860434

View Profile Personal Message (Offline)

Ignore
1623860434
Reply with quote  #2

1623860434
Report to moderator
goatpig
Legendary
*
Offline Offline

Activity: 2898
Merit: 1204

Armory Developer


View Profile
March 19, 2014, 07:56:55 AM
 #2

There were plans to change that so im not sure if that was changed yet but at first the bitcoin core client would retrieve peers from a freenode irc channel.

jl2012
Legendary
*
Offline Offline

Activity: 1792
Merit: 1010


View Profile
March 19, 2014, 08:22:39 AM
 #3

https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
benjyz
Full Member
***
Offline Offline

Activity: 140
Merit: 100


View Profile
March 19, 2014, 12:48:08 PM
 #4

There is a DNS seed. here are the code parts:

https://github.com/bitcoin/bitcoin/blob/334bd22e75b1955b3dfefbf4f5e065afdbc46ae4/src/net.cpp#L1197
https://github.com/bitcoin/bitcoin/blob/b8d9058a4d1ce28eefa65aa3339bcc52b3c014e9/src/chainparams.cpp#L143

In the beginning there was an IRC channel. torrent is different in that there are many torrents, and not every node has all torrents. whereas in bitcoin every node has the one and only blockchain. it's true that bitcoin is quite similar to torrent.

a correction: in bitcoin there are only nodes (fully P2P). there is no concept of a miner per se.

there were some recent changes to make this not reliant on DNS.

see also:
https://github.com/bitcoin/bitcoin/pull/3875
http://bitcoin.stackexchange.com/questions/14410/how-does-bitcoin-find-peers
http://getaddr.bitnodes.io/
jimmyscratchlab
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
March 20, 2014, 12:41:13 PM
 #5

I'm looking into developing a javascript client p2p network.

Using WebRTC?
tomwoods
Newbie
*
Offline Offline

Activity: 33
Merit: 0



View Profile
May 13, 2014, 04:43:34 PM
 #6

Thank you all very much. All responses have been very useful.

From what I see,  although the network is decentralized, the initial list of nodes has to come from somewhere. From the code, I gather it has a list of initial seed nodes to download updated lists from. I assume that it is important for the integrity of the network that these hardcoded seed nodes are not compromised or can't easily become subject to persecution from hostile goverments / agents.

The link to the Satoshi Client Node Discovery also gives very good ideas. Thanks.

Using WebRTC?

Yes.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1011


Gerald Davis


View Profile
May 13, 2014, 04:47:10 PM
Last edit: May 13, 2014, 04:59:56 PM by DeathAndTaxes
 #7

From the code, I gather it has a list of initial seed nodes to download updated lists from. I assume that it is important for the integrity of the network that these hardcoded seed nodes are not compromised or can't easily become subject to persecution from hostile goverments / agents.

Not really.  They could all be taken down tomorrow and existing nodes would be unaffected.  New nodes would have difficulty bootstraping but that could be worked around temporarily by having new users manually adding known nodes to the config file.  All a new node needs is a few nodes to connect to as part of the connection handshake involves both nodes sharing their list of known nodes.   So if you known 3 or 4 nodes, you soon know thousands.  All networks have to be bootstrapped in some way.  Of course the goal would be to ensure there are enough bootstraps (both in dns seeds and hardcoded nodes) to make disrupt nearly impossible.

In addition to the dns seeds there is a list of very active high uptime nodes which are hardcoded to the client
https://github.com/bitcoin/bitcoin/blob/b8d9058a4d1ce28eefa65aa3339bcc52b3c014e9/src/chainparams.cpp#L21

This list is updated from version to version.  Peers are monitored to find the ones with the most connections, uptime, and synced bandwidth.  This ensures that even if the dns seeds are offline, new nodes can always find a few reliable, well connected nodes.  Maintain good uptime and large number of inbound connections and you might find your node on that list.

As for miners.  Nodes don't advertising if they are mining or not.  The network doesn't treat miners any different than other nodes.  You don't (normally) send transaction to a miner.  You just relay them to your peers who relay them to their peers, etc.  Within a few hops every node knows of the new transactions.
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!