<blockquote>
<p>I am wondering how nodes discover other nodes</p>
</blockquote>
<p>Nodes learn about other nodes through:</p>
<ul>
<li>DNS seeds (which run crawlers that maintain databases of network nodes)</li>
<li>From their peers (nodes gossip IP addresses of other nodes to each other)</li>
<li>From their own database of nodes (which is fed by the above two mechanisms)</li>
<li>From a hardcoded list built-in to the client, as a final fall back.</li>
</ul>
<blockquote>
<p>and miners</p>
</blockquote>
<p>Miners are just nodes like all others; there is nothing special about them in this regard.</p>
<blockquote>
<p>basically, who to broadcast received transactions and blocks to.</p>
</blockquote>
<p>To clarify:</p>
<ul>
<li>Nodes make <em>connections</em> 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.</li>
<li>Nodes broadcast transactions and blocks (and IP addresses of other nodes) to these peers, not to everyone.</li>
</ul>
<p>Eventually everyone will hear about every block, and most transactions, because everyone is connected to one another.</p>
<blockquote>
<p>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.</p>
</blockquote>
<p>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.</p>
<blockquote>
<p>Then the node puts the node or miner on a list of IP addresses, to broadcast transactions and blocks accordingly.</p>
</blockquote>
<p>Nodes only <em>ever</em> 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.</p>

CC BY-SA 4.0
2023-07-03T07:17:18.743Z
Could you explain how DNS seeding works?
CJ-Programmer
CC BY-SA 4.0
2023-07-04T13:08:30.797Z
@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.
Pieter Wuille
CC BY-SA 4.0
2023-07-07T06:18:51.657Z
Ah I see. Thanks for the knowledge!
CJ-Programmer
CC BY-SA 4.0
2023-07-02T13:05:17.957Z
2023-07-02T13:05:17.957Z
Pieter Wuille
<p>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.</p>
<p>What part did I get wrong?</p>

<transactions><nodes><peer-discovery><block>
How does node discovery and miner discovery work?
CJ-Programmer
# How does node discovery and miner discovery work?

(Asked by: username_0 on 2023-07-02)

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?

**Tags:** transactions, nodes, peer-discovery, block


---

## 1 answers

### Answer by username_1 on 2023-07-02. Score: 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.

> **Comments:**
> **username_0**: Could you explain how DNS seeding works?  
> **username_1**: @username_0 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.  
> **username_0**: Ah I see. Thanks for the knowledge!  

---

