3

I am wondering how nodes discover other nodes and miners, basically, who to broadcast received transactions and blocks to. I'm assuming that when a new node or miner wants to be discovered, it broadcasts to all known nodes informing them that its a new node or miner. Then the node puts the node or miner on a list of IP addresses, to broadcast transactions and blocks accordingly.

What part did I get wrong?

1 Answer 1

6

I am wondering how nodes discover other nodes

Nodes learn about other nodes through:

  • DNS seeds (which run crawlers that maintain databases of network nodes)
  • From their peers (nodes gossip IP addresses of other nodes to each other)
  • From their own database of nodes (which is fed by the above two mechanisms)
  • From a hardcoded list built-in to the client, as a final fall back.

and miners

Miners are just nodes like all others; there is nothing special about them in this regard.

basically, who to broadcast received transactions and blocks to.

To clarify:

  • Nodes make connections to other nodes; this is what needs to be discovered. Every node makes a few random connections to other nodes, not to everyone in the network.
  • Nodes broadcast transactions and blocks (and IP addresses of other nodes) to these peers, not to everyone.

Eventually everyone will hear about every block, and most transactions, because everyone is connected to one another.

I'm assuming that when a new node or miner wants to be discovered, it broadcasts to all known nodes informing them that its a new node or miner.

It just rumors its IP address to its peers. Those peers will put the node's IP address in their peer database, and gossip it further to their peers. Over time, more and more nodes will learn about it.

Then the node puts the node or miner on a list of IP addresses, to broadcast transactions and blocks accordingly.

Nodes only ever communicate with their own peers (typically 8-10 outgoing connections, up to a few 100 incoming ones), but they can maintain databases of IP addresses with 10s of thousands of nodes. Most of those will never be connected with, but may be rumoured to others.

3
  • Could you explain how DNS seeding works? Commented Jul 3, 2023 at 7:17
  • @CJ-Programmer Very simply, it's a domain name that runs a custom DNS server which replies to every query with a number of "good" random IP address in the crawler's database. So if you resolve dnsseed.emzy.de for example, you get the IP address of a Bitcoin node that Emzy's crawler believes is decent. Commented Jul 4, 2023 at 13:08
  • Ah I see. Thanks for the knowledge! Commented Jul 7, 2023 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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