<p>The peer discovery process, in order of priority:  </p>

<ol>
<li>the client attempts to connect to peers in it's local <code>peers.dat</code> database  </li>
<li>the client attempts to gain peers from one of four DNS-based seed nodes, hosted by Bitcoin developers  </li>
<li>the client gives up</li>
</ol>

<p>The <code>peers.dat</code> database is filled with information using <code>addr</code> messages, which connected peers use to exchange their knowledge of other existing nodes in the network. </p>

<p>If you want to make your own local nodes, you need to set <code>discovery</code> to <code>0</code>, which will disable advertising of the peers as available for incoming connections. You can then forge connections using local DNS or simply ip addresses of other local nodes with the <code>connect</code> option. At least one of these will need to be connecting out to the wider network for you to be able to stay up to date, and to mine on using p2pool. More than one connection out is vital to the stability of your private nodes. </p>

CC BY-SA 3.0
2013-11-07T09:24:27.470Z
2013-11-08T01:09:05.803Z
2013-11-08T01:09:05.803Z
Anonymous
<p>I've seen a <a href="https://bitcoin.stackexchange.com/questions/3536/how-bitcoin-clients-find-each-other">few questions</a> about this already and they talk in generalities. I'm talking about specifics. If I start the bitcoin client from scratch, where in the source code does it actually add nodes.</p>

<p><a href="http://bitcoin.sipa.be/seeds.txt" rel="nofollow noreferrer">http://bitcoin.sipa.be/seeds.txt</a> seems to be a list of known clients, which is fine, but where in source does it connect. If I wanted to create my own private network, how would I accomplish this?</p>

<p>If there's just one client on the network, is that client still doing all of the work that bitcoin does? Mining, etc.</p>

<peer-discovery>
How does bitcoin find peers?
Shamoon
# How does bitcoin find peers?

(Asked by: username_0 on 2013-11-07)

I've seen a [few questions](https://bitcoin.stackexchange.com/questions/3536/how-bitcoin-clients-find-each-other) about this already and they talk in generalities. I'm talking about specifics. If I start the bitcoin client from scratch, where in the source code does it actually add nodes.

<http://bitcoin.sipa.be/seeds.txt> seems to be a list of known clients, which is fine, but where in source does it connect. If I wanted to create my own private network, how would I accomplish this?

If there's just one client on the network, is that client still doing all of the work that bitcoin does? Mining, etc.

**Tags:** peer-discovery


---

## 1 answers

### Answer by username_1 on 2013-11-07. Score: 8 | Accepted answer

The peer discovery process, in order of priority:

1. the client attempts to connect to peers in it's local `peers.dat` database
2. the client attempts to gain peers from one of four DNS-based seed nodes, hosted by Bitcoin developers
3. the client gives up

The `peers.dat` database is filled with information using `addr` messages, which connected peers use to exchange their knowledge of other existing nodes in the network.

If you want to make your own local nodes, you need to set `discovery` to `0`, which will disable advertising of the peers as available for incoming connections. You can then forge connections using local DNS or simply ip addresses of other local nodes with the `connect` option. At least one of these will need to be connecting out to the wider network for you to be able to stay up to date, and to mine on using p2pool. More than one connection out is vital to the stability of your private nodes.


---

